From 8552fd2fb04aa44a33ab2b1c82ec8b0d72686f76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20W=2E=20Urba=C5=84czyk?= Date: Sat, 30 Jan 2010 15:00:05 +0000 Subject: [PATCH] Fixed some crashes with std loss condition. --- lib/CGameState.cpp | 4 ++-- server/CGameHandler.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/CGameState.cpp b/lib/CGameState.cpp index d79a50e9e..b8b03a395 100644 --- a/lib/CGameState.cpp +++ b/lib/CGameState.cpp @@ -3063,7 +3063,7 @@ ui8 CGameState::checkForStandardWin() const ui8 supposedWinner = 255, winnerTeam = 255; for(std::map::const_iterator i = players.begin(); i != players.end(); i++) { - if(i->second.status == PlayerState::INGAME) + if(i->second.status == PlayerState::INGAME && i->first < PLAYER_LIMIT) { if(supposedWinner == 255) { @@ -3086,7 +3086,7 @@ bool CGameState::checkForStandardLoss( ui8 player ) const { //std loss condition is: player lost all towns and heroes const PlayerState &p = *getPlayer(player); - return p.heroes.size() || p.towns.size(); + return !p.heroes.size() && !p.towns.size(); } int CGameState::lossCheck( ui8 player ) const diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index 03212f2d2..42efde3c2 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -3620,7 +3620,7 @@ void CGameHandler::getLossVicMessage( ui8 player, bool standard, bool victory, I } else //lost all towns and heroes { - out.text.addReplacement(MetaString::GENERAL_TXT, 660); //All your forces have been defeated, and you are banished from this land! + out.text.addTxt(MetaString::GENERAL_TXT, 660); //All your forces have been defeated, and you are banished from this land! } } } \ No newline at end of file