diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index 1d950c7d..aad14432 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -75,40 +75,101 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM //create - buttonDisconnect.init(350, 180, 125); - buttonPlayNow.init(525, 180, 125); + buttonDisconnect.init(350, 150, 125); + buttonPlayNow.init(525, 150, 125); //map listBox // put them all in a set, to weed out duplicates (gbm & mgm with same name) // will also ensure they are alphabetically listed (rather than how the OS provides them) listBoxMap.init(100, 260, 200); listBoxMap.setEditable(false); + + + int setupPos=610; + int mapHeadPos=290; + int mapPos=mapHeadPos-30; + int aHeadPos=230; + int aPos=aHeadPos-30; + int networkHeadPos=670; + int networkPos=networkHeadPos-30; //listBoxMap.setItems(results); - labelMap.init(100, 290); - labelMapInfo.init(100, 230, 200, 40); - + labelMap.init(100, mapHeadPos); + listBoxMap.init(100, mapPos, 200); // fog - o - war // @350 ? 300 ? - labelFogOfWar.init(350, 290, 100); - listBoxFogOfWar.init(350, 260, 100); + labelFogOfWar.init(300, aHeadPos, 80); + listBoxFogOfWar.init(300, aPos, 80); listBoxFogOfWar.pushBackItem(lang.get("Yes")); listBoxFogOfWar.pushBackItem(lang.get("No")); listBoxFogOfWar.setSelectedItemIndex(0); listBoxFogOfWar.setEditable(false); + // Enable Observer Mode + labelEnableObserverMode.init(400, aHeadPos, 80); + listBoxEnableObserverMode.init(400, aPos, 110); + listBoxEnableObserverMode.pushBackItem(lang.get("Yes")); + listBoxEnableObserverMode.pushBackItem(lang.get("No")); + listBoxEnableObserverMode.setSelectedItemIndex(0); + listBoxEnableObserverMode.setEditable(false); + labelEnableObserverMode.setText(lang.get("EnableObserverMode")); + + labelPathFinderType.init(540, aHeadPos, 80); + labelPathFinderType.setText(lang.get("PathFinderType")); + listBoxPathFinderType.init(540, aPos, 140); + listBoxPathFinderType.pushBackItem(lang.get("PathFinderTypeRegular")); + listBoxPathFinderType.pushBackItem(lang.get("PathFinderTypeRoutePlanner")); + listBoxPathFinderType.setSelectedItemIndex(0); + listBoxPathFinderType.setEditable(false); + + // Network Frame Period + labelNetworkFramePeriod.init(370, networkHeadPos, 80); + labelNetworkFramePeriod.setText(lang.get("NetworkFramePeriod")); + listBoxNetworkFramePeriod.init(380, networkPos, 80); + listBoxNetworkFramePeriod.pushBackItem("10"); + listBoxNetworkFramePeriod.pushBackItem("20"); + listBoxNetworkFramePeriod.pushBackItem("30"); + listBoxNetworkFramePeriod.pushBackItem("40"); + listBoxNetworkFramePeriod.setSelectedItem("20"); + listBoxNetworkFramePeriod.setEditable(false); + + // Network Frame Period + labelNetworkPauseGameForLaggedClients.init(530, networkHeadPos, 80); + labelNetworkPauseGameForLaggedClients.setText(lang.get("NetworkPauseGameForLaggedClients")); + listBoxNetworkPauseGameForLaggedClients.init(540, networkPos, 80); + listBoxNetworkPauseGameForLaggedClients.pushBackItem(lang.get("No")); + listBoxNetworkPauseGameForLaggedClients.pushBackItem(lang.get("Yes")); + listBoxNetworkPauseGameForLaggedClients.setSelectedItem(lang.get("No")); + listBoxNetworkPauseGameForLaggedClients.setEditable(false); + + + // Enable Server Controlled AI + labelEnableServerControlledAI.init(670, networkHeadPos, 80); + labelEnableServerControlledAI.setText(lang.get("EnableServerControlledAI")); + listBoxEnableServerControlledAI.init(680, networkPos, 80); + listBoxEnableServerControlledAI.pushBackItem(lang.get("Yes")); + listBoxEnableServerControlledAI.pushBackItem(lang.get("No")); + listBoxEnableServerControlledAI.setSelectedItemIndex(0); + listBoxEnableServerControlledAI.setEditable(false); + + //tileset listBox - listBoxTileset.init(500, 260, 150); + //listBoxTileset.init(500, 260, 150); + listBoxTileset.init(400, mapPos, 150); listBoxTileset.setEditable(false); //listBoxTileset.setItems(results); - labelTileset.init(500, 290); + //labelTileset.init(500, 290); + labelTileset.init(400, mapHeadPos); //tech Tree listBox - listBoxTechTree.init(700, 260, 150); + //listBoxTechTree.init(700, 260, 150); listBoxTechTree.setEditable(false); //listBoxTechTree.setItems(results); - labelTechTree.init(700, 290); + //labelTechTree.init(700, 290); + listBoxTechTree.init(600, mapPos, 150); + labelTechTree.init(600, mapHeadPos); + SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); //list boxes for(int i=0; irenderProgramMsgBox(); renderer.renderChatManager(&chatManager); @@ -422,13 +498,15 @@ void MenuStateConnectedGame::update() label += " - data synch is ok"; } - std::string networkFrameString = lang.get("NetworkFramePeriod") + " " + intToStr(clientInterface->getGameSettings()->getNetworkFramePeriod()); + //std::string networkFrameString = lang.get("NetworkFramePeriod") + " " + intToStr(clientInterface->getGameSettings()->getNetworkFramePeriod()); //float pingTime = clientInterface->getThreadedPingMS(clientInterface->getServerIpAddress().c_str()); - char szBuf[1024]=""; + //char szBuf[1024]=""; //sprintf(szBuf,"%s, ping = %.2fms, %s",label.c_str(),pingTime,networkFrameString.c_str()); - sprintf(szBuf,"%s, %s",label.c_str(),networkFrameString.c_str()); + //sprintf(szBuf,"%s, %s",label.c_str(),networkFrameString.c_str()); - labelStatus.setText(szBuf); + + //labelStatus.setText(szBuf); + labelStatus.setText(label); } else { @@ -465,13 +543,14 @@ void MenuStateConnectedGame::update() label += " - data synch is ok"; } - std::string networkFrameString = lang.get("NetworkFramePeriod") + " " + intToStr(clientInterface->getGameSettings()->getNetworkFramePeriod()); + //std::string networkFrameString = lang.get("NetworkFramePeriod") + " " + intToStr(clientInterface->getGameSettings()->getNetworkFramePeriod()); //float pingTime = clientInterface->getThreadedPingMS(clientInterface->getServerIpAddress().c_str()); - char szBuf[1024]=""; + //char szBuf[1024]=""; //sprintf(szBuf,"%s, ping = %.2fms, %s",label.c_str(),pingTime,networkFrameString.c_str()); - sprintf(szBuf,"%s, %s",label.c_str(),networkFrameString.c_str()); + //sprintf(szBuf,"%s, %s",label.c_str(),networkFrameString.c_str()); - labelStatus.setText(szBuf); + //labelStatus.setText(szBuf); + labelStatus.setText(label); } } else { @@ -533,6 +612,33 @@ void MenuStateConnectedGame::update() listBoxFogOfWar.setSelectedItemIndex(1); } + if(gameSettings->getEnableObserverModeAtEndGame()) { + listBoxEnableObserverMode.setSelectedItemIndex(0); + } + else { + listBoxEnableObserverMode.setSelectedItemIndex(1); + } + if(gameSettings->getEnableServerControlledAI()) { + listBoxEnableServerControlledAI.setSelectedItemIndex(0); + } + else { + listBoxEnableServerControlledAI.setSelectedItemIndex(1); + } + if(gameSettings->getNetworkPauseGameForLaggedClients()) { + listBoxNetworkPauseGameForLaggedClients.setSelectedItemIndex(1); + } + else { + listBoxNetworkPauseGameForLaggedClients.setSelectedItemIndex(0); + } + if(gameSettings->getPathFinderType() == pfBasic) { + listBoxPathFinderType.setSelectedItemIndex(0); + } + else { + listBoxPathFinderType.setSelectedItemIndex(1); + } + + listBoxNetworkFramePeriod.setSelectedItem(intToStr(gameSettings->getNetworkFramePeriod()),false); + //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); // Control diff --git a/source/glest_game/menu/menu_state_connected_game.h b/source/glest_game/menu/menu_state_connected_game.h index 11af675b..1f8291ee 100644 --- a/source/glest_game/menu/menu_state_connected_game.h +++ b/source/glest_game/menu/menu_state_connected_game.h @@ -44,6 +44,19 @@ private: GraphicLabel labelStatus; GraphicLabel labelInfo; + + GraphicLabel labelEnableObserverMode; + GraphicListBox listBoxEnableObserverMode; + GraphicLabel labelEnableServerControlledAI; + GraphicListBox listBoxEnableServerControlledAI; + GraphicLabel labelNetworkPauseGameForLaggedClients; + GraphicListBox listBoxNetworkPauseGameForLaggedClients; + GraphicLabel labelPathFinderType; + GraphicListBox listBoxPathFinderType; + GraphicListBox listBoxNetworkFramePeriod; + GraphicLabel labelNetworkFramePeriod; + + GraphicListBox listBoxMap; GraphicListBox listBoxFogOfWar; GraphicListBox listBoxTechTree; diff --git a/source/glest_game/menu/menu_state_custom_game.cpp b/source/glest_game/menu/menu_state_custom_game.cpp index d036c9c0..b5ca3600 100644 --- a/source/glest_game/menu/menu_state_custom_game.cpp +++ b/source/glest_game/menu/menu_state_custom_game.cpp @@ -613,10 +613,24 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton){ } else if(listBoxNetworkFramePeriod.mouseClick(x, y)){ MutexSafeWrapper safeMutex(&masterServerThreadAccessor); + needToRepublishToMasterserver = true; + if(hasNetworkGameSettings() == true) + { + needToSetChangedGameSettings = true; + lastSetChangedGameSettings = time(NULL); + } + soundRenderer.playFx(coreData.getClickSoundC()); } else if(listBoxNetworkPauseGameForLaggedClients.mouseClick(x, y)){ MutexSafeWrapper safeMutex(&masterServerThreadAccessor); + needToRepublishToMasterserver = true; + if(hasNetworkGameSettings() == true) + { + needToSetChangedGameSettings = true; + lastSetChangedGameSettings = time(NULL); + } + soundRenderer.playFx(coreData.getClickSoundC()); } else { diff --git a/source/glest_game/network/network_message.cpp b/source/glest_game/network/network_message.cpp index ac0ec4fa..ed2118a4 100644 --- a/source/glest_game/network/network_message.cpp +++ b/source/glest_game/network/network_message.cpp @@ -213,6 +213,8 @@ NetworkMessageLaunch::NetworkMessageLaunch(const GameSettings *gameSettings,int8 data.enableObserverModeAtEndGame = gameSettings->getEnableObserverModeAtEndGame(); data.enableServerControlledAI = gameSettings->getEnableServerControlledAI(); data.networkFramePeriod = gameSettings->getNetworkFramePeriod(); + data.networkPauseGameForLaggedClients = gameSettings->getNetworkPauseGameForLaggedClients(); + data.pathFinderType = gameSettings->getPathFinderType(); for(int i= 0; igetFactionTypeName(i); @@ -239,6 +241,8 @@ void NetworkMessageLaunch::buildGameSettings(GameSettings *gameSettings) const{ gameSettings->setEnableObserverModeAtEndGame(data.enableObserverModeAtEndGame); gameSettings->setEnableServerControlledAI(data.enableServerControlledAI); gameSettings->setNetworkFramePeriod(data.networkFramePeriod); + gameSettings->setNetworkPauseGameForLaggedClients(data.networkPauseGameForLaggedClients); + gameSettings->setPathFinderType(static_cast(data.pathFinderType)); for(int i= 0; isetFactionTypeName(i, data.factionTypeNames[i].getString()); diff --git a/source/glest_game/network/network_message.h b/source/glest_game/network/network_message.h index c08e95ef..b58ea522 100644 --- a/source/glest_game/network/network_message.h +++ b/source/glest_game/network/network_message.h @@ -196,6 +196,9 @@ private: int8 enableObserverModeAtEndGame; int8 enableServerControlledAI; uint8 networkFramePeriod; // allowed values 0 - 255 + int8 networkPauseGameForLaggedClients; + int8 pathFinderType; + }; private: