1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

UI now shows spell range from config

This commit is contained in:
Ivan Savenko
2025-07-10 17:27:27 +03:00
parent 79f3126c63
commit 5ada2d19e1
16 changed files with 44 additions and 40 deletions

View File

@@ -19,14 +19,16 @@
#include "../GameInstance.h"
#include "../../lib/Point.h"
#include "../../lib/battle/CPlayerBattleCallback.h"
#include "../../lib/battle/IBattleState.h"
#include "../../lib/callback/CCallback.h"
#include "../../lib/mapObjects/CGHeroInstance.h"
#include "../../lib/mapObjects/MiscObjects.h"
#include "../../lib/spells/CSpellHandler.h"
#include "../../lib/mapping/CMap.h"
#include "../../lib/pathfinder/CGPathNode.h"
#include "../../lib/battle/CPlayerBattleCallback.h"
#include "../../lib/battle/IBattleState.h"
#include "../../lib/spells/CSpellHandler.h"
#include "../../lib/spells/ISpellMechanics.h"
#include "../../lib/spells/Problem.h"
MapRendererBaseContext::MapRendererBaseContext(const MapRendererContextState & viewState)
: viewState(viewState)
@@ -367,15 +369,14 @@ bool MapRendererAdventureContext::showTextOverlay() const
bool MapRendererAdventureContext::showSpellRange(const int3 & position) const
{
if (!settingSpellRange)
return false;
auto hero = GAME->interface()->localState->getCurrentHero();
auto spell = GAME->interface()->localState->getCurrentSpell();
if (!hero)
if (!hero || !spell.hasValue())
return false;
return !isInScreenRange(hero->getSightCenter(), position);
spells::detail::ProblemImpl problem;;
return !spell.toSpell()->getAdventureMechanics().isTargetInRange(problem, GAME->interface()->cb.get(), hero, position);
}
MapRendererAdventureTransitionContext::MapRendererAdventureTransitionContext(const MapRendererContextState & viewState)