1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-26 08:41:13 +02:00
vcmi/client/battle/BattleWindow.h

103 lines
2.7 KiB
C
Raw Normal View History

/*
* BattleWindow.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"
2022-12-25 12:22:07 +02:00
#include "../gui/InterfaceObjectConfigurable.h"
2022-12-20 01:28:20 +02:00
#include "../../lib/battle/CBattleInfoCallback.h"
#include "../../lib/battle/PossiblePlayerBattleAction.h"
VCMI_LIB_NAMESPACE_BEGIN
class CStack;
VCMI_LIB_NAMESPACE_END
class CButton;
class BattleInterface;
class BattleConsole;
class BattleRenderer;
class StackQueue;
/// GUI object that handles functionality of panel at the bottom of combat screen
class BattleWindow : public InterfaceObjectConfigurable
{
2022-12-13 13:58:16 +02:00
BattleInterface & owner;
std::shared_ptr<StackQueue> queue;
std::shared_ptr<BattleConsole> console;
/// button press handling functions
void bOptionsf();
void bSurrenderf();
void bFleef();
void bAutofightf();
void bSpellf();
void bWaitf();
2022-12-20 01:28:20 +02:00
void bSwitchActionf();
void bDefencef();
void bConsoleUpf();
void bConsoleDownf();
void bTacticNextStack();
void bTacticPhaseEnd();
/// functions for handling actions after they were confirmed by popup window
void reallyFlee();
void reallySurrender();
2022-12-20 01:28:20 +02:00
/// management of alternative actions
std::list<PossiblePlayerBattleAction> alternativeActions;
PossiblePlayerBattleAction defaultAction;
void showAlternativeActionIcon(PossiblePlayerBattleAction);
2023-02-15 23:38:41 +02:00
/// flip battle queue visibility to opposite
void toggleQueueVisibility();
void createQueue();
std::shared_ptr<BattleConsole> buildBattleConsole(const JsonNode &) const;
public:
BattleWindow(BattleInterface & owner );
2022-12-21 18:04:19 +02:00
~BattleWindow();
/// Closes window once battle finished
void close();
2023-02-15 23:38:41 +02:00
/// Toggle StackQueue visibility
void hideQueue();
void showQueue();
/// block all UI elements when player is not allowed to act, e.g. during enemy turn
void blockUI(bool on);
/// Refresh queue after turn order changes
void updateQueue();
2023-01-22 21:03:11 +02:00
/// Get mouse-hovered battle queue unit ID if any found
boost::optional<uint32_t> getQueueHoveredUnitId();
void activate() override;
void deactivate() override;
2023-02-02 18:42:44 +02:00
void keyPressed(const SDL_Keycode & key) override;
void clickRight(tribool down, bool previousState) override;
void show(SDL_Surface *to) override;
void showAll(SDL_Surface *to) override;
/// Toggle UI to displaying tactics phase
void tacticPhaseStarted();
/// Toggle UI to displaying battle log in place of tactics UI
void tacticPhaseEnded();
2022-12-20 01:28:20 +02:00
/// Set possible alternative options. If more than 1 - the last will be considered as default option
void setAlternativeActions(const std::list<PossiblePlayerBattleAction> &);
};