CHeroWindow.h 2.9 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 CDefHandler;
  18. class CArtifact;
  19. class CHeroWindow;
  20. class LClickableAreaHero;
  21. class LRClickableAreaWText;
  22. class LRClickableAreaWTextComp;
  23. class CArtifactsOfHero;
  24. class MoraleLuckBox;
  25. class CToggleButton;
  26. class CToggleGroup;
  27. class CGStatusBar;
  28. /// Button which switches hero selection
  29. class CHeroSwitcher : public CIntObject
  30. {
  31. const CGHeroInstance * hero;
  32. CAnimImage *image;
  33. public:
  34. virtual void clickLeft(tribool down, bool previousState) override;
  35. CHeroSwitcher(Point pos, const CGHeroInstance * hero);
  36. };
  37. //helper class for calculating values of hero bonuses without bonuses from picked up artifact
  38. class CHeroWithMaybePickedArtifact : public IBonusBearer
  39. {
  40. public:
  41. const CGHeroInstance *hero;
  42. CWindowWithArtifacts *cww;
  43. CHeroWithMaybePickedArtifact(CWindowWithArtifacts *Cww, const CGHeroInstance *Hero);
  44. const TBonusListPtr getAllBonuses(const CSelector &selector, const CSelector &limit, const CBonusSystemNode *root = nullptr, const std::string &cachingStr = "") 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); //c-tor
  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 questlog(); //show quest log in hero window
  75. void commanderWindow();
  76. void switchHero(); //changes displayed hero
  77. //friends
  78. friend void CArtPlace::clickLeft(tribool down, bool previousState);
  79. friend class CPlayerInterface;
  80. };