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:
@@ -3063,7 +3063,7 @@ ui8 CGameState::checkForStandardWin() const
|
|||||||
ui8 supposedWinner = 255, winnerTeam = 255;
|
ui8 supposedWinner = 255, winnerTeam = 255;
|
||||||
for(std::map<ui8,PlayerState>::const_iterator i = players.begin(); i != players.end(); i++)
|
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)
|
if(supposedWinner == 255)
|
||||||
{
|
{
|
||||||
@@ -3086,7 +3086,7 @@ bool CGameState::checkForStandardLoss( ui8 player ) const
|
|||||||
{
|
{
|
||||||
//std loss condition is: player lost all towns and heroes
|
//std loss condition is: player lost all towns and heroes
|
||||||
const PlayerState &p = *getPlayer(player);
|
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
|
int CGameState::lossCheck( ui8 player ) const
|
||||||
|
@@ -3620,7 +3620,7 @@ void CGameHandler::getLossVicMessage( ui8 player, bool standard, bool victory, I
|
|||||||
}
|
}
|
||||||
else //lost all towns and heroes
|
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!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user