From cf1e3509fe94dc1533d6a66250d36375c480597d Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Mon, 21 Nov 2011 02:08:51 +0000 Subject: [PATCH] - commented out enabled observer at game end (automatically set to true now) --- .../menu/menu_state_connected_game.cpp | 57 ++++++++--------- .../menu/menu_state_connected_game.h | 4 +- .../menu/menu_state_custom_game.cpp | 63 ++++++++++--------- .../glest_game/menu/menu_state_custom_game.h | 4 +- 4 files changed, 65 insertions(+), 63 deletions(-) diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index bee2343c2..c78f6dfef 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -182,16 +182,16 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM // Enable Observer Mode - labelEnableObserverMode.registerGraphicComponent(containerName,"labelEnableObserverMode"); - labelEnableObserverMode.init(xoffset+460, aHeadPos, 80); + //labelEnableObserverMode.registerGraphicComponent(containerName,"labelEnableObserverMode"); + //labelEnableObserverMode.init(xoffset+460, aHeadPos, 80); - listBoxEnableObserverMode.registerGraphicComponent(containerName,"listBoxEnableObserverMode"); - listBoxEnableObserverMode.init(xoffset+460, aPos, 80); - listBoxEnableObserverMode.pushBackItem(lang.get("Yes")); - listBoxEnableObserverMode.pushBackItem(lang.get("No")); - listBoxEnableObserverMode.setSelectedItemIndex(0); - listBoxEnableObserverMode.setEditable(false); - labelEnableObserverMode.setText(lang.get("EnableObserverMode")); +// listBoxEnableObserverMode.registerGraphicComponent(containerName,"listBoxEnableObserverMode"); +// listBoxEnableObserverMode.init(xoffset+460, aPos, 80); +// listBoxEnableObserverMode.pushBackItem(lang.get("Yes")); +// listBoxEnableObserverMode.pushBackItem(lang.get("No")); +// listBoxEnableObserverMode.setSelectedItemIndex(0); +// listBoxEnableObserverMode.setEditable(false); +// labelEnableObserverMode.setText(lang.get("EnableObserverMode")); // Allow Switch Team Mode labelEnableSwitchTeamMode.registerGraphicComponent(containerName,"labelEnableSwitchTeamMode"); @@ -556,12 +556,12 @@ void MenuStateConnectedGame::reloadUI() { observerItems.push_back(lang.get("Yes")); listBoxAllowObservers.setItems(observerItems); - vector observerModeItems; - observerModeItems.push_back(lang.get("Yes")); - observerModeItems.push_back(lang.get("No")); - listBoxEnableObserverMode.setItems(observerModeItems); + //vector observerModeItems; + //observerModeItems.push_back(lang.get("Yes")); + //observerModeItems.push_back(lang.get("No")); + //listBoxEnableObserverMode.setItems(observerModeItems); - labelEnableObserverMode.setText(lang.get("EnableObserverMode")); + //labelEnableObserverMode.setText(lang.get("EnableObserverMode")); labelEnableSwitchTeamMode.setText(lang.get("EnableSwitchTeamMode")); @@ -1174,7 +1174,7 @@ void MenuStateConnectedGame::mouseClickAdmin(int x, int y, MouseButton mouseButt needToBroadcastServerSettings=true; broadcastServerSettingsDelayTimer=time(NULL); } - else if(listBoxEnableObserverMode.mouseClick(x, y)) { + //else if(listBoxEnableObserverMode.mouseClick(x, y)) { //MutexSafeWrapper safeMutex((publishToMasterserverThread != NULL ? publishToMasterserverThread->getMutexThreadObjectAccessor() : NULL),string(__FILE__) + "_" + intToStr(__LINE__)); // if(listBoxPublishServer.getSelectedItemIndex() == 0) { @@ -1188,9 +1188,9 @@ void MenuStateConnectedGame::mouseClickAdmin(int x, int y, MouseButton mouseButt // } //broadCastGameSettingsToMasterserver(); - needToBroadcastServerSettings=true; - broadcastServerSettingsDelayTimer=time(NULL); - } + // needToBroadcastServerSettings=true; + // broadcastServerSettingsDelayTimer=time(NULL); + //} else if (listBoxEnableSwitchTeamMode.mouseClick(x, y)) { //MutexSafeWrapper safeMutex((publishToMasterserverThread != NULL ? publishToMasterserverThread->getMutexThreadObjectAccessor() : NULL),string(__FILE__) + "_" + intToStr(__LINE__)); @@ -1574,7 +1574,8 @@ void MenuStateConnectedGame::loadGameSettings(GameSettings *gameSettings) { gameSettings->setFlagTypes1(valueFlags1); } - gameSettings->setEnableObserverModeAtEndGame(listBoxEnableObserverMode.getSelectedItemIndex() == 0); + //gameSettings->setEnableObserverModeAtEndGame(listBoxEnableObserverMode.getSelectedItemIndex() == 0); + gameSettings->setEnableObserverModeAtEndGame(true); gameSettings->setPathFinderType(static_cast(listBoxPathFinderType.getSelectedItemIndex())); valueFlags1 = gameSettings->getFlagTypes1(); @@ -1965,13 +1966,13 @@ void MenuStateConnectedGame::render() { renderer.renderListBox(&listBoxTileset); renderer.renderListBox(&listBoxTechTree); - renderer.renderLabel(&labelEnableObserverMode); + //renderer.renderLabel(&labelEnableObserverMode); renderer.renderLabel(&labelPathFinderType); renderer.renderLabel(&labelEnableSwitchTeamMode); renderer.renderLabel(&labelAISwitchTeamAcceptPercent); - renderer.renderListBox(&listBoxEnableObserverMode); + //renderer.renderListBox(&listBoxEnableObserverMode); renderer.renderListBox(&listBoxPathFinderType); renderer.renderListBox(&listBoxEnableSwitchTeamMode); @@ -2067,7 +2068,7 @@ void MenuStateConnectedGame::update() { listBoxEnableSwitchTeamMode.setEditable(isMasterserverAdmin()); listBoxAISwitchTeamAcceptPercent.setEditable(isMasterserverAdmin()); listBoxFogOfWar.setEditable(isMasterserverAdmin()); - listBoxEnableObserverMode.setEditable(isMasterserverAdmin()); + //listBoxEnableObserverMode.setEditable(isMasterserverAdmin()); listBoxAllowObservers.setEditable(isMasterserverAdmin()); if(isMasterserverAdmin() == true) { @@ -2793,12 +2794,12 @@ void MenuStateConnectedGame::update() { } listBoxAISwitchTeamAcceptPercent.setSelectedItem(intToStr(gameSettings->getAiAcceptSwitchTeamPercentChance())); - if(gameSettings->getEnableObserverModeAtEndGame()) { - listBoxEnableObserverMode.setSelectedItemIndex(0); - } - else { - listBoxEnableObserverMode.setSelectedItemIndex(1); - } +// if(gameSettings->getEnableObserverModeAtEndGame()) { +// listBoxEnableObserverMode.setSelectedItemIndex(0); +// } +// else { +// listBoxEnableObserverMode.setSelectedItemIndex(1); +// } if(gameSettings->getPathFinderType() == pfBasic) { listBoxPathFinderType.setSelectedItemIndex(0); } diff --git a/source/glest_game/menu/menu_state_connected_game.h b/source/glest_game/menu/menu_state_connected_game.h index 56d4569ad..18461a8b6 100644 --- a/source/glest_game/menu/menu_state_connected_game.h +++ b/source/glest_game/menu/menu_state_connected_game.h @@ -54,8 +54,8 @@ private: GraphicLabel labelInfo; - GraphicLabel labelEnableObserverMode; - GraphicListBox listBoxEnableObserverMode; + //GraphicLabel labelEnableObserverMode; + //GraphicListBox listBoxEnableObserverMode; //GraphicLabel labelEnableServerControlledAI; //GraphicListBox listBoxEnableServerControlledAI; //GraphicLabel labelNetworkPauseGameForLaggedClients; diff --git a/source/glest_game/menu/menu_state_custom_game.cpp b/source/glest_game/menu/menu_state_custom_game.cpp index 76e6209b7..f6501414e 100644 --- a/source/glest_game/menu/menu_state_custom_game.cpp +++ b/source/glest_game/menu/menu_state_custom_game.cpp @@ -308,14 +308,14 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, listBoxAllowObservers.setSelectedItemIndex(0); // View Map At End Of Game - labelEnableObserverMode.registerGraphicComponent(containerName,"labelEnableObserverMode"); - labelEnableObserverMode.init(xoffset+460, aHeadPos, 80); + //labelEnableObserverMode.registerGraphicComponent(containerName,"labelEnableObserverMode"); + //labelEnableObserverMode.init(xoffset+460, aHeadPos, 80); - listBoxEnableObserverMode.registerGraphicComponent(containerName,"listBoxEnableObserverMode"); - listBoxEnableObserverMode.init(xoffset+460, aPos, 80); - listBoxEnableObserverMode.pushBackItem(lang.get("Yes")); - listBoxEnableObserverMode.pushBackItem(lang.get("No")); - listBoxEnableObserverMode.setSelectedItemIndex(0); + //listBoxEnableObserverMode.registerGraphicComponent(containerName,"listBoxEnableObserverMode"); + //listBoxEnableObserverMode.init(xoffset+460, aPos, 80); + //listBoxEnableObserverMode.pushBackItem(lang.get("Yes")); + //listBoxEnableObserverMode.pushBackItem(lang.get("No")); + //listBoxEnableObserverMode.setSelectedItemIndex(0); // Allow Switch Team Mode labelEnableSwitchTeamMode.registerGraphicComponent(containerName,"labelEnableSwitchTeamMode"); @@ -563,7 +563,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, } - labelEnableObserverMode.setText(lang.get("EnableObserverMode")); + //labelEnableObserverMode.setText(lang.get("EnableObserverMode")); loadMapInfo(Map::getMapPath(getCurrentMapFile()), &mapInfo, true); @@ -685,10 +685,10 @@ void MenuStateCustomGame::reloadUI() { listBoxAllowObservers.setItems(listBoxData); // View Map At End Of Game - listBoxData.clear(); - listBoxData.push_back(lang.get("Yes")); - listBoxData.push_back(lang.get("No")); - listBoxEnableObserverMode.setItems(listBoxData); + //listBoxData.clear(); + //listBoxData.push_back(lang.get("Yes")); + //listBoxData.push_back(lang.get("No")); + //listBoxEnableObserverMode.setItems(listBoxData); // Allow Switch Team Mode labelEnableSwitchTeamMode.setText(lang.get("EnableSwitchTeamMode")); @@ -789,7 +789,7 @@ void MenuStateCustomGame::reloadUI() { listBoxControls[i].setItems(controlItems); } - labelEnableObserverMode.setText(lang.get("EnableObserverMode")); + //labelEnableObserverMode.setText(lang.get("EnableObserverMode")); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); @@ -1002,19 +1002,19 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton) { lastSetChangedGameSettings = time(NULL); } } - else if (listBoxAdvanced.getSelectedItemIndex() == 1 && listBoxEnableObserverMode.mouseClick(x, y)) { - MutexSafeWrapper safeMutex((publishToMasterserverThread != NULL ? publishToMasterserverThread->getMutexThreadObjectAccessor() : NULL),string(__FILE__) + "_" + intToStr(__LINE__)); - - if(listBoxPublishServer.getSelectedItemIndex() == 0) { - needToRepublishToMasterserver = true; - } - - if(hasNetworkGameSettings() == true) - { - needToSetChangedGameSettings = true; - lastSetChangedGameSettings = time(NULL); - } - } +// else if (listBoxAdvanced.getSelectedItemIndex() == 1 && listBoxEnableObserverMode.mouseClick(x, y)) { +// MutexSafeWrapper safeMutex((publishToMasterserverThread != NULL ? publishToMasterserverThread->getMutexThreadObjectAccessor() : NULL),string(__FILE__) + "_" + intToStr(__LINE__)); +// +// if(listBoxPublishServer.getSelectedItemIndex() == 0) { +// needToRepublishToMasterserver = true; +// } +// +// if(hasNetworkGameSettings() == true) +// { +// needToSetChangedGameSettings = true; +// lastSetChangedGameSettings = time(NULL); +// } +// } else if (listBoxAdvanced.getSelectedItemIndex() == 1 && listBoxEnableSwitchTeamMode.mouseClick(x, y)) { MutexSafeWrapper safeMutex((publishToMasterserverThread != NULL ? publishToMasterserverThread->getMutexThreadObjectAccessor() : NULL),string(__FILE__) + "_" + intToStr(__LINE__)); @@ -1629,7 +1629,7 @@ void MenuStateCustomGame::mouseMove(int x, int y, const MouseState *ms) { if(listBoxAdvanced.getSelectedItemIndex() == 1) { listBoxFogOfWar.mouseMove(x, y); listBoxAllowObservers.mouseMove(x, y); - listBoxEnableObserverMode.mouseMove(x, y); + //listBoxEnableObserverMode.mouseMove(x, y); //listBoxEnableServerControlledAI.mouseMove(x, y); //labelNetworkFramePeriod.mouseMove(x, y); //listBoxNetworkFramePeriod.mouseMove(x, y); @@ -1782,7 +1782,7 @@ void MenuStateCustomGame::render() { if(listBoxAdvanced.getSelectedItemIndex() == 1) { renderer.renderLabel(&labelFogOfWar); renderer.renderLabel(&labelAllowObservers); - renderer.renderLabel(&labelEnableObserverMode); + //renderer.renderLabel(&labelEnableObserverMode); renderer.renderLabel(&labelPathFinderType); renderer.renderLabel(&labelEnableSwitchTeamMode); @@ -1790,7 +1790,7 @@ void MenuStateCustomGame::render() { renderer.renderListBox(&listBoxFogOfWar); renderer.renderListBox(&listBoxAllowObservers); - renderer.renderListBox(&listBoxEnableObserverMode); + //renderer.renderListBox(&listBoxEnableObserverMode); renderer.renderListBox(&listBoxPathFinderType); renderer.renderListBox(&listBoxEnableSwitchTeamMode); @@ -2789,7 +2789,8 @@ void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings,bool force gameSettings->setFlagTypes1(valueFlags1); } - gameSettings->setEnableObserverModeAtEndGame(listBoxEnableObserverMode.getSelectedItemIndex() == 0); + //gameSettings->setEnableObserverModeAtEndGame(listBoxEnableObserverMode.getSelectedItemIndex() == 0); + gameSettings->setEnableObserverModeAtEndGame(true); gameSettings->setPathFinderType(static_cast(listBoxPathFinderType.getSelectedItemIndex())); valueFlags1 = gameSettings->getFlagTypes1(); @@ -3244,7 +3245,7 @@ void MenuStateCustomGame::setupUIFromGameSettings(const GameSettings &gameSettin //printf("In [%s::%s line %d]\n",__FILE__,__FUNCTION__,__LINE__); listBoxAllowObservers.setSelectedItem(gameSettings.getAllowObservers() == true ? lang.get("Yes") : lang.get("No")); - listBoxEnableObserverMode.setSelectedItem(gameSettings.getEnableObserverModeAtEndGame() == true ? lang.get("Yes") : lang.get("No")); + //listBoxEnableObserverMode.setSelectedItem(gameSettings.getEnableObserverModeAtEndGame() == true ? lang.get("Yes") : lang.get("No")); listBoxEnableSwitchTeamMode.setSelectedItem((gameSettings.getFlagTypes1() & ft1_allow_team_switching) == ft1_allow_team_switching ? lang.get("Yes") : lang.get("No")); listBoxAISwitchTeamAcceptPercent.setSelectedItem(intToStr(gameSettings.getAiAcceptSwitchTeamPercentChance())); diff --git a/source/glest_game/menu/menu_state_custom_game.h b/source/glest_game/menu/menu_state_custom_game.h index 7c57a10af..0ea42ca8d 100644 --- a/source/glest_game/menu/menu_state_custom_game.h +++ b/source/glest_game/menu/menu_state_custom_game.h @@ -49,7 +49,7 @@ private: GraphicLabel labelTechTree; GraphicLabel labelTileset; GraphicLabel labelMapInfo; - GraphicLabel labelEnableObserverMode; + //GraphicLabel labelEnableObserverMode; //GraphicLabel labelEnableServerControlledAI; GraphicLabel labelLocalIP; GraphicLabel labelGameName; @@ -59,7 +59,7 @@ private: GraphicListBox listBoxFogOfWar; GraphicListBox listBoxTechTree; GraphicListBox listBoxTileset; - GraphicListBox listBoxEnableObserverMode; + //GraphicListBox listBoxEnableObserverMode; //GraphicListBox listBoxEnableServerControlledAI; vector mapFiles;