- bugfix to disallow CPU players to be observers

- spelling mistake fix in error message
This commit is contained in:
Mark Vejvoda 2011-01-25 00:42:09 +00:00
parent 90d4072646
commit ed90d620b3
2 changed files with 11 additions and 1 deletions

View File

@ -664,7 +664,7 @@ Command* Commander::buildCommand(const NetworkCommand* networkCommand) const {
GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface();
if(gameNetworkInterface != NULL) {
char szMsg[1024]="";
sprintf(szMsg,"Player detected an error: Unit / Faction mismatch for unitId: %d, Local faction index = %d, remote idnex = %d. Game out of synch.",networkCommand->getUnitId(),unit->getFaction()->getIndex(),networkCommand->getUnitFactionIndex());
sprintf(szMsg,"Player detected an error: Unit / Faction mismatch for unitId: %d, Local faction index = %d, remote index = %d. Game out of synch.",networkCommand->getUnitId(),unit->getFaction()->getIndex(),networkCommand->getUnitFactionIndex());
gameNetworkInterface->sendTextMessage(szMsg,-1, true);
}

View File

@ -857,6 +857,16 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton){
}
else if(listBoxFactions[i].mouseClick(x, y)) {
//printf("factionFiles[listBoxFactions[i].getSelectedItemIndex()] [%s] i = %d selIndex = %d\n",factionFiles[listBoxFactions[i].getSelectedItemIndex()].c_str(),i,listBoxFactions[i].getSelectedItemIndex());
// Disallow CPU players to be observers
if(factionFiles[listBoxFactions[i].getSelectedItemIndex()] == formatString(GameConstants::OBSERVER_SLOTNAME) &&
(listBoxControls[i].getSelectedItemIndex() == ctCpuEasy || listBoxControls[i].getSelectedItemIndex() == ctCpu ||
listBoxControls[i].getSelectedItemIndex() == ctCpuUltra || listBoxControls[i].getSelectedItemIndex() == ctCpuMega)) {
listBoxFactions[i].setSelectedItemIndex(0);
}
//
if(listBoxPublishServer.getSelectedItemIndex() == 0) {
needToRepublishToMasterserver = true;
}