CHeroWindow.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * CHeroWindow.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 "../../lib/HeroBonus.h"
  12. #include "../widgets/CArtifactHolder.h"
  13. #include "../widgets/CGarrisonInt.h"
  14. class CButton;
  15. struct SDL_Surface;
  16. class CGHeroInstance;
  17. class CArtifact;
  18. class CHeroWindow;
  19. class LClickableAreaHero;
  20. class LRClickableAreaWText;
  21. class LRClickableAreaWTextComp;
  22. class CArtifactsOfHero;
  23. class MoraleLuckBox;
  24. class CToggleButton;
  25. class CToggleGroup;
  26. class CGStatusBar;
  27. /// Button which switches hero selection
  28. class CHeroSwitcher : public CIntObject
  29. {
  30. const CGHeroInstance * hero;
  31. CAnimImage *image;
  32. public:
  33. virtual void clickLeft(tribool down, bool previousState) override;
  34. CHeroSwitcher(Point pos, const CGHeroInstance * hero);
  35. };
  36. //helper class for calculating values of hero bonuses without bonuses from picked up artifact
  37. class CHeroWithMaybePickedArtifact : public IBonusBearer
  38. {
  39. public:
  40. const CGHeroInstance *hero;
  41. CWindowWithArtifacts *cww;
  42. CHeroWithMaybePickedArtifact(CWindowWithArtifacts *Cww, const CGHeroInstance *Hero);
  43. const TBonusListPtr getAllBonuses(const CSelector &selector, const CSelector &limit, const CBonusSystemNode *root = nullptr, const std::string &cachingStr = "") const override;
  44. };
  45. class CHeroWindow: public CWindowObject, public CWindowWithGarrison, public CWindowWithArtifacts
  46. {
  47. CGStatusBar * ourBar; //heroWindow's statusBar
  48. //buttons
  49. //CButton * gar4button; //splitting
  50. std::vector<CHeroSwitcher *> heroList; //list of heroes
  51. CPicture * listSelection; //selection border
  52. //clickable areas
  53. LRClickableAreaWText * portraitArea;
  54. CAnimImage * portraitImage;
  55. std::vector<LRClickableAreaWTextComp *> primSkillAreas;
  56. LRClickableAreaWText * expArea;
  57. LRClickableAreaWText * spellPointsArea;
  58. LRClickableAreaWText * specArea;//specialty
  59. CAnimImage *specImage;
  60. MoraleLuckBox * morale, * luck;
  61. std::vector<LRClickableAreaWTextComp *> secSkillAreas;
  62. std::vector<CAnimImage *> secSkillImages;
  63. CHeroWithMaybePickedArtifact heroWArt;
  64. CButton * quitButton, * dismissButton, * questlogButton, * commanderButton; //general
  65. CToggleButton *tacticsButton; //garrison / formation handling;
  66. CToggleGroup *formations;
  67. public:
  68. const CGHeroInstance * curHero;
  69. CHeroWindow(const CGHeroInstance *hero);
  70. void update(const CGHeroInstance * hero, bool redrawNeeded = false); //sets main displayed hero
  71. void showAll(SDL_Surface * to) override;
  72. void dismissCurrent(); //dissmissed currently displayed hero (curHero)
  73. void commanderWindow();
  74. void switchHero(); //changes displayed hero
  75. virtual void updateGarrisons() override; //updates the morale widget and calls the parent
  76. //friends
  77. friend void CHeroArtPlace::clickLeft(tribool down, bool previousState);
  78. friend class CPlayerInterface;
  79. };