Parcourir la source

Merge pull request #579 from vcmi/dydzio0614-patch-1

Hackfix crash on "victory by town capture"
Alexander Shishkin il y a 6 ans
Parent
commit
49404bfa24
1 fichiers modifiés avec 5 ajouts et 0 suppressions
  1. 5 0
      lib/mapObjects/CGTownInstance.cpp

+ 5 - 0
lib/mapObjects/CGTownInstance.cpp

@@ -679,6 +679,11 @@ void CGTownInstance::onHeroVisit(const CGHeroInstance * h) const
 		else
 		{
 			cb->setOwner(this, h->tempOwner);
+			if(cb->gameState()->getPlayerStatus(h->getOwner()) == EPlayerStatus::WINNER)
+			{
+				return; //we just won game, we do not need to perform any extra actions
+				//TODO: check how does H3 behave, visiting town on victory can affect campaigns (spells learned, +1 stat building visited)
+			}
 			removeCapitols(h->getOwner());
 			cb->heroVisitCastle(this, h);
 		}