1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00
This commit is contained in:
AlexVinS 2016-09-22 18:44:57 +03:00
parent ea2e336f54
commit 21de5817e3

View File

@ -3010,18 +3010,27 @@ void CBattleInterface::showHighlightedHexes(SDL_Surface * to)
}
if (settings["battle"]["mouseShadow"].Bool())
{
if(spellToCast) //when casting spell
const ISpellCaster * caster = nullptr;
const CSpell * spell = nullptr;
if(spellToCast)//hero casts spell
{
spell = SpellID(spellToCast->additionalInfo).toSpell();
caster = activeStack->attackerOwned ? attackingHeroInstance : defendingHeroInstance;
}
else if(creatureSpellToCast >= 0 && stackCanCastSpell && creatureCasting)//stack casts spell
{
spell = SpellID(creatureSpellToCast).toSpell();
caster = activeStack;
}
if(caster && spell) //when casting spell
{
//calculating spell school level
const CSpell & spToCast = *CGI->spellh->objects[spellToCast->additionalInfo];
ui8 schoolLevel = 0;
auto caster = activeStack->attackerOwned ? attackingHeroInstance : defendingHeroInstance;
if (caster)
schoolLevel = caster->getSpellSchoolLevel(&spToCast);
ui8 schoolLevel = caster->getSpellSchoolLevel(spell);
// printing shaded hex(es)
auto shaded = spToCast.rangeInHexes(currentlyHoveredHex, schoolLevel, curInt->cb->battleGetMySide());
auto shaded = spell->rangeInHexes(currentlyHoveredHex, schoolLevel, curInt->cb->battleGetMySide());
for(BattleHex shadedHex : shaded)
{
if ((shadedHex.getX() != 0) && (shadedHex.getX() != GameConstants::BFIELD_WIDTH -1))