1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-05 00:49:09 +02:00

fix spell hover

This commit is contained in:
Laserlicht
2024-01-07 18:12:17 +01:00
committed by GitHub
parent f4bff876d5
commit 7a6722bc45

View File

@ -588,8 +588,9 @@ void BattleFieldController::showHighlightedHexes(Canvas & canvas)
std::set<BattleHex> hoveredSpellHexes = getHighlightedHexesForSpellRange(); std::set<BattleHex> hoveredSpellHexes = getHighlightedHexesForSpellRange();
std::set<BattleHex> hoveredMoveHexes = getHighlightedHexesForMovementTarget(); std::set<BattleHex> hoveredMoveHexes = getHighlightedHexesForMovementTarget();
BattleHex hoveredHex = getHoveredHex();
const CStack * hoveredStack = getHoveredStack(); const CStack * hoveredStack = getHoveredStack();
if(!hoveredStack) if(!hoveredStack && hoveredHex == BattleHex::INVALID)
return; return;
// skip range limit calculations if unit hovered is not a shooter // skip range limit calculations if unit hovered is not a shooter
@ -604,7 +605,7 @@ void BattleFieldController::showHighlightedHexes(Canvas & canvas)
calculateRangeLimitAndHighlightImages(shootingRangeDistance, shootingRangeLimitImages, shootingRangeLimitHexes, shootingRangeLimitHexesHighligts); calculateRangeLimitAndHighlightImages(shootingRangeDistance, shootingRangeLimitImages, shootingRangeLimitHexes, shootingRangeLimitHexesHighligts);
} }
auto const & hoveredMouseHexes = getHoveredHex() != BattleHex::INVALID && owner.actionsController->currentActionSpellcasting(getHoveredHex()) ? hoveredSpellHexes : hoveredMoveHexes; auto const & hoveredMouseHexes = hoveredHex != BattleHex::INVALID && owner.actionsController->currentActionSpellcasting(getHoveredHex()) ? hoveredSpellHexes : hoveredMoveHexes;
for(int hex = 0; hex < GameConstants::BFIELD_SIZE; ++hex) for(int hex = 0; hex < GameConstants::BFIELD_SIZE; ++hex)
{ {