BattleControlPanel.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * BattleControlPanel.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "../gui/CIntObject.h"
  12. #include "../gui/InterfaceObjectConfigurable.h"
  13. #include "../../lib/battle/CBattleInfoCallback.h"
  14. VCMI_LIB_NAMESPACE_BEGIN
  15. class CStack;
  16. VCMI_LIB_NAMESPACE_END
  17. class CButton;
  18. class BattleInterface;
  19. class BattleConsole;
  20. /// GUI object that handles functionality of panel at the bottom of combat screen
  21. class BattleControlPanel : public InterfaceObjectConfigurable
  22. {
  23. BattleInterface & owner;
  24. std::shared_ptr<BattleConsole> buildBattleConsole(const JsonNode &) const;
  25. /// button press handling functions
  26. void bOptionsf();
  27. void bSurrenderf();
  28. void bFleef();
  29. void bAutofightf();
  30. void bSpellf();
  31. void bWaitf();
  32. void bSwitchActionf();
  33. void bDefencef();
  34. void bConsoleUpf();
  35. void bConsoleDownf();
  36. void bTacticNextStack();
  37. void bTacticPhaseEnd();
  38. /// functions for handling actions after they were confirmed by popup window
  39. void reallyFlee();
  40. void reallySurrender();
  41. /// management of alternative actions
  42. std::list<PossiblePlayerBattleAction> alternativeActions;
  43. PossiblePlayerBattleAction defaultAction;
  44. void showAlternativeActionIcon(PossiblePlayerBattleAction);
  45. public:
  46. std::shared_ptr<BattleConsole> console;
  47. /// block all UI elements when player is not allowed to act, e.g. during enemy turn
  48. void blockUI(bool on);
  49. void show(SDL_Surface * to) override;
  50. void showAll(SDL_Surface * to) override;
  51. /// Toggle UI to displaying tactics phase
  52. void tacticPhaseStarted();
  53. /// Toggle UI to displaying battle log in place of tactics UI
  54. void tacticPhaseEnded();
  55. /// Set possible alternative options. If more than 1 - the last will be considered as default option
  56. void setAlternativeActions(const std::list<PossiblePlayerBattleAction> &);
  57. BattleControlPanel(BattleInterface & owner, const Point & position);
  58. };