CHeroWindow.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #pragma once
  2. #include "../lib/HeroBonus.h"
  3. #include "gui/CIntObjectClasses.h"
  4. #include "GUIClasses.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 CAdventureMapButton;
  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. /// Button which switches hero selection
  25. class CHeroSwitcher : public CIntObject
  26. {
  27. const CGHeroInstance * hero;
  28. CAnimImage *image;
  29. public:
  30. virtual void clickLeft(tribool down, bool previousState);
  31. CHeroSwitcher(Point pos, const CGHeroInstance * hero);
  32. };
  33. //helper class for calculating values of hero bonuses without bonuses from picked up artifact
  34. class CHeroWithMaybePickedArtifact : public IBonusBearer
  35. {
  36. public:
  37. const CGHeroInstance *hero;
  38. CWindowWithArtifacts *cww;
  39. CHeroWithMaybePickedArtifact(CWindowWithArtifacts *Cww, const CGHeroInstance *Hero);
  40. const TBonusListPtr getAllBonuses(const CSelector &selector, const CSelector &limit, const CBonusSystemNode *root = nullptr, const std::string &cachingStr = "") const override;
  41. };
  42. class CHeroWindow: public CWindowObject, public CWindowWithGarrison, public CWindowWithArtifacts
  43. {
  44. CGStatusBar * ourBar; //heroWindow's statusBar
  45. //buttons
  46. //CAdventureMapButton * gar4button; //splitting
  47. std::vector<CHeroSwitcher *> heroList; //list of heroes
  48. CPicture * listSelection; //selection border
  49. //clickable areas
  50. LRClickableAreaWText * portraitArea;
  51. CAnimImage * portraitImage;
  52. std::vector<LRClickableAreaWTextComp *> primSkillAreas;
  53. LRClickableAreaWText * expArea;
  54. LRClickableAreaWText * spellPointsArea;
  55. LRClickableAreaWText * specArea;//specialty
  56. CAnimImage *specImage;
  57. MoraleLuckBox * morale, * luck;
  58. std::vector<LRClickableAreaWTextComp *> secSkillAreas;
  59. std::vector<CAnimImage *> secSkillImages;
  60. CHeroWithMaybePickedArtifact heroWArt;
  61. CAdventureMapButton * quitButton, * dismissButton, * questlogButton, * commanderButton; //general
  62. CHighlightableButton *tacticsButton; //garrison / formation handling;
  63. CHighlightableButtonsGroup *formations;
  64. public:
  65. const CGHeroInstance * curHero;
  66. CHeroWindow(const CGHeroInstance *hero); //c-tor
  67. void update(const CGHeroInstance * hero, bool redrawNeeded = false); //sets main displayed hero
  68. void showAll(SDL_Surface * to);
  69. void dismissCurrent(); //dissmissed currently displayed hero (curHero)
  70. void questlog(); //show quest log in hero window
  71. void commanderWindow();
  72. void switchHero(); //changes displayed hero
  73. //friends
  74. friend void CArtPlace::clickLeft(tribool down, bool previousState);
  75. friend class CPlayerInterface;
  76. };