CHeroWindow.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #pragma once
  2. #include "../../lib/HeroBonus.h"
  3. #include "../widgets/CArtifactHolder.h"
  4. #include "../widgets/CGarrisonInt.h"
  5. /*
  6. * CHeroWindow.h, part of VCMI engine
  7. *
  8. * Authors: listed in file AUTHORS in main folder
  9. *
  10. * License: GNU General Public License v2.0 or later
  11. * Full text of license available in license.txt file, in main folder
  12. *
  13. */
  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); //c-tor
  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 questlog(); //show quest log in hero window
  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 CArtPlace::clickLeft(tribool down, bool previousState);
  79. friend class CPlayerInterface;
  80. };