1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Fixed some crashes with std loss condition.

This commit is contained in:
Michał W. Urbańczyk
2010-01-30 15:00:05 +00:00
parent 6803d08c6c
commit 8552fd2fb0
2 changed files with 3 additions and 3 deletions

View File

@@ -3063,7 +3063,7 @@ ui8 CGameState::checkForStandardWin() const
ui8 supposedWinner = 255, winnerTeam = 255;
for(std::map<ui8,PlayerState>::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

View File

@@ -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!
}
}
}