player end stats should show only players as laevers who left while game was running. ( feature not finished yet )
This commit is contained in:
parent
91927263f5
commit
d217777f85
|
@ -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__);
|
||||
}
|
||||
|
|
|
@ -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; i<faction->getUnitCount(); ++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) {
|
||||
|
|
|
@ -284,6 +284,8 @@ public:
|
|||
|
||||
void addNetworkCommandToReplayList(NetworkCommand* networkCommand,int worldFrameCount);
|
||||
|
||||
bool factionLostGame(int factionIndex);
|
||||
|
||||
private:
|
||||
//render
|
||||
void render3d();
|
||||
|
|
|
@ -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) + " ";
|
||||
|
|
|
@ -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++; }
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue