From c0104858f057f88b5f9499195af84f46916cb127 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Sat, 22 Sep 2012 02:17:49 +0000 Subject: [PATCH] - bugfix to show correct player info on disconnect --- source/glest_game/game/game.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/source/glest_game/game/game.cpp b/source/glest_game/game/game.cpp index af2047573..71a875005 100644 --- a/source/glest_game/game/game.cpp +++ b/source/glest_game/game/game.cpp @@ -2250,7 +2250,8 @@ void Game::mouseDownLeft(int x, int y) { menuItems.push_back(szBuf); - disconnectPlayerIndexMap[menuItems.size()-1] = faction->getStartLocationIndex(); + //disconnectPlayerIndexMap[menuItems.size()-1] = faction->getStartLocationIndex(); + disconnectPlayerIndexMap[menuItems.size()-1] = faction->getIndex(); } } @@ -2376,8 +2377,9 @@ void Game::mouseDownLeft(int x, int y) { //bool isNetworkGame = this->gameSettings.isNetworkGame(); - int playerIndex = disconnectPlayerIndexMap[result.first]; - switch(playerIndex) { + //int playerIndex = disconnectPlayerIndexMap[result.first]; + int factionIndex = disconnectPlayerIndexMap[result.first]; + switch(factionIndex) { case CANCEL_DISCONNECT_PLAYER: break; default: @@ -2396,17 +2398,17 @@ void Game::mouseDownLeft(int x, int y) { char szBuf[1024]=""; if(lang.hasString("DisconnectNetorkPlayerIndexConfirm") == true) { - sprintf(szBuf,lang.get("DisconnectNetorkPlayerIndexConfirm").c_str(),playerIndex,settings->getNetworkPlayerName(playerIndex).c_str()); + sprintf(szBuf,lang.get("DisconnectNetorkPlayerIndexConfirm").c_str(),factionIndex,settings->getNetworkPlayerName(factionIndex).c_str()); } else { - sprintf(szBuf,"Confirm disconnection for player #%d - %s?",playerIndex,settings->getNetworkPlayerName(playerIndex).c_str()); + sprintf(szBuf,"Confirm disconnection for player #%d - %s?",factionIndex,settings->getNetworkPlayerName(factionIndex).c_str()); } disconnectPlayerConfirmMessageBox.setText(szBuf); disconnectPlayerConfirmMessageBox.init(lang.get("Yes"), lang.get("No")); disconnectPlayerConfirmMessageBox.setEnabled(true); - playerIndexDisconnect = playerIndex; + playerIndexDisconnect = world.getFaction(factionIndex)->getStartLocationIndex(); GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface(); if(gameNetworkInterface != NULL) { @@ -2415,10 +2417,10 @@ void Game::mouseDownLeft(int x, int y) { for(unsigned int i = 0; i < languageList.size(); ++i) { char szMsg[1024]=""; if(lang.hasString("DisconnectNetorkPlayerIndexConfirmed",languageList[i]) == true) { - sprintf(szMsg,lang.get("DisconnectNetorkPlayerIndexConfirmed",languageList[i]).c_str(),playerIndex,settings->getNetworkPlayerName(playerIndex).c_str()); + sprintf(szMsg,lang.get("DisconnectNetorkPlayerIndexConfirmed",languageList[i]).c_str(),factionIndex,settings->getNetworkPlayerName(factionIndex).c_str()); } else { - sprintf(szMsg,"Notice - Admin is warning to disconnect player #%d - %s!",playerIndex+1,settings->getNetworkPlayerName(playerIndex).c_str()); + sprintf(szMsg,"Notice - Admin is warning to disconnect player #%d - %s!",factionIndex,settings->getNetworkPlayerName(factionIndex).c_str()); } bool localEcho = lang.isLanguageLocal(languageList[i]); gameNetworkInterface->sendTextMessage(szMsg,-1, localEcho,languageList[i]);