mirror of
https://github.com/glest/glest-source.git
synced 2025-02-25 20:22:31 +01:00
- bugfix, only allow changing player info AFTER we get game settings from the server after requesting a change to avoid deadlocks etc.
This commit is contained in:
parent
b0228ce651
commit
2555a895c3
@ -197,112 +197,62 @@ void MenuStateConnectedGame::mouseClick(int x, int y, MouseButton mouseButton){
|
|||||||
currentMap="";
|
currentMap="";
|
||||||
returnToJoinMenu();
|
returnToJoinMenu();
|
||||||
}
|
}
|
||||||
else if(buttonPlayNow.mouseClick(x,y) && buttonPlayNow.getEnabled()) {
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
// Only allow changes after we get game settings from the server
|
||||||
soundRenderer.playFx(coreData.getClickSoundC());
|
if( clientInterface->isConnected() == true &&
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
clientInterface->getGameSettingsReceived() == true) {
|
||||||
}
|
if(buttonPlayNow.mouseClick(x,y) && buttonPlayNow.getEnabled()) {
|
||||||
else
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
{
|
soundRenderer.playFx(coreData.getClickSoundC());
|
||||||
int myCurrentIndex=-1;
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
for(int i=0; i<GameConstants::maxPlayers; ++i)
|
|
||||||
{// find my current index by looking at editable listBoxes
|
|
||||||
if(listBoxFactions[i].getEditable()){
|
|
||||||
myCurrentIndex=i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (myCurrentIndex!=-1)
|
else
|
||||||
for(int i=0; i<GameConstants::maxPlayers; ++i)
|
|
||||||
{
|
{
|
||||||
if(listBoxFactions[i].getEditable()){
|
int myCurrentIndex=-1;
|
||||||
if(listBoxFactions[i].mouseClick(x, y)){
|
for(int i=0; i<GameConstants::maxPlayers; ++i)
|
||||||
soundRenderer.playFx(coreData.getClickSoundA());
|
{// find my current index by looking at editable listBoxes
|
||||||
ClientInterface* clientInterface= NetworkManager::getInstance().getClientInterface();
|
if(listBoxFactions[i].getEditable()){
|
||||||
if(clientInterface->isConnected()){
|
myCurrentIndex=i;
|
||||||
clientInterface->setGameSettingsReceived(false);
|
|
||||||
clientInterface->sendSwitchSetupRequest(listBoxFactions[i].getSelectedItem(),i,-1,listBoxTeams[i].getSelectedItemIndex());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(listBoxTeams[i].getEditable()){
|
if (myCurrentIndex!=-1)
|
||||||
if(listBoxTeams[i].mouseClick(x, y)){
|
for(int i=0; i<GameConstants::maxPlayers; ++i)
|
||||||
soundRenderer.playFx(coreData.getClickSoundA());
|
{
|
||||||
if(clientInterface->isConnected()){
|
if(listBoxFactions[i].getEditable()){
|
||||||
clientInterface->setGameSettingsReceived(false);
|
if(listBoxFactions[i].mouseClick(x, y)){
|
||||||
clientInterface->sendSwitchSetupRequest(listBoxFactions[i].getSelectedItem(),i,-1,listBoxTeams[i].getSelectedItemIndex());
|
soundRenderer.playFx(coreData.getClickSoundA());
|
||||||
|
ClientInterface* clientInterface= NetworkManager::getInstance().getClientInterface();
|
||||||
|
if(clientInterface->isConnected()){
|
||||||
|
clientInterface->setGameSettingsReceived(false);
|
||||||
|
clientInterface->sendSwitchSetupRequest(listBoxFactions[i].getSelectedItem(),i,-1,listBoxTeams[i].getSelectedItemIndex());
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
if(listBoxTeams[i].getEditable()){
|
||||||
if((listBoxControls[i].getSelectedItemIndex() == ctNetwork) &&
|
if(listBoxTeams[i].mouseClick(x, y)){
|
||||||
(labelNetStatus[i].getText() == GameConstants::NETWORK_SLOT_UNCONNECTED_SLOTNAME)) {
|
soundRenderer.playFx(coreData.getClickSoundA());
|
||||||
if(grabSlotButton[i].mouseClick(x, y) )
|
if(clientInterface->isConnected()){
|
||||||
{
|
clientInterface->setGameSettingsReceived(false);
|
||||||
soundRenderer.playFx(coreData.getClickSoundA());
|
clientInterface->sendSwitchSetupRequest(listBoxFactions[i].getSelectedItem(),i,-1,listBoxTeams[i].getSelectedItemIndex());
|
||||||
clientInterface->setGameSettingsReceived(false);
|
}
|
||||||
settingsReceivedFromServer=false;
|
break;
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] sending a switchSlot request from %d to %d\n",__FILE__,__FUNCTION__,__LINE__,clientInterface->getGameSettings()->getThisFactionIndex(),i);
|
}
|
||||||
clientInterface->sendSwitchSetupRequest(listBoxFactions[myCurrentIndex].getSelectedItem(),myCurrentIndex,i,listBoxTeams[myCurrentIndex].getSelectedItemIndex());
|
}
|
||||||
break;
|
if((listBoxControls[i].getSelectedItemIndex() == ctNetwork) &&
|
||||||
|
(labelNetStatus[i].getText() == GameConstants::NETWORK_SLOT_UNCONNECTED_SLOTNAME)) {
|
||||||
|
if(grabSlotButton[i].mouseClick(x, y) )
|
||||||
|
{
|
||||||
|
soundRenderer.playFx(coreData.getClickSoundA());
|
||||||
|
clientInterface->setGameSettingsReceived(false);
|
||||||
|
settingsReceivedFromServer=false;
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] sending a switchSlot request from %d to %d\n",__FILE__,__FUNCTION__,__LINE__,clientInterface->getGameSettings()->getThisFactionIndex(),i);
|
||||||
|
clientInterface->sendSwitchSetupRequest(listBoxFactions[myCurrentIndex].getSelectedItem(),myCurrentIndex,i,listBoxTeams[myCurrentIndex].getSelectedItemIndex());
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// for(int i=0; i<mapInfo.players; ++i)
|
|
||||||
// {
|
|
||||||
// //ensure thet only 1 human player is present
|
|
||||||
// if(listBoxControls[i].mouseClick(x, y))
|
|
||||||
// {
|
|
||||||
// //look for human players
|
|
||||||
// int humanIndex1= -1;
|
|
||||||
// int humanIndex2= -1;
|
|
||||||
// for(int j=0; j<GameConstants::maxPlayers; ++j){
|
|
||||||
// ControlType ct= static_cast<ControlType>(listBoxControls[j].getSelectedItemIndex());
|
|
||||||
// if(ct==ctHuman){
|
|
||||||
// if(humanIndex1==-1){
|
|
||||||
// humanIndex1= j;
|
|
||||||
// }
|
|
||||||
// else{
|
|
||||||
// humanIndex2= j;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// //no human
|
|
||||||
// if(humanIndex1==-1 && humanIndex2==-1){
|
|
||||||
// listBoxControls[i].setSelectedItemIndex(ctHuman);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// //2 humans
|
|
||||||
// if(humanIndex1!=-1 && humanIndex2!=-1){
|
|
||||||
// listBoxControls[humanIndex1==i? humanIndex2: humanIndex1].setSelectedItemIndex(ctClosed);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if(hasNetworkGameSettings() == true)
|
|
||||||
// {
|
|
||||||
// needToSetChangedGameSettings = true;
|
|
||||||
// lastSetChangedGameSettings = time(NULL);;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else if(listBoxFactions[i].mouseClick(x, y)){
|
|
||||||
//
|
|
||||||
// if(hasNetworkGameSettings() == true)
|
|
||||||
// {
|
|
||||||
// needToSetChangedGameSettings = true;
|
|
||||||
// lastSetChangedGameSettings = time(NULL);;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else if(listBoxTeams[i].mouseClick(x, y))
|
|
||||||
// {
|
|
||||||
// if(hasNetworkGameSettings() == true)
|
|
||||||
// {
|
|
||||||
// needToSetChangedGameSettings = true;
|
|
||||||
// lastSetChangedGameSettings = time(NULL);;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user