mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +02:00
Fix crashes on game start, gamestate now derives from GameCallbackHolder
This commit is contained in:
@@ -1324,9 +1324,9 @@ void CGHeroInstance::deserializationFix()
|
||||
|
||||
void CGHeroInstance::boatDeserializationFix()
|
||||
{
|
||||
auto boat = cb->gameState()->getObjInstance(boardedBoat);
|
||||
if (boat)
|
||||
attachTo(dynamic_cast<CGBoat&>(*boat));
|
||||
// auto boat = cb->gameState()->getObjInstance(boardedBoat);
|
||||
// if (boat)
|
||||
// attachTo(dynamic_cast<CGBoat&>(*boat));
|
||||
}
|
||||
|
||||
CBonusSystemNode * CGHeroInstance::whereShouldBeAttachedOnSiege(const bool isBattleOutsideTown) const
|
||||
@@ -1349,14 +1349,14 @@ CBonusSystemNode * CGHeroInstance::whereShouldBeAttachedOnSiege(CGameState * gs)
|
||||
|
||||
CBonusSystemNode & CGHeroInstance::whereShouldBeAttached(CGameState * gs)
|
||||
{
|
||||
if(getVisitedTown())
|
||||
{
|
||||
if(isGarrisoned())
|
||||
return *getVisitedTown();
|
||||
else
|
||||
return getVisitedTown()->townAndVis;
|
||||
}
|
||||
else
|
||||
// if(getVisitedTown())
|
||||
// {
|
||||
// if(isGarrisoned())
|
||||
// return *getVisitedTown();
|
||||
// else
|
||||
// return getVisitedTown()->townAndVis;
|
||||
// }
|
||||
// else
|
||||
return CArmedInstance::whereShouldBeAttached(gs);
|
||||
}
|
||||
|
||||
|
||||
@@ -708,13 +708,6 @@ std::string CGTownInstance::nodeName() const
|
||||
void CGTownInstance::deserializationFix()
|
||||
{
|
||||
attachTo(townAndVis);
|
||||
|
||||
//Hero is already handled by CGameState::attachArmedObjects
|
||||
|
||||
// if(getVisitingHero())
|
||||
// getVisitingHero()->attachTo(&townAndVis);
|
||||
// if(getGarrisonHero())
|
||||
// getGarrisonHero()->attachTo(this);
|
||||
}
|
||||
|
||||
void CGTownInstance::updateMoraleBonusFromArmy()
|
||||
|
||||
Reference in New Issue
Block a user