1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-17 00:07:41 +02:00

Fix random map generation

This commit is contained in:
Ivan Savenko
2025-04-10 16:02:51 +03:00
parent 912c2eae94
commit f5f8ed192b
4 changed files with 56 additions and 22 deletions

View File

@ -1433,16 +1433,11 @@ void HeroRecruited::applyGs(CGameState *gs)
h->pos = tile;
h->updateAppearance();
assert(h->id == ObjectInstanceID());
if(h->id == ObjectInstanceID())
{
gs->getMap().addNewObject(h);
}
else
gs->getMap().replaceObject(h->id, h);
assert(h->id.hasValue());
gs->getMap().addNewObject(h);
p->addOwnedObject(h.get());
h->attachTo(*p);
h->attachToBonusSystem(gs);
if(t)
t->setVisitingHero(h.get());