CHeroWindow.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 AdventureMapButton;
  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. public:
  27. int id;
  28. CHeroWindow * getOwner();
  29. virtual void clickLeft(tribool down, bool previousState);
  30. CHeroSwitcher(int serial);
  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. enum ELabel {};
  44. std::map<ELabel, CLabel*> labels;
  45. CPicture *background;
  46. CGStatusBar * ourBar; //heroWindow's statusBar
  47. //general graphics
  48. CDefEssential *flags;
  49. //buttons
  50. //AdventureMapButton * gar4button; //splitting
  51. std::vector<CHeroSwitcher *> heroListMi; //new better list of heroes
  52. //clickable areas
  53. LRClickableAreaWText * portraitArea;
  54. std::vector<LRClickableAreaWTextComp *> primSkillAreas;
  55. LRClickableAreaWText * expArea;
  56. LRClickableAreaWText * spellPointsArea;
  57. LRClickableAreaWText * specArea;//speciality
  58. MoraleLuckBox * morale, * luck;
  59. std::vector<LRClickableAreaWTextComp *> secSkillAreas;
  60. CHeroWithMaybePickedArtifact heroWArt;
  61. public:
  62. const CGHeroInstance * curHero;
  63. AdventureMapButton * quitButton, * dismissButton, * questlogButton; //general
  64. CHighlightableButton *tacticsButton; //garrison / formation handling;
  65. CHighlightableButtonsGroup *formations;
  66. int player;
  67. CHeroWindow(const CGHeroInstance *hero); //c-tor
  68. ~CHeroWindow(); //d-tor
  69. void update(const CGHeroInstance * hero, bool redrawNeeded = false); //sets main displayed hero
  70. void showAll(SDL_Surface * to); //shows and activates adv. map interface
  71. // void redrawCurBack(); //redraws curBAck from scratch
  72. void quit(); //stops displaying hero window and disposes
  73. void dismissCurrent(); //dissmissed currently displayed hero (curHero)
  74. void questlog(); //show quest log in hero window
  75. void switchHero(); //changes displayed hero
  76. //friends
  77. friend void CArtPlace::clickLeft(tribool down, bool previousState);
  78. friend class CPlayerInterface;
  79. };