From f2585ebaae4b13c68d483be586b48b5534f35336 Mon Sep 17 00:00:00 2001 From: Titus Tscharntke Date: Tue, 18 Sep 2012 23:36:51 +0000 Subject: [PATCH] fallback multiplier for CPUs playing for disconnected player. Should work now, needs testing . --- source/glest_game/game/commander.cpp | 4 ++++ source/glest_game/game/game.cpp | 2 +- source/glest_game/game/stats.cpp | 3 ++- source/glest_game/main/battle_end.cpp | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/source/glest_game/game/commander.cpp b/source/glest_game/game/commander.cpp index 97df9eb6..e337c59d 100644 --- a/source/glest_game/game/commander.cpp +++ b/source/glest_game/game/commander.cpp @@ -838,7 +838,11 @@ void Commander::giveNetworkCommand(NetworkCommand* networkCommand) const { if(playerStatus == 1) { settings->setNetworkPlayerGameStatus(factionIndex,1); if(!world->getGame()->getGameOver()&& !this->world->getGame()->factionLostGame(factionIndex)){ + // use the fallback multiplier here + settings->setResourceMultiplierIndex(factionIndex,settings->getFallbackCpuMultiplier()); + // mark player as "leaver" this->world->getStats()->setPlayerLeftBeforeEnd(factionIndex,true); + // set disconnect time for endgame stats this->world->getStats()->setTimePlayerLeft(factionIndex,this->world->getStats()->getFramesToCalculatePlaytime()); } } diff --git a/source/glest_game/game/game.cpp b/source/glest_game/game/game.cpp index 08130e2a..c7bdb4ea 100644 --- a/source/glest_game/game/game.cpp +++ b/source/glest_game/game/game.cpp @@ -1825,7 +1825,7 @@ void Game::ReplaceDisconnectedNetworkPlayersWithAI(bool isNetworkGame, NetworkRo char szBuf[4096]=""; if(faction->getPersonalityType() != fpt_Observer) { - faction->setControlType(ctCpu); + faction->setControlType(ctCpuUltra); aiInterfaces[i] = new AiInterface(*this, i, faction->getTeam(), faction->getStartLocationIndex()); sprintf(szBuf,Lang::getInstance().get("LogScreenGameLoadingCreatingAIFaction","",true).c_str(),i); diff --git a/source/glest_game/game/stats.cpp b/source/glest_game/game/stats.cpp index 8dd55950..c9e7ae3f 100644 --- a/source/glest_game/game/stats.cpp +++ b/source/glest_game/game/stats.cpp @@ -82,7 +82,8 @@ string PlayerStats::getStats() const { }; } - if(control != ctHuman && control != ctNetwork ) { + if(control != ctHuman && control != ctNetwork || + control == ctNetwork && playerLeftBeforeEnd==true) { controlString += " x " + floatToStr(resourceMultiplier,1); } diff --git a/source/glest_game/main/battle_end.cpp b/source/glest_game/main/battle_end.cpp index 224793fe..04e62e8d 100644 --- a/source/glest_game/main/battle_end.cpp +++ b/source/glest_game/main/battle_end.cpp @@ -321,7 +321,7 @@ void BattleEnd::render() { controlString += "\nx " + floatToStr(stats.getResourceMultiplier(i),1); } else if(stats.getPlayerLeftBeforeEnd(i)==true){ - controlString += "\n( " +lang.get("Cpu")+" )"; + controlString += "\n" +lang.get("CpuUltra")+"\nx "+floatToStr(stats.getResourceMultiplier(i),1); } if(score == bestScore && stats.getVictory(i)) {