CHeroWindow.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #pragma once
  2. #include "../lib/HeroBonus.h"
  3. //#include "CPlayerInterface.h"
  4. /*
  5. * CHeroWindow.h, part of VCMI engine
  6. *
  7. * Authors: listed in file AUTHORS in main folder
  8. *
  9. * License: GNU General Public License v2.0 or later
  10. * Full text of license available in license.txt file, in main folder
  11. *
  12. */
  13. class CAdventureMapButton;
  14. struct SDL_Surface;
  15. class CGHeroInstance;
  16. class CDefHandler;
  17. class CArtifact;
  18. class CHeroWindow;
  19. class LClickableAreaHero;
  20. class LRClickableAreaWText;
  21. class LRClickableAreaWTextComp;
  22. class CArtifactsOfHero;
  23. /// Button which switches hero selection
  24. class CHeroSwitcher : public CIntObject
  25. {
  26. const CGHeroInstance * hero;
  27. CAnimImage *image;
  28. public:
  29. virtual void clickLeft(tribool down, bool previousState);
  30. CHeroSwitcher(Point pos, const CGHeroInstance * hero);
  31. };
  32. //helper class for calculating values of hero bonuses without bonuses from picked up artifact
  33. class CHeroWithMaybePickedArtifact : public IBonusBearer
  34. {
  35. public:
  36. const CGHeroInstance *hero;
  37. CWindowWithArtifacts *cww;
  38. CHeroWithMaybePickedArtifact(CWindowWithArtifacts *Cww, const CGHeroInstance *Hero);
  39. const TBonusListPtr getAllBonuses(const CSelector &selector, const CSelector &limit, const CBonusSystemNode *root = NULL, const std::string &cachingStr = "") const OVERRIDE;
  40. };
  41. class CHeroWindow: public CWindowWithGarrison, public CWindowWithArtifacts
  42. {
  43. CPicture *background;
  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;//speciality
  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; //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 quit(); //stops displaying hero window and disposes
  70. void dismissCurrent(); //dissmissed currently displayed hero (curHero)
  71. void questlog(); //show quest log in hero window
  72. void switchHero(); //changes displayed hero
  73. //friends
  74. friend void CArtPlace::clickLeft(tribool down, bool previousState);
  75. friend class CPlayerInterface;
  76. };