CHeroWindow.h 2.9 KB

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