From a79f11bed205746745c207e13770cc5302681b83 Mon Sep 17 00:00:00 2001 From: Dydzio Date: Tue, 23 Apr 2019 20:04:07 +0200 Subject: [PATCH] Hackfix crash on "victory by town capture" --- lib/mapObjects/CGTownInstance.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/mapObjects/CGTownInstance.cpp b/lib/mapObjects/CGTownInstance.cpp index 8a4eb8045..981d21286 100644 --- a/lib/mapObjects/CGTownInstance.cpp +++ b/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); }