diff --git a/source/glest_game/game/game.cpp b/source/glest_game/game/game.cpp index 557b061c3..8c67f10dc 100644 --- a/source/glest_game/game/game.cpp +++ b/source/glest_game/game/game.cpp @@ -2963,8 +2963,9 @@ namespace Game { __LINE__, i, j, world.getFactionCount(), chrono.getMillis()); - aiInterfaces[j]->signalWorkerThread(world.getFrameCount - ()); + AiInterface* ai = aiInterfaces[j]; + if (ai != NULL) + ai->signalWorkerThread(world.getFrameCount()); hasAIPlayer = true; } } @@ -3001,8 +3002,8 @@ namespace Game { && scriptManager.getPlayerModifiers(j)->getAiEnabled () == true) { - if (aiInterfaces[j]->isWorkerThreadSignalCompleted - (world.getFrameCount()) == false) { + AiInterface* ai = aiInterfaces[j]; + if (ai != NULL && ai->isWorkerThreadSignalCompleted(world.getFrameCount()) == false) { workThreadsFinished = false; break; } @@ -3710,10 +3711,7 @@ namespace Game { bool switchRequested = - switchSetupForSlots(server, 0, map->getMaxPlayers(), false); - switchRequested = switchRequested - || switchSetupForSlots(server, map->getMaxPlayers(), - GameConstants::maxPlayers, true); + switchSetupForSlots(server, 0, map->getMaxPlayers()); if (switchRequested == true) { //printf("Send new game setup from switch: %d\n",switchRequested); @@ -4026,8 +4024,7 @@ namespace Game { bool Game::switchSetupForSlots(ServerInterface * &serverInterface, - int startIndex, int endIndex, - bool onlyNetworkUnassigned) { + int startIndex, int endIndex) { bool switchRequested = false; if (serverInterface == NULL) { return switchRequested; @@ -4056,17 +4053,7 @@ namespace Game { switchSetupRequests[i]->getSwitchFlags ()); - if (onlyNetworkUnassigned == true - && gameSettings.getFactionControl(i) != ctNetworkUnassigned) { - if (i < map->getMaxPlayers() - || (i >= map->getMaxPlayers() - && gameSettings.getFactionControl(i) != ctNetwork)) { - continue; - } - } - if (gameSettings.getFactionControl(i) == ctNetwork || - gameSettings.getFactionControl(i) == ctNetworkUnassigned || //(gameSettings.getFactionControl(i) != ctClosed && gameSettings.getFactionControl(i) != ctHuman)) { (gameSettings.getFactionControl(i) != ctHuman)) { if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem). @@ -7571,7 +7558,7 @@ namespace Game { factionInfo += " [" + formatString(this->gameSettings.getFactionTypeName(i)) + - " team: " + intToStr(this->gameSettings.getTeam(i)) + "]"; + " team: " + intToStr(this->gameSettings.getTeam(i) + 1) + "]"; // bool showResourceDebugInfo = true; // if(showResourceDebugInfo == true) { diff --git a/source/glest_game/game/game.h b/source/glest_game/game/game.h index c171ce957..398f68815 100644 --- a/source/glest_game/game/game.h +++ b/source/glest_game/game/game.h @@ -526,8 +526,7 @@ namespace Game { bool switchSetupForSlots(ServerInterface * &serverInterface, - int startIndex, int endIndex, - bool onlyNetworkUnassigned); + int startIndex, int endIndex); void processNetworkSynchChecksIfRequired(); Stats getEndGameStats(); void checkWinnerStandardHeadlessOrObserver(); diff --git a/source/glest_game/game/game_constants.h b/source/glest_game/game/game_constants.h index f013db621..7fdfb50b0 100644 --- a/source/glest_game/game/game_constants.h +++ b/source/glest_game/game/game_constants.h @@ -138,7 +138,6 @@ namespace Game { ctCpuUltra, ctCpuZeta, ctNetwork, - ctNetworkUnassigned, ctHuman }; diff --git a/source/glest_game/game/game_settings.h b/source/glest_game/game/game_settings.h index c11084ada..34c06380e 100644 --- a/source/glest_game/game/game_settings.h +++ b/source/glest_game/game/game_settings.h @@ -231,7 +231,7 @@ namespace Game { networkPlayerStatuses[i] = npst_None; networkPlayerLanguages[i] = DEFAULT_LANG; factionControls[i] = ctClosed; - resourceMultiplierIndex[i] = 1.0f; + resourceMultiplierIndex[i] = 1; teams[i] = 0; startLocationIndex[i] = i; networkPlayerGameStatus[i] = 0; @@ -249,7 +249,7 @@ namespace Game { aiAcceptSwitchTeamPercentChance = 30; masterserver_admin = -1; masterserver_admin_factionIndex = -1; - fallbackCpuMultiplier = 1.0f; + fallbackCpuMultiplier = 1; networkAllowNativeLanguageTechtree = true; } @@ -493,9 +493,7 @@ namespace Game { bool result = false; for (int idx = 0; idx < GameConstants::maxPlayers; ++idx) { - if (factionControls[idx] == ctNetwork - || factionControls[idx] == ctNetworkUnassigned - || networkPlayerStatuses[idx] == npst_Disconnected) { + if (factionControls[idx] == ctNetwork || networkPlayerStatuses[idx] == npst_Disconnected) { result = true; break; } diff --git a/source/glest_game/global/core_data.cpp b/source/glest_game/global/core_data.cpp index 13ae7fd9a..dd079387f 100644 --- a/source/glest_game/global/core_data.cpp +++ b/source/glest_game/global/core_data.cpp @@ -1668,8 +1668,7 @@ namespace Game { ("AiAcceptSwitchTeamPercentChance", "30")); gameSettings->setFallbackCpuMultiplier(properties. - getInt("FallbackCpuMultiplier", - "5")); + getInt("FallbackCpuMultiplier", "1")); gameSettings->setPathFinderType(static_cast (properties. @@ -1711,16 +1710,12 @@ namespace Game { intToStr(ctClosed). c_str())); - if (gameSettings->getFactionControl(i) == ctNetworkUnassigned) { - gameSettings->setFactionControl(i, ctNetwork); - } - gameSettings->setResourceMultiplierIndex(i, properties. getInt(string ("ResourceMultiplierIndex") + intToStr(i), - "5")); + "1")); gameSettings->setTeam(i, properties. getInt(string("FactionTeamForIndex") + diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index dab1ace2e..961390595 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -7355,7 +7355,7 @@ namespace Game { gameSettings->setNetworkPlayerStatuses(i, npst_None); gameSettings->setFactionControl(i, ct); gameSettings->setStartLocationIndex(i, i); - gameSettings->setResourceMultiplierIndex(i, 10); + gameSettings->setResourceMultiplierIndex(i, gameSettings->getFallbackCpuMultiplier()); gameSettings->setNetworkPlayerName(i, GameConstants:: NETWORK_SLOT_CLOSED_SLOTNAME); diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index a597dae7f..98c6edda8 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -557,7 +557,6 @@ namespace Game { controlItems.push_back(lang.getString("CpuUltra")); controlItems.push_back(lang.getString("CpuZeta")); controlItems.push_back(lang.getString("Network")); - controlItems.push_back(lang.getString("NetworkUnassigned")); controlItems.push_back(lang.getString("Human")); for (int i = 1; i <= GameConstants::maxPlayers; ++i) { @@ -957,7 +956,6 @@ namespace Game { controlItems.push_back(lang.getString("CpuUltra")); controlItems.push_back(lang.getString("CpuZeta")); controlItems.push_back(lang.getString("Network")); - controlItems.push_back(lang.getString("NetworkUnassigned")); controlItems.push_back(lang.getString("Human")); for (int i = 0; i < GameConstants::maxPlayers; ++i) { @@ -2368,18 +2366,6 @@ namespace Game { ClientInterface * clientInterface = networkManager.getClientInterface(); - for (int i = 0; i < mapInfo.players; ++i) { - if (listBoxControls[i].getSelectedItemIndex() == - ctNetworkUnassigned) { - listBoxControls[i].setSelectedItemIndex(ctNetwork); - } - } - for (int i = mapInfo.players; i < GameConstants::maxPlayers; ++i) { - if (listBoxControls[i].getSelectedItemIndex() == ctNetwork) { - listBoxControls[i].setSelectedItemIndex(ctNetworkUnassigned); - } - } - if (validDisplayedGamesettings) { loadGameSettings(&displayedGamesettings); @@ -2619,20 +2605,10 @@ namespace Game { (__FILE__).c_str(), __FUNCTION__, __LINE__); - //!! this must be done two times!"" - if (listBoxControls[i].getSelectedItemIndex() == - ctNetworkUnassigned) { - listBoxControls[i].mouseClick(x, y); - } if ((isHeadlessAdmin() == true) && (listBoxControls[i].getSelectedItemIndex() == ctHuman)) { listBoxControls[i].mouseClick(x, y); } - //!! this must be done two times!"" - if (listBoxControls[i].getSelectedItemIndex() == - ctNetworkUnassigned) { - listBoxControls[i].mouseClick(x, y); - } updateResourceMultiplier(i); @@ -3181,7 +3157,7 @@ namespace Game { gameSettings->setNetworkPlayerLanguages(slotIndex, lang.getLanguage()); - gameSettings->setResourceMultiplierIndex(slotIndex, 5); + gameSettings->setResourceMultiplierIndex(slotIndex, 1); } else { gameSettings->setResourceMultiplierIndex(slotIndex, listBoxRMultiplier @@ -3216,11 +3192,8 @@ namespace Game { gameSettings->setStartLocationIndex(slotIndex, i); //printf("!!! setStartLocationIndex #1 slotIndex = %d, i = %d\n",slotIndex, i); - if (listBoxControls[i].getSelectedItemIndex() == ctNetwork - || listBoxControls[i].getSelectedItemIndex() == - ctNetworkUnassigned) { - if (oldControlType != ctNetwork - && oldControlType != ctNetworkUnassigned) { + if (listBoxControls[i].getSelectedItemIndex() == ctNetwork) { + if (oldControlType != ctNetwork) { gameSettings->setNetworkPlayerName(slotIndex, ""); } } else if (listBoxControls[i].getSelectedItemIndex() != ctHuman) { @@ -3264,7 +3237,7 @@ namespace Game { gameSettings->setStartLocationIndex(slotIndex, i); //printf("!!! setStartLocationIndex #2 slotIndex = %d, i = %d\n",slotIndex, i); - gameSettings->setResourceMultiplierIndex(slotIndex, 5); + gameSettings->setResourceMultiplierIndex(slotIndex, gameSettings->getFallbackCpuMultiplier()); if (SystemFlags:: getSystemSettingType(SystemFlags::debugSystem).enabled) @@ -3653,13 +3626,12 @@ namespace Game { ClientInterface * clientInterface = networkManager.getClientInterface(); for (int i = 0; i < GameConstants::maxPlayers; ++i) { - if (listBoxControls[i].getSelectedItemIndex() == - ctNetworkUnassigned) { + if (listBoxControls[i].getSelectedItemIndex() == ctNetwork) { bool renderIt = true; //printf("Player #%d [%s] control = %d\n",i,labelPlayerNames[i].getText().c_str(),listBoxControls[i].getSelectedItemIndex()); - if (labelNetStatus[i].getText().length() == 0) { + /*if (labelNetStatus[i].getText().length() == 0) { renderIt = false; - } + }*/ labelPlayers[i].setVisible(renderIt); labelPlayerNames[i].setVisible(renderIt); listBoxControls[i].setVisible(renderIt); @@ -3752,16 +3724,11 @@ namespace Game { renderer.renderButton(&grabSlotButton[i]); } } else if (listBoxControls[i].getSelectedItemIndex() == ctNetwork - || listBoxControls[i].getSelectedItemIndex() == - ctNetworkUnassigned || listBoxControls[i].getSelectedItemIndex() == ctHuman) { renderer.renderLabel(&labelNetStatus[i]); } - if (listBoxControls[i].getSelectedItemIndex() == ctNetwork || - listBoxControls[i].getSelectedItemIndex() == - ctNetworkUnassigned - || listBoxControls[i].getSelectedItemIndex() == ctHuman) { + if (listBoxControls[i].getSelectedItemIndex() == ctNetwork || listBoxControls[i].getSelectedItemIndex() == ctHuman) { if (labelNetStatus[i].getText().length() != 0) { renderer.renderLabel(&labelPlayerNames[i]); } @@ -5920,7 +5887,7 @@ namespace Game { static_cast (listBoxControls[i].getSelectedItemIndex()); if (ct != ctClosed) { - if (ct == ctNetwork || ct == ctNetworkUnassigned) { + if (ct == ctNetwork) { hasNetworkSlot = true; break; } @@ -5932,11 +5899,9 @@ namespace Game { ct = static_cast (listBoxControls[i].getSelectedItemIndex()); - if (ct != ctClosed) { - if (ct == ctNetworkUnassigned) { - hasNetworkSlot = true; - break; - } + if (ct == ctNetwork) { + hasNetworkSlot = true; + break; } } } @@ -7623,7 +7588,7 @@ namespace Game { } if (i >= mapInfo.players) { - if (gameSettings->getFactionControl(i) != ctNetworkUnassigned) { + if (gameSettings->getFactionControl(i) != ctNetwork) { continue; } else if (clientInterface->getPlayerIndex() != slot) { continue; @@ -7631,7 +7596,6 @@ namespace Game { } if (gameSettings->getFactionControl(i) == ctNetwork || - gameSettings->getFactionControl(i) == ctNetworkUnassigned || gameSettings->getFactionControl(i) == ctHuman) { switch (gameSettings->getNetworkPlayerStatuses(i)) { case npst_BeRightBack: @@ -7671,8 +7635,7 @@ namespace Game { getFactionTypeName(i)), false); - if (gameSettings->getFactionControl(i) == ctNetwork || - gameSettings->getFactionControl(i) == ctNetworkUnassigned) { + if (gameSettings->getFactionControl(i) == ctNetwork) { labelNetStatus[slot]. setText(gameSettings->getNetworkPlayerName(i)); if (gameSettings->getThisFactionIndex() != i @@ -7691,14 +7654,12 @@ namespace Game { listBoxRMultiplier[slot].setVisible(true); } - if ((gameSettings->getFactionControl(i) == ctNetwork || - gameSettings->getFactionControl(i) == ctNetworkUnassigned) && + if ((gameSettings->getFactionControl(i) == ctNetwork) && gameSettings->getThisFactionIndex() == i) { // set my current slot to ctHuman - if (gameSettings->getFactionControl(i) != ctNetworkUnassigned) { - listBoxControls[slot].setSelectedItemIndex(ctHuman); - } + listBoxControls[slot].setSelectedItemIndex(ctHuman); + if (checkBoxScenario.getValue() == false) { if (clientInterface->getJoinGameInProgress() == false) { if (i <= mapInfo.hardMaxPlayers) { diff --git a/source/glest_game/menu/menu_state_custom_game.cpp b/source/glest_game/menu/menu_state_custom_game.cpp index 1143d6d3c..d7a315c07 100644 --- a/source/glest_game/menu/menu_state_custom_game.cpp +++ b/source/glest_game/menu/menu_state_custom_game.cpp @@ -832,7 +832,6 @@ namespace Game { controlItems.push_back(lang.getString("CpuUltra")); controlItems.push_back(lang.getString("CpuZeta")); controlItems.push_back(lang.getString("Network")); - controlItems.push_back(lang.getString("NetworkUnassigned")); controlItems.push_back(lang.getString("Human")); vector < string > teamItems; @@ -1166,7 +1165,6 @@ namespace Game { controlItems.push_back(lang.getString("CpuUltra")); controlItems.push_back(lang.getString("CpuZeta")); controlItems.push_back(lang.getString("Network")); - controlItems.push_back(lang.getString("NetworkUnassigned")); controlItems.push_back(lang.getString("Human")); for (int i = 0; i < GameConstants::maxPlayers; ++i) { @@ -2097,12 +2095,6 @@ namespace Game { listBoxControls[index].setSelectedItemIndex (listBoxControls[i].getSelectedItemIndex()); } - // Skip over networkunassigned - if (listBoxControls[index].getSelectedItemIndex() == - ctNetworkUnassigned - && selectedControlItemIndex != ctNetworkUnassigned) { - listBoxControls[index].mouseClick(x, y); - } //look for human players int humanIndex1 = -1; @@ -2632,7 +2624,7 @@ namespace Game { bool dataSynchCheckOk = checkNetworkPlayerDataSynch(true, true, true); - // Ensure we have no dangling network players + /*// Ensure we have no dangling network players for (int i = 0; i < GameConstants::maxPlayers; ++i) { if (listBoxControls[i].getSelectedItemIndex() == ctNetworkUnassigned) { mainMessageBoxState = 1; @@ -2677,7 +2669,7 @@ namespace Game { safeMutexCLI.ReleaseLock(); return; } - } + }*/ if (dataSynchCheckOk == false) { if (SystemFlags:: @@ -3015,8 +3007,8 @@ namespace Game { } } for (int i = 0; i < GameConstants::maxPlayers; ++i) { - if (listBoxControls[i].getSelectedItemIndex() == - ctNetworkUnassigned) { + /*if (listBoxControls[i].getSelectedItemIndex() == + ctNetwork) {*/ //printf("Player #%d [%s] control = %d\n",i,labelPlayerNames[i].getText().c_str(),listBoxControls[i].getSelectedItemIndex()); labelPlayers[i].setVisible(true); labelPlayerNames[i].setVisible(true); @@ -3024,7 +3016,7 @@ namespace Game { listBoxFactions[i].setVisible(true); listBoxTeams[i].setVisible(true); labelNetStatus[i].setVisible(true); - } + //} if (hasNetworkGameSettings() == true && listBoxControls[i].getSelectedItemIndex() != ctClosed) { @@ -3054,10 +3046,7 @@ namespace Game { renderer.renderLabel(&labelPlayerStatus[i]); - if (listBoxControls[i].getSelectedItemIndex() == - ctNetwork - || listBoxControls[i].getSelectedItemIndex() == - ctNetworkUnassigned) { + if (listBoxControls[i].getSelectedItemIndex() == ctNetwork) { ServerInterface *serverInterface = NetworkManager::getInstance().getServerInterface(); if (serverInterface != NULL @@ -3198,8 +3187,7 @@ namespace Game { ServerInterface * &serverInterface, int startIndex, - int endIndex, - bool onlyNetworkUnassigned) { + int endIndex) { for (int i = startIndex; i < endIndex; ++i) { if (switchSetupRequests[i] != NULL) { //printf("Switch slot = %d control = %d newIndex = %d currentindex = %d onlyNetworkUnassigned = %d\n",i,listBoxControls[i].getSelectedItemIndex(),switchSetupRequests[i]->getToFactionIndex(),switchSetupRequests[i]->getCurrentFactionIndex(),onlyNetworkUnassigned); @@ -3213,20 +3201,7 @@ namespace Game { switchSetupRequests[i]->getSwitchFlags ()); - if (onlyNetworkUnassigned == true - && listBoxControls[i].getSelectedItemIndex() != - ctNetworkUnassigned) { - if (i < mapInfo.players - || (i >= mapInfo.players - && listBoxControls[i].getSelectedItemIndex() != - ctNetwork)) { - continue; - } - } - - if (listBoxControls[i].getSelectedItemIndex() == ctNetwork - || listBoxControls[i].getSelectedItemIndex() == - ctNetworkUnassigned) { + if (listBoxControls[i].getSelectedItemIndex() == ctNetwork) { if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem). enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, @@ -3298,8 +3273,7 @@ namespace Game { (switchSetupRequests[i]->getNetworkPlayerName()); } - if (listBoxControls[switchFactionIdx].getSelectedItemIndex - () == ctNetworkUnassigned) { + if (listBoxControls[switchFactionIdx].getSelectedItemIndex() == ctNetwork) { /*serverInterface->removeSlot(switchFactionIdx); listBoxControls[switchFactionIdx].setSelectedItemIndex (ctClosed);*/ @@ -3567,9 +3541,7 @@ namespace Game { slotCountUsed++; } - if (listBoxControls[i].getSelectedItemIndex() == ctNetwork - || listBoxControls[i].getSelectedItemIndex() == - ctNetworkUnassigned) { + if (listBoxControls[i].getSelectedItemIndex() == ctNetwork) { slotCountHumans++; if (serverInterface->getSlot(i, true) != NULL && serverInterface->getSlot(i, true)->isConnected()) { @@ -4262,8 +4234,7 @@ namespace Game { static_cast (listBoxControls[i].getSelectedItemIndex()); - if (forceCloseUnusedSlots == true - && (ct == ctNetworkUnassigned || ct == ctNetwork)) { + if (forceCloseUnusedSlots == true && ct == ctNetwork) { if (serverInterface != NULL && (serverInterface->getSlot(i, true) == NULL || serverInterface->getSlot(i, true)->isConnected() == false)) { @@ -4274,9 +4245,6 @@ namespace Game { ct = ctClosed; } } - } else if (ct == ctNetworkUnassigned && i < mapInfo.players) { - listBoxControls[i].setSelectedItemIndex(ctNetwork); - ct = ctNetwork; } if (ct != ctClosed) { @@ -4380,9 +4348,7 @@ namespace Game { listBoxTeams[i].getSelectedItemIndex()); gameSettings->setStartLocationIndex(slotIndex, i); - if (listBoxControls[i].getSelectedItemIndex() == ctNetwork || - listBoxControls[i].getSelectedItemIndex() == - ctNetworkUnassigned) { + if (listBoxControls[i].getSelectedItemIndex() == ctNetwork) { if (serverInterface != NULL && serverInterface->getSlot(i, true) != NULL && serverInterface->getSlot(i, true)->isConnected()) { @@ -4489,7 +4455,7 @@ namespace Game { gameSettings->setTeam(slotIndex, listBoxTeams[i].getSelectedItemIndex()); gameSettings->setStartLocationIndex(slotIndex, i); - //gameSettings->setResourceMultiplierIndex(slotIndex, 10); + //gameSettings->setResourceMultiplierIndex(slotIndex, 1); listBoxRMultiplier[i].setSelectedItem("1.0"); gameSettings->setResourceMultiplierIndex(slotIndex, listBoxRMultiplier @@ -4662,9 +4628,7 @@ namespace Game { c_str(), __FUNCTION__, __LINE__); #endif - if (listBoxControls[i].getSelectedItemIndex() == ctNetwork - || listBoxControls[i].getSelectedItemIndex() == - ctNetworkUnassigned) { + if (listBoxControls[i].getSelectedItemIndex() == ctNetwork) { if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem). enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, @@ -4805,7 +4769,7 @@ namespace Game { ControlType ctUI = static_cast (listBoxControls[index2].getSelectedItemIndex()); - if (ctUI != ctNetwork && ctUI != ctNetworkUnassigned) { + if (ctUI != ctNetwork) { foundValidHumanControlTypeInFile = true; //printf("Human found in file [%d]\n",index2); } else if (labelPlayerNames[index2].getText() == "") { @@ -5192,9 +5156,7 @@ namespace Game { bool foundConnectedPlayer = false; for (int i = 0; i < GameConstants::maxPlayers; ++i) { if (serverInterface->getSlot(i, true) != NULL && - (listBoxControls[i].getSelectedItemIndex() == ctNetwork || - listBoxControls[i].getSelectedItemIndex() == - ctNetworkUnassigned)) { + (listBoxControls[i].getSelectedItemIndex() == ctNetwork)) { if (serverInterface->getSlot(i, true)->isConnected() == true) { foundConnectedPlayer = true; } @@ -5219,11 +5181,9 @@ namespace Game { ControlType ct = static_cast (listBoxControls[i].getSelectedItemIndex()); - if (ct != ctClosed) { - if (ct == ctNetwork || ct == ctNetworkUnassigned) { - hasNetworkSlot = true; - break; - } + if (ct == ctNetwork) { + hasNetworkSlot = true; + break; } } if (hasNetworkSlot == false) { @@ -5231,11 +5191,9 @@ namespace Game { ControlType ct = static_cast (listBoxControls[i].getSelectedItemIndex()); - if (ct != ctClosed) { - if (ct == ctNetworkUnassigned) { - hasNetworkSlot = true; - break; - } + if (ct == ctNetwork) { + hasNetworkSlot = true; + break; } } } @@ -5276,23 +5234,18 @@ namespace Game { mapInfo->players = GameConstants::maxPlayers; } - ServerInterface *serverInterface = + /*ServerInterface *serverInterface = NetworkManager::getInstance().getServerInterface(); for (int i = 0; i < GameConstants::maxPlayers; ++i) { if (serverInterface->getSlot(i, true) != NULL && - (listBoxControls[i].getSelectedItemIndex() == ctNetwork - || listBoxControls[i].getSelectedItemIndex() == - ctNetworkUnassigned)) { + (listBoxControls[i].getSelectedItemIndex() == ctNetwork)) { if (serverInterface->getSlot(i, true)->isConnected() == true) { - if (i + 1 > mapInfo->players && - listBoxControls[i].getSelectedItemIndex() != - ctNetworkUnassigned) { - listBoxControls[i].setSelectedItemIndex - (ctNetworkUnassigned); + if (i + 1 > mapInfo->players && listBoxControls[i].getSelectedItemIndex() != ctNetworkUnassigned) { + listBoxControls[i].setSelectedItemIndex(ctNetworkUnassigned); } } } - } + }*/ // Not painting properly so this is on hold if (loadMapPreview == true) { @@ -5328,9 +5281,7 @@ namespace Game { NetworkManager::getInstance().getServerInterface(); //for(int i= 0; igetSlot(i, true) == NULL || serverInterface->getSlot(i, true)->isConnected() == diff --git a/source/glest_game/menu/menu_state_custom_game.h b/source/glest_game/menu/menu_state_custom_game.h index e83388251..f9f17f69e 100644 --- a/source/glest_game/menu/menu_state_custom_game.h +++ b/source/glest_game/menu/menu_state_custom_game.h @@ -373,7 +373,7 @@ namespace Game { void switchSetupForSlots(SwitchSetupRequest ** switchSetupRequests, ServerInterface * &serverInterface, int startIndex, - int endIndex, bool onlyNetworkUnassigned); + int endIndex); string createGameName(string controllingPlayer = ""); void diff --git a/source/glest_game/menu/menu_state_custom_game_update.cpp b/source/glest_game/menu/menu_state_custom_game_update.cpp index b113e3f29..67d8ccaa7 100644 --- a/source/glest_game/menu/menu_state_custom_game_update.cpp +++ b/source/glest_game/menu/menu_state_custom_game_update.cpp @@ -258,10 +258,7 @@ namespace Game { serverInterface->getSwitchSetupRequests(); //!!! switchSetupForSlots(switchSetupRequests, serverInterface, 0, - mapInfo.players, false); - switchSetupForSlots(switchSetupRequests, serverInterface, - mapInfo.players, GameConstants::maxPlayers, - true); + mapInfo.players); if (SystemFlags:: getSystemSettingType(SystemFlags::debugPerformance).enabled @@ -321,9 +318,7 @@ namespace Game { } } - if (listBoxControls[i].getSelectedItemIndex() == ctNetwork || - listBoxControls[i].getSelectedItemIndex() == - ctNetworkUnassigned) { + if (listBoxControls[i].getSelectedItemIndex() == ctNetwork) { hasOneNetworkSlotOpen = true; if (serverInterface->getSlot(i, true) != NULL && @@ -558,30 +553,17 @@ namespace Game { listBoxRMultiplier[i].setEditable(false); listBoxRMultiplier[i].setEnabled(false); listBoxRMultiplier[i].setVisible(false); - } else if (listBoxControls[i].getSelectedItemIndex() != - ctNetworkUnassigned) { - ConnectionSlot *slot = serverInterface->getSlot(i, true); - if ((listBoxControls[i].getSelectedItemIndex() != - ctNetwork) - || (listBoxControls[i].getSelectedItemIndex() == - ctNetwork && (slot == NULL - || slot->isConnected() == false))) { - listBoxControls[i].setEditable(true); - listBoxControls[i].setEnabled(true); - listBoxFactions[i].setEditable(true); - listBoxTeams[i].setEditable(true); - - if (listBoxControls[i].getSelectedItemIndex() == ctNetwork && - listBoxFactions[i].getSelectedItem() == formatString(GameConstants::OBSERVER_SLOTNAME)) { - listBoxFactions[i].setSelectedItemIndex(0); - } - } else { - listBoxControls[i].setEditable(false); - listBoxControls[i].setEnabled(false); - } } else { - listBoxControls[i].setEditable(false); - listBoxControls[i].setEnabled(false); + ConnectionSlot *slot = serverInterface->getSlot(i, true); + listBoxControls[i].setEditable(true); + listBoxControls[i].setEnabled(true); + listBoxFactions[i].setEditable(true); + listBoxTeams[i].setEditable(true); + + if (listBoxControls[i].getSelectedItemIndex() == ctNetwork && + listBoxFactions[i].getSelectedItem() == formatString(GameConstants::OBSERVER_SLOTNAME)) { + listBoxFactions[i].setSelectedItemIndex(0); + } } } } else // if this is a scenario... @@ -958,9 +940,7 @@ namespace Game { } for (int i = mapInfo.players; i < GameConstants::maxPlayers; ++i) { - if (listBoxControls[i].getSelectedItemIndex() != ctNetwork && - listBoxControls[i].getSelectedItemIndex() != - ctNetworkUnassigned) { + if (listBoxControls[i].getSelectedItemIndex() != ctNetwork) { //printf("Closed A [%d] [%s]\n",i,labelPlayerNames[i].getText().c_str()); listBoxControls[i].setSelectedItemIndex(ctClosed); @@ -1038,17 +1018,12 @@ namespace Game { }*/ if (slot->isConnected() == true) { if (listBoxControls[i].getSelectedItemIndex() != - ctNetworkUnassigned) { + ctNetwork) { listBoxControls[i].setSelectedItemIndex - (ctNetworkUnassigned); + (ctNetwork); } } else { serverInterface->removeSlot(i); - - if (listBoxControls[i].getSelectedItemIndex() == - ctNetworkUnassigned) { - listBoxControls[i].setSelectedItemIndex(ctClosed); - } } } else if (slot->getCanAcceptConnections() == false) { slot->setCanAcceptConnections(true); diff --git a/source/glest_game/world/scenario.cpp b/source/glest_game/world/scenario.cpp index a81b19f5c..e3382782f 100644 --- a/source/glest_game/world/scenario.cpp +++ b/source/glest_game/world/scenario.cpp @@ -629,7 +629,7 @@ Please contact the ZetaGlest team for more info."; gameSettings->setNetworkPlayerPlatform(factionCount, getPlatformNameString ()); - } else if (ct == ctNetwork || ct == ctNetworkUnassigned) { + } else if (ct == ctNetwork) { if (gameSettings->getNetworkPlayerName(factionCount) == "") { gameSettings->setNetworkPlayerName(factionCount, controllerTypeToStr(ct)); @@ -643,10 +643,7 @@ Please contact the ZetaGlest team for more info."; } } gameSettings->setFactionControl(factionCount, ct); - gameSettings->setResourceMultiplierIndex(factionCount, - (scenarioInfo->resourceMultipliers - [i] - - 0.5f) / 0.1f); + gameSettings->setResourceMultiplierIndex(factionCount, (scenarioInfo->resourceMultipliers[i] * 2) - 1); gameSettings->setTeam(factionCount, scenarioInfo->teams[i] - 1); gameSettings->setStartLocationIndex(factionCount, i); gameSettings->setFactionTypeName(factionCount, diff --git a/source/shared_lib/include/util/conversion.h b/source/shared_lib/include/util/conversion.h index b0e837dde..14489c288 100644 --- a/source/shared_lib/include/util/conversion.h +++ b/source/shared_lib/include/util/conversion.h @@ -45,8 +45,8 @@ namespace Shared { string uIntToStr(const uint64 value); string intToStr(const int64 value); string intToHex(int i); - string floatToStr(float f, int precsion = 2); - string doubleToStr(double f, int precsion = 2); + string floatToStr(float f, int precision = 2); + string doubleToStr(double f, int precision = 2); bool IsNumeric(const char *p, bool allowNegative = true);