Bladeren bron

Fixed some crashes with std loss condition.

Michał W. Urbańczyk 15 jaren geleden
bovenliggende
commit
8552fd2fb0
2 gewijzigde bestanden met toevoegingen van 3 en 3 verwijderingen
  1. 2 2
      lib/CGameState.cpp
  2. 1 1
      server/CGameHandler.cpp

+ 2 - 2
lib/CGameState.cpp

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

+ 1 - 1
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!
 		}
 	}
 }