1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Merge pull request #3366 from Laserlicht/battle_informations

Battle stacks informations
This commit is contained in:
Ivan Savenko
2023-12-28 12:39:26 +02:00
committed by GitHub
12 changed files with 183 additions and 1 deletions

View File

@@ -26,6 +26,7 @@
#include "../CMusicHandler.h"
#include "../CGameInfo.h"
#include "../gui/CGuiHandler.h"
#include "../gui/WindowHandler.h"
#include "../render/Colors.h"
#include "../render/Canvas.h"
#include "../render/IRenderHandler.h"
@@ -812,6 +813,9 @@ void BattleStacksController::updateHoveredStacks()
{
auto newStacks = selectHoveredStacks();
if(newStacks.size() == 0)
owner.windowObject->updateStackInfoWindow(nullptr);
for(const auto * stack : mouseHoveredStacks)
{
if (vstd::contains(newStacks, stack))
@@ -828,11 +832,15 @@ void BattleStacksController::updateHoveredStacks()
if (vstd::contains(mouseHoveredStacks, stack))
continue;
owner.windowObject->updateStackInfoWindow(newStacks.size() == 1 && vstd::find_pos(newStacks, stack) == 0 ? stack : nullptr);
stackAnimation[stack->unitId()]->setBorderColor(AnimationControls::getBlueBorder());
if (stackAnimation[stack->unitId()]->framesInGroup(ECreatureAnimType::MOUSEON) > 0 && stack->alive() && !stack->isFrozen())
stackAnimation[stack->unitId()]->playOnce(ECreatureAnimType::MOUSEON);
}
if(mouseHoveredStacks != newStacks)
GH.windows().totalRedraw(); //fix for frozen stack info window and blue border in action bar
mouseHoveredStacks = newStacks;
}