2009-04-15 17:03:31 +03:00
|
|
|
/*
|
|
|
|
* CHeroWindow.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
2017-07-13 10:26:03 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../../lib/HeroBonus.h"
|
|
|
|
#include "../widgets/CArtifactHolder.h"
|
|
|
|
#include "../widgets/CGarrisonInt.h"
|
2009-04-15 17:03:31 +03:00
|
|
|
|
2014-08-03 14:16:19 +03:00
|
|
|
class CButton;
|
2009-04-04 22:26:41 +03:00
|
|
|
struct SDL_Surface;
|
|
|
|
class CGHeroInstance;
|
|
|
|
class CArtifact;
|
|
|
|
class CHeroWindow;
|
2009-06-18 18:05:00 +03:00
|
|
|
class LClickableAreaHero;
|
|
|
|
class LRClickableAreaWText;
|
|
|
|
class LRClickableAreaWTextComp;
|
|
|
|
class CArtifactsOfHero;
|
2014-07-13 18:39:45 +03:00
|
|
|
class MoraleLuckBox;
|
2014-08-03 14:16:19 +03:00
|
|
|
class CToggleButton;
|
|
|
|
class CToggleGroup;
|
2014-07-15 10:14:49 +03:00
|
|
|
class CGStatusBar;
|
2018-04-07 13:34:11 +02:00
|
|
|
class CTextBox;
|
2009-04-04 22:26:41 +03:00
|
|
|
|
2011-02-22 13:52:36 +02:00
|
|
|
/// Button which switches hero selection
|
2010-07-13 08:25:40 +03:00
|
|
|
class CHeroSwitcher : public CIntObject
|
|
|
|
{
|
2012-05-13 18:04:21 +03:00
|
|
|
const CGHeroInstance * hero;
|
2018-04-07 13:34:11 +02:00
|
|
|
std::shared_ptr<CAnimImage> image;
|
|
|
|
CHeroWindow * owner;
|
2010-07-13 08:25:40 +03:00
|
|
|
public:
|
2018-04-07 13:34:11 +02:00
|
|
|
void clickLeft(tribool down, bool previousState) override;
|
2009-04-04 22:26:41 +03:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
CHeroSwitcher(CHeroWindow * owner_, Point pos_, const CGHeroInstance * hero_);
|
2010-07-13 08:25:40 +03:00
|
|
|
};
|
2009-04-04 22:26:41 +03:00
|
|
|
|
2011-02-27 21:58:14 +02:00
|
|
|
//helper class for calculating values of hero bonuses without bonuses from picked up artifact
|
2017-07-20 06:08:49 +02:00
|
|
|
class CHeroWithMaybePickedArtifact : public virtual IBonusBearer
|
2011-02-27 21:58:14 +02:00
|
|
|
{
|
|
|
|
public:
|
2018-04-07 13:34:11 +02:00
|
|
|
const CGHeroInstance * hero;
|
|
|
|
CWindowWithArtifacts * cww;
|
2010-12-17 00:32:53 +02:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
CHeroWithMaybePickedArtifact(CWindowWithArtifacts * Cww, const CGHeroInstance * Hero);
|
|
|
|
const TBonusListPtr getAllBonuses(const CSelector & selector, const CSelector & limit, const CBonusSystemNode * root = nullptr, const std::string & cachingStr = "") const override;
|
2017-07-20 06:08:49 +02:00
|
|
|
|
|
|
|
int64_t getTreeVersion() const override;
|
2011-02-27 21:58:14 +02:00
|
|
|
};
|
2010-12-17 00:32:53 +02:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
class CHeroWindow : public CWindowObject, public CGarrisonHolder, public CWindowWithArtifacts
|
2009-04-04 22:26:41 +03:00
|
|
|
{
|
2018-04-07 13:34:11 +02:00
|
|
|
std::shared_ptr<CLabel> name;
|
|
|
|
std::shared_ptr<CLabel> title;
|
|
|
|
|
|
|
|
std::shared_ptr<CAnimImage> banner;
|
|
|
|
std::shared_ptr<CGStatusBar> statusBar;
|
|
|
|
|
|
|
|
std::vector<std::shared_ptr<CHeroSwitcher>> heroList;
|
|
|
|
std::shared_ptr<CPicture> listSelection;
|
|
|
|
|
|
|
|
std::shared_ptr<LRClickableAreaWText> portraitArea;
|
|
|
|
std::shared_ptr<CAnimImage> portraitImage;
|
|
|
|
|
|
|
|
std::vector<std::shared_ptr<LRClickableAreaWTextComp>> primSkillAreas;
|
|
|
|
std::vector<std::shared_ptr<CAnimImage>> primSkillImages;
|
|
|
|
std::vector<std::shared_ptr<CLabel>> primSkillValues;
|
|
|
|
|
|
|
|
std::shared_ptr<CLabel> expValue;
|
|
|
|
std::shared_ptr<LRClickableAreaWText> expArea;
|
|
|
|
|
|
|
|
std::shared_ptr<CLabel> manaValue;
|
|
|
|
std::shared_ptr<LRClickableAreaWText> spellPointsArea;
|
|
|
|
|
|
|
|
std::shared_ptr<LRClickableAreaWText> specArea;
|
|
|
|
std::shared_ptr<CAnimImage> specImage;
|
|
|
|
std::shared_ptr<CLabel> specName;
|
|
|
|
std::shared_ptr<MoraleLuckBox> morale;
|
|
|
|
std::shared_ptr<MoraleLuckBox> luck;
|
|
|
|
std::vector<std::shared_ptr<LRClickableAreaWTextComp>> secSkillAreas;
|
|
|
|
std::vector<std::shared_ptr<CAnimImage>> secSkillImages;
|
|
|
|
std::vector<std::shared_ptr<CLabel>> secSkillNames;
|
|
|
|
std::vector<std::shared_ptr<CLabel>> secSkillValues;
|
|
|
|
|
2011-02-27 21:58:14 +02:00
|
|
|
CHeroWithMaybePickedArtifact heroWArt;
|
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
std::shared_ptr<CButton> quitButton;
|
|
|
|
std::shared_ptr<CTextBox> dismissLabel;
|
|
|
|
std::shared_ptr<CButton> dismissButton;
|
|
|
|
std::shared_ptr<CTextBox> questlogLabel;
|
|
|
|
std::shared_ptr<CButton> questlogButton;
|
|
|
|
std::shared_ptr<CButton> commanderButton;
|
|
|
|
|
|
|
|
std::shared_ptr<CToggleButton> tacticsButton;
|
|
|
|
std::shared_ptr<CToggleGroup> formations;
|
|
|
|
|
|
|
|
std::shared_ptr<CGarrisonInt> garr;
|
|
|
|
std::shared_ptr<CArtifactsOfHero> arts;
|
2016-10-16 02:52:11 +02:00
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
std::vector<std::shared_ptr<CLabel>> labels;
|
2012-05-13 18:04:21 +03:00
|
|
|
|
|
|
|
public:
|
|
|
|
const CGHeroInstance * curHero;
|
|
|
|
|
2018-04-07 13:34:11 +02:00
|
|
|
CHeroWindow(const CGHeroInstance * hero);
|
2011-01-06 22:00:19 +02:00
|
|
|
|
|
|
|
void update(const CGHeroInstance * hero, bool redrawNeeded = false); //sets main displayed hero
|
2012-05-13 18:04:21 +03:00
|
|
|
|
2009-04-04 22:26:41 +03:00
|
|
|
void dismissCurrent(); //dissmissed currently displayed hero (curHero)
|
2012-05-16 20:29:05 +03:00
|
|
|
void commanderWindow();
|
2012-05-13 18:04:21 +03:00
|
|
|
void switchHero(); //changes displayed hero
|
2018-04-07 13:34:11 +02:00
|
|
|
void updateGarrisons() override;
|
2009-04-04 22:26:41 +03:00
|
|
|
|
|
|
|
//friends
|
2016-11-04 18:54:09 +02:00
|
|
|
friend void CHeroArtPlace::clickLeft(tribool down, bool previousState);
|
2009-04-04 22:26:41 +03:00
|
|
|
friend class CPlayerInterface;
|
|
|
|
};
|