2011-12-14 00:23:17 +03:00
|
|
|
#pragma once
|
|
|
|
|
2014-07-13 20:53:37 +03:00
|
|
|
#include "../../lib/HeroBonus.h"
|
|
|
|
#include "../widgets/CArtifactHolder.h"
|
|
|
|
#include "../widgets/CGarrisonInt.h"
|
2009-04-04 22:26:41 +03:00
|
|
|
|
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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
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;
|
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;
|
|
|
|
CAnimImage *image;
|
2010-07-13 08:25:40 +03:00
|
|
|
public:
|
2015-10-12 15:47:10 +02:00
|
|
|
virtual void clickLeft(tribool down, bool previousState) override;
|
2009-04-04 22:26:41 +03:00
|
|
|
|
2012-05-13 18:04:21 +03:00
|
|
|
CHeroSwitcher(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
|
|
|
|
class CHeroWithMaybePickedArtifact : public IBonusBearer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
const CGHeroInstance *hero;
|
|
|
|
CWindowWithArtifacts *cww;
|
2010-12-17 00:32:53 +02:00
|
|
|
|
2011-02-27 21:58:14 +02:00
|
|
|
CHeroWithMaybePickedArtifact(CWindowWithArtifacts *Cww, const CGHeroInstance *Hero);
|
2013-06-26 14:18:27 +03:00
|
|
|
const TBonusListPtr getAllBonuses(const CSelector &selector, const CSelector &limit, const CBonusSystemNode *root = nullptr, const std::string &cachingStr = "") const override;
|
2011-02-27 21:58:14 +02:00
|
|
|
};
|
2010-12-17 00:32:53 +02:00
|
|
|
|
2012-06-15 20:08:19 +03:00
|
|
|
class CHeroWindow: public CWindowObject, public CWindowWithGarrison, public CWindowWithArtifacts
|
2009-04-04 22:26:41 +03:00
|
|
|
{
|
2010-12-17 00:32:53 +02:00
|
|
|
CGStatusBar * ourBar; //heroWindow's statusBar
|
2009-04-04 22:26:41 +03:00
|
|
|
|
|
|
|
//buttons
|
2014-08-03 14:16:19 +03:00
|
|
|
//CButton * gar4button; //splitting
|
2012-05-13 18:04:21 +03:00
|
|
|
std::vector<CHeroSwitcher *> heroList; //list of heroes
|
|
|
|
CPicture * listSelection; //selection border
|
2009-04-04 22:26:41 +03:00
|
|
|
|
|
|
|
//clickable areas
|
|
|
|
LRClickableAreaWText * portraitArea;
|
2012-05-13 18:04:21 +03:00
|
|
|
CAnimImage * portraitImage;
|
|
|
|
|
2009-04-04 22:26:41 +03:00
|
|
|
std::vector<LRClickableAreaWTextComp *> primSkillAreas;
|
|
|
|
LRClickableAreaWText * expArea;
|
|
|
|
LRClickableAreaWText * spellPointsArea;
|
2013-01-17 21:15:00 +03:00
|
|
|
LRClickableAreaWText * specArea;//specialty
|
2012-05-13 18:04:21 +03:00
|
|
|
CAnimImage *specImage;
|
2010-02-07 17:06:14 +02:00
|
|
|
MoraleLuckBox * morale, * luck;
|
2009-04-04 22:26:41 +03:00
|
|
|
std::vector<LRClickableAreaWTextComp *> secSkillAreas;
|
2012-05-13 18:04:21 +03:00
|
|
|
std::vector<CAnimImage *> secSkillImages;
|
2011-02-27 21:58:14 +02:00
|
|
|
CHeroWithMaybePickedArtifact heroWArt;
|
|
|
|
|
2014-08-03 14:16:19 +03:00
|
|
|
CButton * quitButton, * dismissButton, * questlogButton, * commanderButton; //general
|
2016-10-16 02:52:11 +02:00
|
|
|
|
2014-08-03 14:16:19 +03:00
|
|
|
CToggleButton *tacticsButton; //garrison / formation handling;
|
|
|
|
CToggleGroup *formations;
|
2012-05-13 18:04:21 +03:00
|
|
|
|
|
|
|
public:
|
|
|
|
const CGHeroInstance * curHero;
|
|
|
|
|
2010-12-17 00:32:53 +02:00
|
|
|
CHeroWindow(const CGHeroInstance *hero); //c-tor
|
2011-01-06 22:00:19 +02:00
|
|
|
|
|
|
|
void update(const CGHeroInstance * hero, bool redrawNeeded = false); //sets main displayed hero
|
2015-10-12 15:47:10 +02:00
|
|
|
void showAll(SDL_Surface * to) override;
|
2012-05-13 18:04:21 +03:00
|
|
|
|
2009-04-04 22:26:41 +03:00
|
|
|
void dismissCurrent(); //dissmissed currently displayed hero (curHero)
|
2009-04-04 01:34:31 +03:00
|
|
|
void questlog(); //show quest log in hero window
|
2012-05-16 20:29:05 +03:00
|
|
|
void commanderWindow();
|
2012-05-13 18:04:21 +03:00
|
|
|
void switchHero(); //changes displayed hero
|
2016-09-19 18:54:05 +02:00
|
|
|
virtual void updateGarrisons() override; //updates the morale widget and calls the parent
|
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;
|
|
|
|
};
|