瀏覽代碼

Hackfix crash on "victory by town capture"

Dydzio 6 年之前
父節點
當前提交
a79f11bed2
共有 1 個文件被更改,包括 5 次插入0 次删除
  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);
 		}