1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Fix some issues detected by Sonar & code review, fix build

This commit is contained in:
Ivan Savenko
2025-04-01 19:11:12 +03:00
parent 586620a290
commit 93b18ee94b
34 changed files with 86 additions and 128 deletions

View File

@@ -1308,6 +1308,13 @@ const CGBoat * CGHeroInstance::getBoat() const
return nullptr;
}
CGBoat * CGHeroInstance::getBoat()
{
if (boardedBoat.hasValue())
return dynamic_cast<CGBoat*>(cb->gameState()->getObjInstance(boardedBoat));
return nullptr;
}
void CGHeroInstance::setBoat(CGBoat* newBoat)
{
assert(newBoat);
@@ -1334,9 +1341,10 @@ CBonusSystemNode * CGHeroInstance::whereShouldBeAttachedOnSiege(const bool isBat
if(!getVisitedTown())
return nullptr;
return isBattleOutsideTown ? (CBonusSystemNode *)(& getVisitedTown()->townAndVis)
: (CBonusSystemNode *)(getVisitedTown());
if (isBattleOutsideTown)
return const_cast<CTownAndVisitingHero *>(&getVisitedTown()->townAndVis);
return const_cast<CGTownInstance*>(getVisitedTown());
}
CBonusSystemNode * CGHeroInstance::whereShouldBeAttachedOnSiege(CGameState * gs)