From 1c4480cb02178a5a4dabcf42de8709ed0cde84c6 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Sat, 5 Nov 2011 01:27:34 +0000 Subject: [PATCH] added a check for missing map when admin is connected to headless server and server has a map that the client doesn't --- .../menu/menu_state_connected_game.cpp | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index caed141a..783c3dfd 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -1488,8 +1488,29 @@ void MenuStateConnectedGame::loadGameSettings(GameSettings *gameSettings) { // //gameSettings->setMapFilterIndex(listBoxMapFilter.getSelectedItemIndex()); - gameSettings->setDescription(formatString(getCurrentMapFile())); - gameSettings->setMap(getCurrentMapFile()); + + if(listBoxMap.getSelectedItemIndex() >= 0 && listBoxMap.getSelectedItemIndex() < mapFiles.size()) { + gameSettings->setDescription(formatString(getCurrentMapFile())); + gameSettings->setMap(getCurrentMapFile()); + } + else { + Lang &lang= Lang::getInstance(); + NetworkManager &networkManager= NetworkManager::getInstance(); + ClientInterface *clientInterface = networkManager.getClientInterface(); + const vector languageList = clientInterface->getGameSettings()->getUniqueNetworkPlayerLanguages(); + for(unsigned int i = 0; i < languageList.size(); ++i) { + char szMsg[1024]=""; + if(lang.hasString("DataMissingMap=Player",languageList[i]) == true) { + sprintf(szMsg,lang.get("DataMissingMap=Player",languageList[i]).c_str(),getHumanPlayerName().c_str(),listBoxMap.getSelectedItem().c_str()); + } + else { + sprintf(szMsg,"Player: %s is missing the map: %s",getHumanPlayerName().c_str(),listBoxMap.getSelectedItem().c_str()); + } + bool localEcho = lang.isLanguageLocal(languageList[i]); + clientInterface->sendTextMessage(szMsg,-1, localEcho,languageList[i]); + } + } + if(listBoxTileset.getSelectedItemIndex() >= 0 && listBoxTileset.getSelectedItemIndex() < tilesetFiles.size()) { gameSettings->setTileset(tilesetFiles[listBoxTileset.getSelectedItemIndex()]); }