mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-15 20:03:15 +02:00
@@ -11,6 +11,7 @@
|
|||||||
#include "BattleFieldController.h"
|
#include "BattleFieldController.h"
|
||||||
|
|
||||||
#include "BattleInterface.h"
|
#include "BattleInterface.h"
|
||||||
|
#include "BattleWindow.h"
|
||||||
#include "BattleActionsController.h"
|
#include "BattleActionsController.h"
|
||||||
#include "BattleInterfaceClasses.h"
|
#include "BattleInterfaceClasses.h"
|
||||||
#include "BattleEffectsController.h"
|
#include "BattleEffectsController.h"
|
||||||
@@ -360,10 +361,7 @@ std::set<BattleHex> BattleFieldController::getMovementRangeForHoveredStack()
|
|||||||
if (!settings["battle"]["movementHighlightOnHover"].Bool() && !GH.isKeyboardShiftDown())
|
if (!settings["battle"]["movementHighlightOnHover"].Bool() && !GH.isKeyboardShiftDown())
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
auto hoveredHex = getHoveredHex();
|
auto hoveredStack = getHoveredStack();
|
||||||
|
|
||||||
// add possible movement hexes for stack under mouse
|
|
||||||
const CStack * const hoveredStack = owner.getBattle()->battleGetStackByPos(hoveredHex, true);
|
|
||||||
if(hoveredStack)
|
if(hoveredStack)
|
||||||
{
|
{
|
||||||
std::vector<BattleHex> v = owner.getBattle()->battleGetAvailableHexes(hoveredStack, true, true, nullptr);
|
std::vector<BattleHex> v = owner.getBattle()->battleGetAvailableHexes(hoveredStack, true, true, nullptr);
|
||||||
@@ -591,10 +589,9 @@ void BattleFieldController::showHighlightedHexes(Canvas & canvas)
|
|||||||
std::set<BattleHex> hoveredMoveHexes = getHighlightedHexesForMovementTarget();
|
std::set<BattleHex> hoveredMoveHexes = getHighlightedHexesForMovementTarget();
|
||||||
|
|
||||||
BattleHex hoveredHex = getHoveredHex();
|
BattleHex hoveredHex = getHoveredHex();
|
||||||
if(hoveredHex == BattleHex::INVALID)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const CStack * hoveredStack = getHoveredStack();
|
const CStack * hoveredStack = getHoveredStack();
|
||||||
|
if(!hoveredStack && hoveredHex == BattleHex::INVALID)
|
||||||
|
return;
|
||||||
|
|
||||||
// skip range limit calculations if unit hovered is not a shooter
|
// skip range limit calculations if unit hovered is not a shooter
|
||||||
if(hoveredStack && hoveredStack->isShooter())
|
if(hoveredStack && hoveredStack->isShooter())
|
||||||
@@ -608,7 +605,7 @@ void BattleFieldController::showHighlightedHexes(Canvas & canvas)
|
|||||||
calculateRangeLimitAndHighlightImages(shootingRangeDistance, shootingRangeLimitImages, shootingRangeLimitHexes, shootingRangeLimitHexesHighligts);
|
calculateRangeLimitAndHighlightImages(shootingRangeDistance, shootingRangeLimitImages, shootingRangeLimitHexes, shootingRangeLimitHexesHighligts);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto const & hoveredMouseHexes = 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)
|
||||||
{
|
{
|
||||||
@@ -676,6 +673,14 @@ const CStack* BattleFieldController::getHoveredStack()
|
|||||||
auto hoveredHex = getHoveredHex();
|
auto hoveredHex = getHoveredHex();
|
||||||
const CStack* hoveredStack = owner.getBattle()->battleGetStackByPos(hoveredHex, true);
|
const CStack* hoveredStack = owner.getBattle()->battleGetStackByPos(hoveredHex, true);
|
||||||
|
|
||||||
|
if(owner.windowObject->getQueueHoveredUnitId().has_value())
|
||||||
|
{
|
||||||
|
auto stacks = owner.getBattle()->battleGetAllStacks();
|
||||||
|
for(const CStack * stack : stacks)
|
||||||
|
if(stack->unitId() == *owner.windowObject->getQueueHoveredUnitId())
|
||||||
|
hoveredStack = stack;
|
||||||
|
}
|
||||||
|
|
||||||
return hoveredStack;
|
return hoveredStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
#include "../widgets/TextControls.h"
|
#include "../widgets/TextControls.h"
|
||||||
#include "../widgets/MiscWidgets.h"
|
#include "../widgets/MiscWidgets.h"
|
||||||
#include "../windows/CMessage.h"
|
#include "../windows/CMessage.h"
|
||||||
|
#include "../windows/CCreatureWindow.h"
|
||||||
#include "../windows/CSpellWindow.h"
|
#include "../windows/CSpellWindow.h"
|
||||||
#include "../render/CAnimation.h"
|
#include "../render/CAnimation.h"
|
||||||
#include "../render/IRenderHandler.h"
|
#include "../render/IRenderHandler.h"
|
||||||
@@ -1053,3 +1054,11 @@ void StackQueue::StackBox::show(Canvas & to)
|
|||||||
if(isBoundUnitHighlighted())
|
if(isBoundUnitHighlighted())
|
||||||
to.drawBorder(background->pos, Colors::CYAN, 2);
|
to.drawBorder(background->pos, Colors::CYAN, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StackQueue::StackBox::showPopupWindow(const Point & cursorPosition)
|
||||||
|
{
|
||||||
|
auto stacks = owner->owner.getBattle()->battleGetAllStacks();
|
||||||
|
for(const CStack * stack : stacks)
|
||||||
|
if(boundUnitID.has_value() && stack->unitId() == *boundUnitID)
|
||||||
|
GH.windows().createAndPushWindow<CStackWindow>(stack, true);
|
||||||
|
}
|
||||||
|
@@ -230,6 +230,7 @@ class StackQueue : public CIntObject
|
|||||||
|
|
||||||
void show(Canvas & to) override;
|
void show(Canvas & to) override;
|
||||||
void showAll(Canvas & to) override;
|
void showAll(Canvas & to) override;
|
||||||
|
void showPopupWindow(const Point & cursorPosition) override;
|
||||||
|
|
||||||
bool isBoundUnitHighlighted() const;
|
bool isBoundUnitHighlighted() const;
|
||||||
public:
|
public:
|
||||||
|
Reference in New Issue
Block a user