diff --git a/source/glest_game/game/commander.cpp b/source/glest_game/game/commander.cpp index 8a11d133..06906d4e 100644 --- a/source/glest_game/game/commander.cpp +++ b/source/glest_game/game/commander.cpp @@ -835,9 +835,10 @@ void Commander::giveNetworkCommand(NetworkCommand* networkCommand) const { GameSettings *settings = world->getGameSettingsPtr(); if(playerStatus == 1) { settings->setNetworkPlayerGameStatus(factionIndex,1); + if(!world->getGame()->getGameOver()&& !this->world->getGame()->factionLostGame(factionIndex)){ + this->world->getStats()->setPlayerLeftBeforeEnd(factionIndex,true); + } } - this->world->getStats()->setPlayerName(factionIndex,settings->getNetworkPlayerName(factionIndex)); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] found nctPlayerStatusChange\n",__FILE__,__FUNCTION__,__LINE__); } diff --git a/source/glest_game/game/game.cpp b/source/glest_game/game/game.cpp index b3b513c3..70e0f00a 100644 --- a/source/glest_game/game/game.cpp +++ b/source/glest_game/game/game.cpp @@ -3844,6 +3844,10 @@ void Game::checkWinnerScripted() { } } +bool Game::factionLostGame(int factionIndex) { + return factionLostGame(world.getFaction(factionIndex)); +} + bool Game::factionLostGame(const Faction *faction) { for(int i=0; igetUnitCount(); ++i) { const UnitType *ut = faction->getUnit(i)->getType(); @@ -3857,7 +3861,6 @@ bool Game::factionLostGame(const Faction *faction) { } } return true; - } bool Game::hasBuilding(const Faction *faction) { diff --git a/source/glest_game/game/game.h b/source/glest_game/game/game.h index 9e08e7ed..25dd1534 100644 --- a/source/glest_game/game/game.h +++ b/source/glest_game/game/game.h @@ -284,6 +284,8 @@ public: void addNetworkCommandToReplayList(NetworkCommand* networkCommand,int worldFrameCount); + bool factionLostGame(int factionIndex); + private: //render void render3d(); diff --git a/source/glest_game/game/stats.cpp b/source/glest_game/game/stats.cpp index db90a47d..d8fac52e 100644 --- a/source/glest_game/game/stats.cpp +++ b/source/glest_game/game/stats.cpp @@ -28,6 +28,7 @@ PlayerStats::PlayerStats() { unitsProduced = 0; resourcesHarvested = 0; playerName = ""; + playerLeftBeforeEnd = false; playerColor = Vec3f(0,0,0); } @@ -85,6 +86,9 @@ string PlayerStats::getStats() const { } result += playerName + " (" + controlString + ") "; + if(control == ctNetwork && playerLeftBeforeEnd==true ) { + result += "player left before end "; + } result += "faction: " + factionTypeName + " "; result += "Team: " + intToStr(teamIndex) + " "; result += "victory: " + boolToStr(victory) + " "; diff --git a/source/glest_game/game/stats.h b/source/glest_game/game/stats.h index a712bc54..b444e3f0 100644 --- a/source/glest_game/game/stats.h +++ b/source/glest_game/game/stats.h @@ -45,6 +45,7 @@ public: int unitsProduced; int resourcesHarvested; string playerName; + bool playerLeftBeforeEnd; Vec3f playerColor; string getStats() const; @@ -111,6 +112,7 @@ public: int getUnitsProduced(int factionIndex) const {return playerStats[factionIndex].unitsProduced;} int getResourcesHarvested(int factionIndex) const {return playerStats[factionIndex].resourcesHarvested;} string getPlayerName(int factionIndex) const {return playerStats[factionIndex].playerName;} + bool getPlayerLeftBeforeEnd(int factionIndex) const {return playerStats[factionIndex].playerLeftBeforeEnd;} Vec3f getPlayerColor(int factionIndex) const { return playerStats[factionIndex].playerColor;} bool getIsMasterserverMode() const { return isMasterserverMode; } @@ -133,6 +135,7 @@ public: void produce(int producerFactionIndex, bool isProductionCounted); void harvest(int harvesterFactionIndex, int amount); void setPlayerName(int playerIndex, string value) {playerStats[playerIndex].playerName = value; } + void setPlayerLeftBeforeEnd(int playerIndex, bool value) {playerStats[playerIndex].playerLeftBeforeEnd = value; } void setPlayerColor(int playerIndex, Vec3f value) {playerStats[playerIndex].playerColor = value; } void addFramesToCalculatePlaytime() {this->framesToCalculatePlaytime++; } diff --git a/source/glest_game/main/battle_end.cpp b/source/glest_game/main/battle_end.cpp index 38ebb9ce..c2ea36ed 100644 --- a/source/glest_game/main/battle_end.cpp +++ b/source/glest_game/main/battle_end.cpp @@ -299,6 +299,9 @@ void BattleEnd::render() { if(stats.getControl(i) != ctHuman && stats.getControl(i) != ctNetwork ) { controlString += "\nx " + floatToStr(stats.getResourceMultiplier(i),1); } + else if(stats.getPlayerLeftBeforeEnd(i)==true){ + controlString += "\n( " +lang.get("Cpu")+" )"; + } if(score == bestScore && stats.getVictory(i)) { if(CoreData::getInstance().getGameWinnerTexture() != NULL) {