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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user