- 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:
Mark Vejvoda 2010-06-30 14:51:30 +00:00
parent b0228ce651
commit 2555a895c3

View File

@ -197,7 +197,11 @@ void MenuStateConnectedGame::mouseClick(int x, int y, MouseButton mouseButton){
currentMap="";
returnToJoinMenu();
}
else if(buttonPlayNow.mouseClick(x,y) && buttonPlayNow.getEnabled()) {
// Only allow changes after we get game settings from the server
if( clientInterface->isConnected() == true &&
clientInterface->getGameSettingsReceived() == true) {
if(buttonPlayNow.mouseClick(x,y) && buttonPlayNow.getEnabled()) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
soundRenderer.playFx(coreData.getClickSoundC());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
@ -248,61 +252,7 @@ void MenuStateConnectedGame::mouseClick(int x, int y, MouseButton mouseButton){
}
}
}
// 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__);
}