1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-03 00:46:55 +02:00
Files
vcmi/client/battle/UnitActionPanel.h
Ivan Savenko 1ac8080cbf Implemented new unit actions panel in combat
Alternative actions submod from extras is now deprecated and will have
no effect.

As long as screen width allows, game will now display additional panel
with all possible unit actions.

Panel will also display spells that can be cast by unit, allowing small
version of unit spellbook (total limit of actions is 12, but some are
used for creature actions, so unit spells are limited to 7-9)
2025-06-19 19:29:01 +03:00

47 lines
1.4 KiB
C++

/*
* UnitActionPanel.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#pragma once
#include "../gui/CIntObject.h"
#include "../../lib/battle/PossiblePlayerBattleAction.h"
#include "../../lib/filesystem/ResourcePath.h"
class CFilledTexture;
class TransparentFilledRectangle;
class CToggleButton;
class CLabel;
class BattleInterface;
class UnitActionPanel : public CIntObject
{
private:
std::shared_ptr<CFilledTexture> background;
std::shared_ptr<TransparentFilledRectangle> rect;
std::vector<std::shared_ptr<CToggleButton>> buttons;
BattleInterface & owner;
void testAndAddAction(const std::vector<PossiblePlayerBattleAction> & allActions, const std::vector<PossiblePlayerBattleAction::Actions> & actionFilter, const ImagePath & iconPath, const std::string & descriptionTextID );
void testAndAddSpell(const std::vector<PossiblePlayerBattleAction> & allActions, const SpellID & spellFilter );
void restoreAllActions();
void setActions(int buttonIndex, const std::vector<PossiblePlayerBattleAction> & newActions);
public:
static constexpr int ACTION_SLOTS = 12;
UnitActionPanel(BattleInterface & owner);
void setPossibleActions(const std::vector<PossiblePlayerBattleAction> & actions);
std::vector<std::tuple<SpellID, bool>> getSpells() const;
void show(Canvas & to) override;
};