fallback multiplier for CPUs playing for disconnected player. Should work now, needs testing .

This commit is contained in:
Titus Tscharntke 2012-09-18 23:36:51 +00:00
parent 3368ee3c96
commit f2585ebaae
4 changed files with 8 additions and 3 deletions

View File

@ -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());
}
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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)) {