1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Fix build, fix sonar

This commit is contained in:
Ivan Savenko
2025-07-13 17:25:26 +03:00
parent 246010c13e
commit a0a99d7311
12 changed files with 40 additions and 41 deletions

View File

@@ -1061,27 +1061,27 @@ std::vector<CGPathNode *> AINodeStorage::calculateTeleportations(
struct TownPortalFinder
{
const std::vector<CGPathNode *> & initialNodes;
MasteryLevel::Type townPortalSkillLevel;
uint64_t movementNeeded;
const ChainActor * actor;
const CGHeroInstance * hero;
std::vector<const CGTownInstance *> targetTowns;
AINodeStorage * nodeStorage;
SpellID spellID;
const CSpell * townPortal;
uint64_t movementNeeded;
SpellID spellID;
bool townSelectionAllowed;
TownPortalFinder(const ChainActor * actor, const std::vector<CGPathNode *> & initialNodes, std::vector<const CGTownInstance *> targetTowns, AINodeStorage * nodeStorage, SpellID spellID)
: actor(actor)
, initialNodes(initialNodes)
TownPortalFinder(const ChainActor * actor, const std::vector<CGPathNode *> & initialNodes, const std::vector<const CGTownInstance *> & targetTowns, AINodeStorage * nodeStorage, SpellID spellID)
: initialNodes(initialNodes)
, actor(actor)
, hero(actor->hero)
, targetTowns(targetTowns)
, nodeStorage(nodeStorage)
, spellID(spellID)
, townPortal(spellID.toSpell())
, spellID(spellID)
{
auto townPortalEffect = townPortal->getAdventureMechanics().getEffectAs<TownPortalEffect>(hero);
movementNeeded = townPortalEffect->getMovementPointsRequired();
townSelectionAllowed = townPortalEffect->townSelectionAllowed();
}
bool actorCanCastTownPortal()
@@ -1102,7 +1102,7 @@ struct TownPortalFinder
continue;
}
if(townPortalSkillLevel < MasteryLevel::ADVANCED)
if(!townSelectionAllowed)
{
const CGTownInstance * nearestTown = *vstd::minElementByFun(targetTowns, [&](const CGTownInstance * t) -> int
{