CHeroWindow.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 virtual 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. int64_t getTreeVersion() const override;
  45. };
  46. class CHeroWindow: public CWindowObject, public CWindowWithGarrison, public CWindowWithArtifacts
  47. {
  48. CGStatusBar * ourBar; //heroWindow's statusBar
  49. //buttons
  50. //CButton * gar4button; //splitting
  51. std::vector<CHeroSwitcher *> heroList; //list of heroes
  52. CPicture * listSelection; //selection border
  53. //clickable areas
  54. LRClickableAreaWText * portraitArea;
  55. CAnimImage * portraitImage;
  56. std::vector<LRClickableAreaWTextComp *> primSkillAreas;
  57. LRClickableAreaWText * expArea;
  58. LRClickableAreaWText * spellPointsArea;
  59. LRClickableAreaWText * specArea;//specialty
  60. CAnimImage *specImage;
  61. MoraleLuckBox * morale, * luck;
  62. std::vector<LRClickableAreaWTextComp *> secSkillAreas;
  63. std::vector<CAnimImage *> secSkillImages;
  64. CHeroWithMaybePickedArtifact heroWArt;
  65. CButton * quitButton, * dismissButton, * questlogButton, * commanderButton; //general
  66. CToggleButton *tacticsButton; //garrison / formation handling;
  67. CToggleGroup *formations;
  68. public:
  69. const CGHeroInstance * curHero;
  70. CHeroWindow(const CGHeroInstance *hero);
  71. void update(const CGHeroInstance * hero, bool redrawNeeded = false); //sets main displayed hero
  72. void showAll(SDL_Surface * to) override;
  73. void dismissCurrent(); //dissmissed currently displayed hero (curHero)
  74. void commanderWindow();
  75. void switchHero(); //changes displayed hero
  76. virtual void updateGarrisons() override; //updates the morale widget and calls the parent
  77. //friends
  78. friend void CHeroArtPlace::clickLeft(tribool down, bool previousState);
  79. friend class CPlayerInterface;
  80. };