Bläddra i källkod

Fixed crash on ending battle with a draw

Ivan Savenko 2 år sedan
förälder
incheckning
5aa2492a90
1 ändrade filer med 25 tillägg och 19 borttagningar
  1. 25 19
      lib/NetPacksLib.cpp

+ 25 - 19
lib/NetPacksLib.cpp

@@ -2205,25 +2205,31 @@ void BattleResultAccepted::applyGs(CGameState * gs) const
 	for(auto & res : heroResult)
 	{
 		if(res.hero)
-			res.hero->removeBonusesRecursive(Bonus::OneBattle);
-	}
-
-	// Grow up growing artifacts
-	if(const auto hero = heroResult[winnerSide].hero)
-	{
-		if(hero->commander && hero->commander->alive)
-		{
-			for(auto & art : hero->commander->artifactsWorn)
-				art.second.artifact->growingUp();
-		}
-		for(auto & art : hero->artifactsWorn)
-		{
-			art.second.artifact->growingUp();
-		}
-	}
-	if(VLC->settings()->getBoolean(EGameSettings::MODULE_STACK_EXPERIENCE))
-	{
-		if(heroResult[0].army)
+			res.hero->removeBonusesRecursive(Bonus::OneBattle);
+	}
+
+	if(winnerSide != 2)
+	{
+		// Grow up growing artifacts
+		const auto hero = heroResult[winnerSide].hero;
+
+		if (hero)
+		{
+			if(hero->commander && hero->commander->alive)
+			{
+				for(auto & art : hero->commander->artifactsWorn)
+					art.second.artifact->growingUp();
+			}
+			for(auto & art : hero->artifactsWorn)
+			{
+				art.second.artifact->growingUp();
+			}
+		}
+	}
+
+	if(VLC->settings()->getBoolean(EGameSettings::MODULE_STACK_EXPERIENCE))
+	{
+		if(heroResult[0].army)
 			heroResult[0].army->giveStackExp(heroResult[0].exp);
 		if(heroResult[1].army)
 			heroResult[1].army->giveStackExp(heroResult[1].exp);