CHeroWindow.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #pragma once
  2. #include "../../lib/HeroBonus.h"
  3. #include "../widgets/CIntObjectClasses.h"
  4. #include "../widgets/CArtifactHolder.h"
  5. #include "../widgets/CGarrisonInt.h"
  6. /*
  7. * CHeroWindow.h, part of VCMI engine
  8. *
  9. * Authors: listed in file AUTHORS in main folder
  10. *
  11. * License: GNU General Public License v2.0 or later
  12. * Full text of license available in license.txt file, in main folder
  13. *
  14. */
  15. class CAdventureMapButton;
  16. struct SDL_Surface;
  17. class CGHeroInstance;
  18. class CDefHandler;
  19. class CArtifact;
  20. class CHeroWindow;
  21. class LClickableAreaHero;
  22. class LRClickableAreaWText;
  23. class LRClickableAreaWTextComp;
  24. class CArtifactsOfHero;
  25. class MoraleLuckBox;
  26. /// Button which switches hero selection
  27. class CHeroSwitcher : public CIntObject
  28. {
  29. const CGHeroInstance * hero;
  30. CAnimImage *image;
  31. public:
  32. virtual void clickLeft(tribool down, bool previousState);
  33. CHeroSwitcher(Point pos, const CGHeroInstance * hero);
  34. };
  35. //helper class for calculating values of hero bonuses without bonuses from picked up artifact
  36. class CHeroWithMaybePickedArtifact : public IBonusBearer
  37. {
  38. public:
  39. const CGHeroInstance *hero;
  40. CWindowWithArtifacts *cww;
  41. CHeroWithMaybePickedArtifact(CWindowWithArtifacts *Cww, const CGHeroInstance *Hero);
  42. const TBonusListPtr getAllBonuses(const CSelector &selector, const CSelector &limit, const CBonusSystemNode *root = nullptr, const std::string &cachingStr = "") const override;
  43. };
  44. class CHeroWindow: public CWindowObject, public CWindowWithGarrison, public CWindowWithArtifacts
  45. {
  46. CGStatusBar * ourBar; //heroWindow's statusBar
  47. //buttons
  48. //CAdventureMapButton * gar4button; //splitting
  49. std::vector<CHeroSwitcher *> heroList; //list of heroes
  50. CPicture * listSelection; //selection border
  51. //clickable areas
  52. LRClickableAreaWText * portraitArea;
  53. CAnimImage * portraitImage;
  54. std::vector<LRClickableAreaWTextComp *> primSkillAreas;
  55. LRClickableAreaWText * expArea;
  56. LRClickableAreaWText * spellPointsArea;
  57. LRClickableAreaWText * specArea;//specialty
  58. CAnimImage *specImage;
  59. MoraleLuckBox * morale, * luck;
  60. std::vector<LRClickableAreaWTextComp *> secSkillAreas;
  61. std::vector<CAnimImage *> secSkillImages;
  62. CHeroWithMaybePickedArtifact heroWArt;
  63. CAdventureMapButton * quitButton, * dismissButton, * questlogButton, * commanderButton; //general
  64. CHighlightableButton *tacticsButton; //garrison / formation handling;
  65. CHighlightableButtonsGroup *formations;
  66. public:
  67. const CGHeroInstance * curHero;
  68. CHeroWindow(const CGHeroInstance *hero); //c-tor
  69. void update(const CGHeroInstance * hero, bool redrawNeeded = false); //sets main displayed hero
  70. void showAll(SDL_Surface * to);
  71. void dismissCurrent(); //dissmissed currently displayed hero (curHero)
  72. void questlog(); //show quest log in hero window
  73. void commanderWindow();
  74. void switchHero(); //changes displayed hero
  75. //friends
  76. friend void CArtPlace::clickLeft(tribool down, bool previousState);
  77. friend class CPlayerInterface;
  78. };