2011-12-14 00:23:17 +03:00
|
|
|
#pragma once
|
|
|
|
|
2014-07-13 18:39:45 +03:00
|
|
|
#include "../lib/GameConstants.h"
|
2011-07-05 09:14:07 +03:00
|
|
|
#include "../lib/ResourceSet.h"
|
2012-09-30 13:35:17 +03:00
|
|
|
#include "../lib/CConfigHandler.h"
|
2014-07-13 20:53:37 +03:00
|
|
|
#include "../widgets/CArtifactHolder.h"
|
|
|
|
#include "../widgets/CGarrisonInt.h"
|
2014-07-15 10:14:49 +03:00
|
|
|
#include "../widgets/Images.h"
|
|
|
|
#include "../windows/CWindowObject.h"
|
2009-05-19 21:23:04 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* GUIClasses.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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2009-07-26 13:43:22 +03:00
|
|
|
class CGDwelling;
|
2010-05-18 10:01:54 +03:00
|
|
|
class IMarket;
|
2014-07-13 18:39:45 +03:00
|
|
|
class CCreaturePic;
|
|
|
|
class MoraleLuckBox;
|
|
|
|
class CHeroArea;
|
|
|
|
class CMinorResDataBar;
|
2014-07-15 10:14:49 +03:00
|
|
|
class CSlider;
|
2014-07-13 18:39:45 +03:00
|
|
|
class CComponentBox;
|
2014-07-15 10:14:49 +03:00
|
|
|
class CTextInput;
|
|
|
|
class CListBox;
|
|
|
|
class CLabelGroup;
|
2014-08-03 14:16:19 +03:00
|
|
|
class CToggleButton;
|
|
|
|
class CToggleGroup;
|
2015-08-22 05:05:08 +02:00
|
|
|
class CVolumeSlider;
|
2014-07-15 10:14:49 +03:00
|
|
|
class CGStatusBar;
|
2009-05-19 21:23:04 +03:00
|
|
|
|
2011-02-22 13:52:36 +02:00
|
|
|
/// Recruitment window where you can recruit creatures
|
2012-06-15 20:08:19 +03:00
|
|
|
class CRecruitmentWindow : public CWindowObject
|
2009-05-19 21:23:04 +03:00
|
|
|
{
|
2012-06-22 14:40:16 +03:00
|
|
|
class CCreatureCard : public CIntObject
|
2009-05-19 21:23:04 +03:00
|
|
|
{
|
2012-06-22 14:40:16 +03:00
|
|
|
CRecruitmentWindow * parent;
|
2009-05-19 21:23:04 +03:00
|
|
|
CCreaturePic *pic; //creature's animation
|
2012-06-22 14:40:16 +03:00
|
|
|
bool selected;
|
|
|
|
|
2015-10-12 15:47:10 +02:00
|
|
|
void clickLeft(tribool down, bool previousState) override;
|
|
|
|
void clickRight(tribool down, bool previousState) override;
|
|
|
|
void showAll(SDL_Surface *to) override;
|
2012-06-22 14:40:16 +03:00
|
|
|
public:
|
|
|
|
const CCreature * creature;
|
|
|
|
si32 amount;
|
|
|
|
|
|
|
|
void select(bool on);
|
|
|
|
|
|
|
|
CCreatureCard(CRecruitmentWindow * window, const CCreature *crea, int totalAmount);
|
|
|
|
};
|
|
|
|
|
|
|
|
/// small class to display creature costs
|
|
|
|
class CCostBox : public CIntObject
|
|
|
|
{
|
|
|
|
std::map<int, std::pair<CLabel *, CAnimImage * > > resources;
|
|
|
|
public:
|
|
|
|
//res - resources to show
|
|
|
|
void set(TResources res);
|
|
|
|
//res - visible resources
|
|
|
|
CCostBox(Rect position, std::string title);
|
|
|
|
void createItems(TResources res);
|
2009-05-19 21:23:04 +03:00
|
|
|
};
|
|
|
|
|
2013-06-26 14:18:27 +03:00
|
|
|
std::function<void(CreatureID,int)> onRecruit; //void (int ID, int amount) <-- call to recruit creatures
|
2012-06-22 14:40:16 +03:00
|
|
|
|
2009-07-26 13:43:22 +03:00
|
|
|
int level;
|
|
|
|
const CArmedInstance *dst;
|
|
|
|
|
2012-06-22 14:40:16 +03:00
|
|
|
CCreatureCard * selected;
|
|
|
|
std::vector<CCreatureCard *> cards;
|
|
|
|
|
|
|
|
CSlider *slider; //for selecting amount
|
2014-08-03 14:16:19 +03:00
|
|
|
CButton *maxButton, *buyButton, *cancelButton;
|
2012-06-22 14:40:16 +03:00
|
|
|
//labels for visible values
|
|
|
|
CLabel * title;
|
|
|
|
CLabel * availableValue;
|
|
|
|
CLabel * toRecruitValue;
|
|
|
|
CCostBox * costPerTroopValue;
|
|
|
|
CCostBox * totalCostValue;
|
|
|
|
|
|
|
|
void select(CCreatureCard * card);
|
|
|
|
void buy();
|
2009-05-19 21:23:04 +03:00
|
|
|
void sliderMoved(int to);
|
2012-06-22 14:40:16 +03:00
|
|
|
|
2015-10-12 15:47:10 +02:00
|
|
|
void showAll(SDL_Surface *to) override;
|
2012-06-22 14:40:16 +03:00
|
|
|
public:
|
|
|
|
const CGDwelling * const dwelling;
|
2013-06-26 14:18:27 +03:00
|
|
|
CRecruitmentWindow(const CGDwelling *Dwelling, int Level, const CArmedInstance *Dst, const std::function<void(CreatureID,int)> & Recruit, int y_offset = 0); //creatures - pairs<creature_ID,amount> //c-tor
|
2012-06-22 14:40:16 +03:00
|
|
|
void availableCreaturesChanged();
|
2009-05-19 21:23:04 +03:00
|
|
|
};
|
|
|
|
|
2013-02-07 20:34:50 +03:00
|
|
|
/// Split window where creatures can be split up into two single unit stacks
|
2012-06-13 16:04:06 +03:00
|
|
|
class CSplitWindow : public CWindowObject
|
2009-05-19 21:23:04 +03:00
|
|
|
{
|
2013-06-26 14:18:27 +03:00
|
|
|
std::function<void(int, int)> callback;
|
2012-06-13 16:04:06 +03:00
|
|
|
int leftAmount;
|
|
|
|
int rightAmount;
|
|
|
|
|
|
|
|
int leftMin;
|
|
|
|
int rightMin;
|
|
|
|
|
2009-05-19 21:23:04 +03:00
|
|
|
CSlider *slider;
|
2010-11-15 17:15:00 +02:00
|
|
|
CCreaturePic *animLeft, *animRight; //creature's animation
|
2014-08-03 14:16:19 +03:00
|
|
|
CButton *ok, *cancel;
|
2009-05-19 21:23:04 +03:00
|
|
|
|
2012-06-13 16:04:06 +03:00
|
|
|
CTextInput *leftInput, *rightInput;
|
|
|
|
void setAmountText(std::string text, bool left);
|
|
|
|
void setAmount(int value, bool left);
|
|
|
|
void sliderMoved(int value);
|
|
|
|
void apply();
|
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* creature - displayed creature
|
|
|
|
* callback(leftAmount, rightAmount) - function to call on close
|
|
|
|
* leftMin, rightMin - minimal amount of creatures in each stack
|
|
|
|
* leftAmount, rightAmount - amount of creatures in each stack
|
|
|
|
*/
|
2013-06-26 14:18:27 +03:00
|
|
|
CSplitWindow(const CCreature * creature, std::function<void(int, int)> callback,
|
2012-06-13 16:04:06 +03:00
|
|
|
int leftMin, int rightMin, int leftAmount, int rightAmount);
|
2009-05-19 21:23:04 +03:00
|
|
|
};
|
|
|
|
|
2011-02-22 13:52:36 +02:00
|
|
|
/// Raised up level windowe where you can select one out of two skills
|
2012-06-15 20:08:19 +03:00
|
|
|
class CLevelWindow : public CWindowObject
|
2009-05-19 21:23:04 +03:00
|
|
|
{
|
2012-07-07 16:32:37 +03:00
|
|
|
CComponentBox * box; //skills to select
|
2013-06-26 14:18:27 +03:00
|
|
|
std::function<void(ui32)> cb;
|
2009-05-19 21:23:04 +03:00
|
|
|
|
2012-07-07 16:32:37 +03:00
|
|
|
void selectionChanged(unsigned to);
|
|
|
|
public:
|
|
|
|
|
2013-06-26 14:18:27 +03:00
|
|
|
CLevelWindow(const CGHeroInstance *hero, PrimarySkill::PrimarySkill pskill, std::vector<SecondarySkill> &skills, std::function<void(ui32)> callback); //c-tor
|
2009-05-19 21:23:04 +03:00
|
|
|
~CLevelWindow(); //d-tor
|
2012-07-07 16:32:37 +03:00
|
|
|
|
2009-05-19 21:23:04 +03:00
|
|
|
};
|
|
|
|
|
2011-02-22 13:52:36 +02:00
|
|
|
/// Town portal, castle gate window
|
2012-06-15 20:08:19 +03:00
|
|
|
class CObjectListWindow : public CWindowObject
|
2010-06-26 13:01:26 +03:00
|
|
|
{
|
2012-01-12 18:23:00 +03:00
|
|
|
class CItem : public CIntObject
|
|
|
|
{
|
|
|
|
CObjectListWindow *parent;
|
|
|
|
CLabel *text;
|
|
|
|
CPicture *border;
|
|
|
|
public:
|
|
|
|
const size_t index;
|
|
|
|
CItem(CObjectListWindow *parent, size_t id, std::string text);
|
|
|
|
|
|
|
|
void select(bool on);
|
2015-10-12 15:47:10 +02:00
|
|
|
void clickLeft(tribool down, bool previousState) override;
|
2012-01-12 18:23:00 +03:00
|
|
|
};
|
2010-06-26 13:01:26 +03:00
|
|
|
|
2013-06-26 14:18:27 +03:00
|
|
|
std::function<void(int)> onSelect;//called when OK button is pressed, returns id of selected item.
|
2012-01-12 18:23:00 +03:00
|
|
|
CLabel * title;
|
|
|
|
CLabel * descr;
|
2010-06-26 13:01:26 +03:00
|
|
|
|
2014-03-10 19:00:58 +03:00
|
|
|
CListBox * list;
|
|
|
|
CIntObject * titleImage;//title image (castle gate\town portal picture)
|
2014-08-03 14:16:19 +03:00
|
|
|
CButton *ok, *exit;
|
2010-06-26 13:01:26 +03:00
|
|
|
|
2012-01-12 18:23:00 +03:00
|
|
|
std::vector< std::pair<int, std::string> > items;//all items present in list
|
2010-06-26 13:01:26 +03:00
|
|
|
|
2014-03-10 19:00:58 +03:00
|
|
|
void init(CIntObject * titlePic, std::string _title, std::string _descr);
|
2012-01-12 18:23:00 +03:00
|
|
|
public:
|
|
|
|
size_t selected;//index of currently selected item
|
2010-06-26 13:01:26 +03:00
|
|
|
/// Callback will be called when OK button is pressed, returns id of selected item. initState = initially selected item
|
2013-06-26 14:18:27 +03:00
|
|
|
/// Image can be nullptr
|
2012-01-12 18:23:00 +03:00
|
|
|
///item names will be taken from map objects
|
2014-03-10 19:00:58 +03:00
|
|
|
CObjectListWindow(const std::vector<int> &_items, CIntObject * titlePic, std::string _title, std::string _descr,
|
2013-06-26 14:18:27 +03:00
|
|
|
std::function<void(int)> Callback);
|
2014-03-10 19:00:58 +03:00
|
|
|
CObjectListWindow(const std::vector<std::string> &_items, CIntObject * titlePic, std::string _title, std::string _descr,
|
2013-06-26 14:18:27 +03:00
|
|
|
std::function<void(int)> Callback);
|
2010-06-26 13:01:26 +03:00
|
|
|
|
2012-01-12 18:23:00 +03:00
|
|
|
CIntObject *genItem(size_t index);
|
|
|
|
void elementSelected();//call callback and close this window
|
|
|
|
void changeSelection(size_t which);
|
2015-10-12 15:47:10 +02:00
|
|
|
void keyPressed (const SDL_KeyboardEvent & key) override;
|
2010-06-26 13:01:26 +03:00
|
|
|
};
|
|
|
|
|
2012-06-15 20:08:19 +03:00
|
|
|
class CSystemOptionsWindow : public CWindowObject
|
2009-05-19 21:23:04 +03:00
|
|
|
{
|
|
|
|
private:
|
2012-01-12 18:23:00 +03:00
|
|
|
CLabel *title;
|
|
|
|
CLabelGroup *leftGroup;
|
|
|
|
CLabelGroup *rightGroup;
|
2014-08-03 14:16:19 +03:00
|
|
|
CButton *load, *save, *restart, *mainMenu, *quitGame, *backToMap; //load and restart are not used yet
|
|
|
|
CToggleGroup * heroMoveSpeed;
|
2014-08-11 19:16:39 +03:00
|
|
|
CToggleGroup * enemyMoveSpeed;
|
2014-08-03 14:16:19 +03:00
|
|
|
CToggleGroup * mapScrollSpeed;
|
2015-08-22 05:05:08 +02:00
|
|
|
CVolumeSlider * musicVolume, * effectsVolume;
|
2012-01-12 18:23:00 +03:00
|
|
|
|
|
|
|
//CHighlightableButton * showPath;
|
2014-08-03 14:16:19 +03:00
|
|
|
CToggleButton * showReminder;
|
|
|
|
CToggleButton * quickCombat;
|
|
|
|
CToggleButton * spellbookAnim;
|
|
|
|
CToggleButton * fullscreen;
|
2012-01-12 18:23:00 +03:00
|
|
|
|
2014-08-03 14:16:19 +03:00
|
|
|
CButton *gameResButton;
|
2012-09-29 18:10:56 +03:00
|
|
|
CLabel *gameResLabel;
|
2012-01-12 18:23:00 +03:00
|
|
|
|
2012-09-30 13:35:17 +03:00
|
|
|
SettingsListener onFullscreenChanged;
|
|
|
|
|
2009-05-19 21:23:04 +03:00
|
|
|
//functions bound to buttons
|
2012-04-09 05:53:50 +03:00
|
|
|
void bloadf(); //load game
|
2009-05-19 21:23:04 +03:00
|
|
|
void bsavef(); //save game
|
|
|
|
void bquitf(); //quit game
|
|
|
|
void breturnf(); //return to game
|
2012-04-09 05:53:50 +03:00
|
|
|
void brestartf(); //restart game
|
2009-11-01 03:15:16 +02:00
|
|
|
void bmainmenuf(); //return to main menu
|
|
|
|
|
2012-05-18 20:35:46 +03:00
|
|
|
void selectGameRes();
|
|
|
|
void setGameRes(int index);
|
2012-09-11 17:25:19 +03:00
|
|
|
void closeAndPushEvent(int eventType, int code = 0);
|
2009-05-19 21:23:04 +03:00
|
|
|
|
2012-01-12 18:23:00 +03:00
|
|
|
public:
|
2012-06-15 20:08:19 +03:00
|
|
|
CSystemOptionsWindow(); //c-tor
|
2009-05-19 21:23:04 +03:00
|
|
|
};
|
|
|
|
|
2012-06-15 20:08:19 +03:00
|
|
|
class CTavernWindow : public CWindowObject
|
2009-05-19 21:23:04 +03:00
|
|
|
{
|
|
|
|
public:
|
2009-08-11 19:05:33 +03:00
|
|
|
class HeroPortrait : public CIntObject
|
2009-05-19 21:23:04 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::string hoverName;
|
2014-02-27 00:20:36 +03:00
|
|
|
std::string description; // "XXX is a level Y ZZZ with N artifacts"
|
2009-05-19 21:23:04 +03:00
|
|
|
const CGHeroInstance *h;
|
2010-07-09 02:03:27 +03:00
|
|
|
|
2015-10-12 15:47:10 +02:00
|
|
|
void clickLeft(tribool down, bool previousState) override;
|
|
|
|
void clickRight(tribool down, bool previousState) override;
|
|
|
|
void hover (bool on) override;
|
2009-05-19 21:23:04 +03:00
|
|
|
HeroPortrait(int &sel, int id, int x, int y, const CGHeroInstance *H);
|
|
|
|
|
2011-12-14 00:23:17 +03:00
|
|
|
private:
|
|
|
|
int *_sel;
|
|
|
|
const int _id;
|
|
|
|
|
2010-07-09 02:03:27 +03:00
|
|
|
} *h1, *h2; //recruitable heroes
|
|
|
|
|
|
|
|
CGStatusBar *bar; //tavern's internal status bar
|
2009-05-19 21:23:04 +03:00
|
|
|
int selected;//0 (left) or 1 (right)
|
2009-05-30 19:17:44 +03:00
|
|
|
int oldSelected;//0 (left) or 1 (right)
|
2009-05-19 21:23:04 +03:00
|
|
|
|
2014-08-03 14:16:19 +03:00
|
|
|
CButton *thiefGuild, *cancel, *recruit;
|
2010-07-09 02:03:27 +03:00
|
|
|
const CGObjectInstance *tavernObj;
|
2009-05-19 21:23:04 +03:00
|
|
|
|
2010-07-09 02:03:27 +03:00
|
|
|
CTavernWindow(const CGObjectInstance *TavernObj); //c-tor
|
2009-05-19 21:23:04 +03:00
|
|
|
~CTavernWindow(); //d-tor
|
|
|
|
|
|
|
|
void recruitb();
|
2010-01-31 20:41:22 +02:00
|
|
|
void thievesguildb();
|
2015-10-12 15:47:10 +02:00
|
|
|
void show(SDL_Surface * to) override;
|
2009-05-19 21:23:04 +03:00
|
|
|
};
|
|
|
|
|
2012-06-15 20:08:19 +03:00
|
|
|
class CExchangeWindow : public CWindowObject, public CWindowWithGarrison, public CWindowWithArtifacts
|
2009-06-16 14:18:14 +03:00
|
|
|
{
|
2011-04-30 21:16:58 +03:00
|
|
|
CGStatusBar * ourBar; //internal statusbar
|
2009-06-19 15:10:36 +03:00
|
|
|
|
2014-08-03 14:16:19 +03:00
|
|
|
CButton * quit, * questlogButton[2];
|
2009-06-16 14:18:14 +03:00
|
|
|
|
2009-06-19 15:10:36 +03:00
|
|
|
std::vector<LRClickableAreaWTextComp *> secSkillAreas[2], primSkillAreas;
|
|
|
|
|
2010-02-28 12:01:36 +02:00
|
|
|
MoraleLuckBox *morale[2], *luck[2];
|
2010-02-01 01:30:47 +02:00
|
|
|
|
2013-01-17 21:15:00 +03:00
|
|
|
LRClickableAreaWText *specialty[2];
|
2010-02-01 01:30:47 +02:00
|
|
|
LRClickableAreaWText *experience[2];
|
|
|
|
LRClickableAreaWText *spellPoints[2];
|
2010-07-22 03:32:45 +03:00
|
|
|
CHeroArea *portrait[2];
|
2009-06-26 18:41:19 +03:00
|
|
|
|
2009-06-19 15:10:36 +03:00
|
|
|
public:
|
2009-06-16 14:18:14 +03:00
|
|
|
|
2011-12-14 00:23:17 +03:00
|
|
|
const CGHeroInstance* heroInst[2];
|
2009-06-28 16:49:39 +03:00
|
|
|
CArtifactsOfHero * artifs[2];
|
|
|
|
|
2009-06-19 15:10:36 +03:00
|
|
|
void questlog(int whichHero); //questlog button callback; whichHero: 0 - left, 1 - right
|
|
|
|
|
2009-06-28 16:49:39 +03:00
|
|
|
void prepareBackground(); //prepares or redraws bg
|
|
|
|
|
2013-05-27 13:53:28 +03:00
|
|
|
CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2, QueryID queryID); //c-tor
|
2009-06-16 14:18:14 +03:00
|
|
|
~CExchangeWindow(); //d-tor
|
|
|
|
};
|
2009-05-19 21:23:04 +03:00
|
|
|
|
2011-02-22 13:52:36 +02:00
|
|
|
/// Here you can buy ships
|
2012-06-15 20:08:19 +03:00
|
|
|
class CShipyardWindow : public CWindowObject
|
2009-07-26 06:33:13 +03:00
|
|
|
{
|
|
|
|
public:
|
2011-09-23 18:58:18 +03:00
|
|
|
CGStatusBar *bar;
|
|
|
|
CPicture *bgWater;
|
|
|
|
|
|
|
|
CLabel *title;
|
|
|
|
CLabel *costLabel;
|
|
|
|
|
|
|
|
CAnimImage *woodPic, *goldPic;
|
|
|
|
CLabel *woodCost, *goldCost;
|
|
|
|
|
|
|
|
CAnimImage *bgShip;
|
2014-08-03 14:16:19 +03:00
|
|
|
CButton *build, *quit;
|
2009-07-26 06:33:13 +03:00
|
|
|
|
2011-09-23 18:58:18 +03:00
|
|
|
CGStatusBar * statusBar;
|
2009-07-26 06:33:13 +03:00
|
|
|
|
2013-06-26 14:18:27 +03:00
|
|
|
CShipyardWindow(const std::vector<si32> &cost, int state, int boatType, const std::function<void()> &onBuy);
|
2009-07-26 06:33:13 +03:00
|
|
|
};
|
2009-05-19 21:23:04 +03:00
|
|
|
|
2011-02-22 13:52:36 +02:00
|
|
|
/// Puzzle screen which gets uncovered when you visit obilisks
|
2012-06-15 20:08:19 +03:00
|
|
|
class CPuzzleWindow : public CWindowObject
|
2009-08-31 18:57:15 +03:00
|
|
|
{
|
|
|
|
private:
|
2012-06-15 20:08:19 +03:00
|
|
|
int3 grailPos;
|
|
|
|
|
2014-08-03 14:16:19 +03:00
|
|
|
CButton * quitb;
|
2009-08-31 18:57:15 +03:00
|
|
|
|
2012-06-15 20:08:19 +03:00
|
|
|
std::vector<CPicture * > piecesToRemove;
|
|
|
|
ui8 currentAlpha;
|
2009-08-31 18:57:15 +03:00
|
|
|
|
|
|
|
public:
|
2015-10-12 15:47:10 +02:00
|
|
|
void showAll(SDL_Surface * to) override;
|
|
|
|
void show(SDL_Surface * to) override;
|
2009-08-31 18:57:15 +03:00
|
|
|
|
2011-12-14 00:23:17 +03:00
|
|
|
CPuzzleWindow(const int3 &grailPos, double discoveredRatio);
|
2009-08-31 18:57:15 +03:00
|
|
|
};
|
|
|
|
|
2011-02-22 13:52:36 +02:00
|
|
|
/// Creature transformer window
|
2012-06-17 01:40:28 +03:00
|
|
|
class CTransformerWindow : public CWindowObject, public CGarrisonHolder
|
2010-07-03 15:00:53 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
class CItem : public CIntObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int id;//position of creature in hero army
|
|
|
|
bool left;//position of the item
|
|
|
|
int size; //size of creature stack
|
|
|
|
CTransformerWindow * parent;
|
2012-05-13 18:04:21 +03:00
|
|
|
CAnimImage *icon;
|
2010-07-03 15:00:53 +03:00
|
|
|
|
|
|
|
void move();
|
2015-10-12 15:47:10 +02:00
|
|
|
void clickLeft(tribool down, bool previousState) override;
|
2012-06-17 01:40:28 +03:00
|
|
|
void update();
|
2012-09-26 16:13:39 +03:00
|
|
|
CItem(CTransformerWindow * parent, int size, int id);
|
2010-07-03 15:00:53 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
const CArmedInstance *army;//object with army for transforming (hero or town)
|
|
|
|
const CGHeroInstance *hero;//only if we have hero in town
|
2013-06-26 14:18:27 +03:00
|
|
|
const CGTownInstance *town;//market, town garrison is used if hero == nullptr
|
2010-07-03 15:00:53 +03:00
|
|
|
std::vector<CItem*> items;
|
|
|
|
|
2014-08-03 14:16:19 +03:00
|
|
|
CButton *all, *convert, *cancel;
|
2010-07-07 05:29:07 +03:00
|
|
|
CGStatusBar *bar;
|
2010-07-03 15:00:53 +03:00
|
|
|
void makeDeal();
|
|
|
|
void addAll();
|
2015-10-12 15:47:10 +02:00
|
|
|
void updateGarrisons() override;
|
2010-07-03 15:00:53 +03:00
|
|
|
CTransformerWindow(const CGHeroInstance * _hero, const CGTownInstance * _town); //c-tor
|
|
|
|
};
|
|
|
|
|
2012-06-15 20:08:19 +03:00
|
|
|
class CUniversityWindow : public CWindowObject
|
2010-07-20 17:08:13 +03:00
|
|
|
{
|
2012-05-13 18:04:21 +03:00
|
|
|
class CItem : public CAnimImage
|
2010-07-20 17:08:13 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
int ID;//id of selected skill
|
|
|
|
CUniversityWindow * parent;
|
2010-11-15 17:15:00 +02:00
|
|
|
|
2015-10-12 15:47:10 +02:00
|
|
|
void showAll(SDL_Surface * to) override;
|
|
|
|
void clickLeft(tribool down, bool previousState) override;
|
|
|
|
void clickRight(tribool down, bool previousState) override;
|
|
|
|
void hover(bool on) override;
|
2010-07-20 17:08:13 +03:00
|
|
|
int state();//0=can't learn, 1=learned, 2=can learn
|
|
|
|
CItem(CUniversityWindow * _parent, int _ID, int X, int Y);
|
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
const CGHeroInstance *hero;
|
|
|
|
const IMarket * market;
|
2010-11-15 17:15:00 +02:00
|
|
|
|
2010-08-06 16:14:10 +03:00
|
|
|
CPicture * green, * yellow, * red;//colored bars near skills
|
2010-07-20 17:08:13 +03:00
|
|
|
std::vector<CItem*> items;
|
|
|
|
|
2014-08-03 14:16:19 +03:00
|
|
|
CButton *cancel;
|
2010-07-20 17:08:13 +03:00
|
|
|
CGStatusBar *bar;
|
2010-11-15 17:15:00 +02:00
|
|
|
|
2010-07-20 17:08:13 +03:00
|
|
|
CUniversityWindow(const CGHeroInstance * _hero, const IMarket * _market); //c-tor
|
|
|
|
};
|
|
|
|
|
2011-02-22 13:52:36 +02:00
|
|
|
/// Confirmation window for University
|
2012-06-15 20:08:19 +03:00
|
|
|
class CUnivConfirmWindow : public CWindowObject
|
2010-07-20 17:08:13 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
CUniversityWindow * parent;
|
|
|
|
CGStatusBar *bar;
|
2014-08-03 14:16:19 +03:00
|
|
|
CButton *confirm, *cancel;
|
2010-07-20 17:08:13 +03:00
|
|
|
|
|
|
|
CUnivConfirmWindow(CUniversityWindow * PARENT, int SKILL, bool available); //c-tor
|
|
|
|
void makeDeal(int skill);
|
|
|
|
};
|
|
|
|
|
2011-02-22 13:52:36 +02:00
|
|
|
/// Hill fort is the building where you can upgrade units
|
2012-06-15 20:08:19 +03:00
|
|
|
class CHillFortWindow : public CWindowObject, public CWindowWithGarrison
|
2010-07-22 03:32:45 +03:00
|
|
|
{
|
2016-10-16 06:51:07 +02:00
|
|
|
private:
|
|
|
|
static const int slotsCount = 7;
|
|
|
|
//todo: mithril support
|
|
|
|
static const int resCount = 7;
|
2010-07-22 03:32:45 +03:00
|
|
|
|
|
|
|
const CGObjectInstance * fort;
|
|
|
|
const CGHeroInstance * hero;
|
|
|
|
|
2016-10-16 06:51:07 +02:00
|
|
|
CGStatusBar * bar;
|
|
|
|
CHeroArea * heroPic;//clickable hero image
|
|
|
|
CButton * quit;//closes window
|
|
|
|
CButton * upgradeAll;//upgrade all creatures
|
|
|
|
|
|
|
|
std::array<CButton *, slotsCount> upgrade;//upgrade single creature
|
|
|
|
std::array<int, slotsCount + 1> currState;//current state of slot - to avoid calls to getState or updating buttons
|
|
|
|
|
|
|
|
//there is a place for only 2 resources per slot
|
|
|
|
std::array< std::array<CAnimImage *, 2>, slotsCount> slotIcons;
|
|
|
|
std::array< std::array<CLabel *, 2>, slotsCount> slotLabels;
|
|
|
|
|
|
|
|
std::array<CAnimImage *, resCount> totalIcons;
|
|
|
|
std::array<CLabel *, resCount> totalLabels;
|
2010-11-15 17:15:00 +02:00
|
|
|
|
2013-02-16 17:03:47 +03:00
|
|
|
std::string getDefForSlot(SlotID slot);//return def name for this slot
|
|
|
|
std::string getTextForSlot(SlotID slot);//return hover text for this slot
|
|
|
|
void makeDeal(SlotID slot);//-1 for upgrading all creatures
|
|
|
|
int getState(SlotID slot); //-1 = no creature 0=can't upgrade, 1=upgraded, 2=can upgrade
|
2016-10-16 06:51:07 +02:00
|
|
|
public:
|
|
|
|
CHillFortWindow(const CGHeroInstance * visitor, const CGObjectInstance * object); //c-tor
|
2015-10-12 15:47:10 +02:00
|
|
|
void updateGarrisons() override;//update buttons after garrison changes
|
2010-07-22 03:32:45 +03:00
|
|
|
};
|
|
|
|
|
2012-06-15 20:08:19 +03:00
|
|
|
class CThievesGuildWindow : public CWindowObject
|
2010-01-31 20:41:22 +02:00
|
|
|
{
|
2010-02-01 19:51:33 +02:00
|
|
|
const CGObjectInstance * owner;
|
|
|
|
|
2010-07-09 02:03:27 +03:00
|
|
|
CGStatusBar * statusBar;
|
2014-08-03 14:16:19 +03:00
|
|
|
CButton * exitb;
|
2010-02-04 20:40:40 +02:00
|
|
|
CMinorResDataBar * resdatabar;
|
2010-01-31 20:41:22 +02:00
|
|
|
|
|
|
|
public:
|
2010-02-01 19:51:33 +02:00
|
|
|
CThievesGuildWindow(const CGObjectInstance * _owner);
|
2010-01-31 20:41:22 +02:00
|
|
|
};
|