2010-01-25 23:25:14 +02:00
|
|
|
#ifndef __CKINGDOMINTERFACE_H__
|
|
|
|
#define __CKINGDOMINTERFACE_H__
|
|
|
|
|
|
|
|
|
|
|
|
#include "../global.h"
|
2010-02-01 01:30:47 +02:00
|
|
|
#include "GUIBase.h"
|
2010-01-30 21:08:26 +02:00
|
|
|
#include "GUIClasses.h"
|
2010-12-20 23:22:53 +02:00
|
|
|
#include "CMusicBase.h"
|
2010-01-26 13:56:29 +02:00
|
|
|
class AdventureMapButton;
|
2010-01-25 23:25:14 +02:00
|
|
|
class CHighlightableButtonsGroup;
|
|
|
|
class CResDataBar;
|
2010-01-26 13:56:29 +02:00
|
|
|
class CStatusBar;
|
2010-01-25 23:25:14 +02:00
|
|
|
class CSlider;
|
|
|
|
class CMinorResDataBar;
|
2010-01-28 18:15:46 +02:00
|
|
|
class HoverableArea;
|
2010-02-28 12:01:36 +02:00
|
|
|
class MoraleLuckBox;
|
2010-01-25 23:25:14 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* CKingdomInterface.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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-07-22 03:32:45 +03:00
|
|
|
class CKingdomInterface : public CGarrisonHolder
|
2010-02-01 01:30:47 +02:00
|
|
|
{
|
2010-02-01 01:22:25 +02:00
|
|
|
class CTownItem : public CWindowWithGarrison
|
2010-02-01 01:30:47 +02:00
|
|
|
{
|
2010-02-01 01:22:25 +02:00
|
|
|
class CCreaPlace: public LRClickableAreaWTextComp
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
const CGTownInstance * town;
|
|
|
|
CCreaPlace(); //c-tor
|
|
|
|
void clickLeft(tribool down, bool previousState);
|
|
|
|
void clickRight(tribool down, bool previousState);
|
|
|
|
void activate();
|
|
|
|
void deactivate();
|
2010-02-01 01:30:47 +02:00
|
|
|
};
|
|
|
|
public:
|
|
|
|
const CGTownInstance * town;
|
2010-07-22 03:32:45 +03:00
|
|
|
CKingdomInterface * parent;
|
2010-02-01 01:30:47 +02:00
|
|
|
int numb;//position on screen (1..size)
|
2010-02-28 12:01:36 +02:00
|
|
|
HoverableArea *incomeArea;//hoverable text for town hall, fort, income
|
2010-07-22 03:32:45 +03:00
|
|
|
CHeroArea * garrHero, *visitHero;//portraits of heroes
|
2010-02-28 12:01:36 +02:00
|
|
|
LRClickableAreaOpenTown *hallArea, *fortArea, * townImage;//town image
|
2010-02-01 01:30:47 +02:00
|
|
|
std::vector < HoverableArea * > creaGrowth;
|
|
|
|
std::vector < CCreaPlace * > creaCount;
|
2010-01-30 21:08:26 +02:00
|
|
|
void setTown(const CGTownInstance * newTown);//change town and update info
|
2010-02-01 01:30:47 +02:00
|
|
|
void showAll(SDL_Surface * to);
|
2010-01-25 23:25:14 +02:00
|
|
|
void activate();
|
2010-02-01 01:30:47 +02:00
|
|
|
void deactivate();
|
2010-01-30 21:08:26 +02:00
|
|
|
CTownItem (int num, CKingdomInterface * Owner);//c-tor
|
2010-01-26 13:56:29 +02:00
|
|
|
~CTownItem();//d-tor
|
|
|
|
};
|
2010-02-01 01:30:47 +02:00
|
|
|
class CHeroItem : public CWindowWithGarrison
|
|
|
|
{
|
2010-01-30 21:08:26 +02:00
|
|
|
class CArtPlace: public LRClickableAreaWTextComp
|
|
|
|
{
|
|
|
|
public:
|
2010-07-22 03:32:45 +03:00
|
|
|
CHeroItem * parent;
|
2010-12-17 00:32:53 +02:00
|
|
|
CArtPlace(CHeroItem * owner, const Rect &r = Rect(0, 0, 44, 44)); //c-tor
|
2010-01-30 21:08:26 +02:00
|
|
|
void clickLeft(tribool down, bool previousState);
|
|
|
|
void clickRight(tribool down, bool previousState);
|
|
|
|
void activate();
|
|
|
|
void deactivate();
|
2010-02-01 01:30:47 +02:00
|
|
|
};
|
2010-02-04 17:50:59 +02:00
|
|
|
|
|
|
|
public:
|
2010-02-01 01:30:47 +02:00
|
|
|
const CGHeroInstance * hero;
|
2010-07-22 03:32:45 +03:00
|
|
|
CKingdomInterface * parent;
|
2010-02-01 01:30:47 +02:00
|
|
|
int artGroup,numb;//current art group (0 = equiped, 1 = misc, 2 = backpack)
|
|
|
|
int backpackPos;//first visible artifact in backpack
|
|
|
|
AdventureMapButton * artLeft, * artRight;//buttons for backpack
|
2010-07-22 03:32:45 +03:00
|
|
|
CHeroArea * portrait;
|
2010-02-01 01:30:47 +02:00
|
|
|
LRClickableAreaWText * experience;
|
2010-02-28 12:01:36 +02:00
|
|
|
MoraleLuckBox * morale, * luck;
|
2010-02-01 01:30:47 +02:00
|
|
|
LRClickableAreaWText * spellPoints;
|
|
|
|
LRClickableAreaWText * speciality;
|
|
|
|
std::vector<LRClickableAreaWTextComp *> primarySkills;
|
|
|
|
std::vector<LRClickableAreaWTextComp *> secondarySkills;
|
|
|
|
std::vector<LRClickableAreaWTextComp *> artifacts;
|
|
|
|
std::vector<LRClickableAreaWTextComp *> backpack;
|
|
|
|
CHighlightableButtonsGroup * artButtons;
|
|
|
|
void setHero(const CGHeroInstance * newHero);//change hero and update info
|
2010-01-30 21:08:26 +02:00
|
|
|
void scrollArts(int move);//moving backpack, receiving distance
|
2010-01-26 13:56:29 +02:00
|
|
|
void onArtChange(int newstate);//changes artgroup
|
2010-02-01 01:30:47 +02:00
|
|
|
void showAll(SDL_Surface * to);
|
2010-01-25 23:25:14 +02:00
|
|
|
void activate();
|
2010-01-26 13:56:29 +02:00
|
|
|
void deactivate();
|
2010-01-30 21:08:26 +02:00
|
|
|
CHeroItem (int num, CKingdomInterface * Owner);//c-tor
|
2010-02-01 01:30:47 +02:00
|
|
|
~CHeroItem();//d-tor
|
2010-01-25 23:25:14 +02:00
|
|
|
};
|
2010-01-26 13:56:29 +02:00
|
|
|
public:
|
|
|
|
//common data
|
2010-01-28 18:15:46 +02:00
|
|
|
int state;//1 = towns showed, 2 = heroes;
|
2010-01-25 23:25:14 +02:00
|
|
|
SDL_Surface * bg;//background
|
|
|
|
CStatusBar * statusbar;//statusbar
|
2010-02-01 01:30:47 +02:00
|
|
|
CResDataBar *resdatabar;//resources
|
2010-01-30 21:08:26 +02:00
|
|
|
int size,PicCount;
|
2010-01-26 13:56:29 +02:00
|
|
|
|
2010-01-28 18:15:46 +02:00
|
|
|
//buttons
|
2010-01-25 23:25:14 +02:00
|
|
|
AdventureMapButton *exit;//exit button
|
2010-01-26 13:56:29 +02:00
|
|
|
AdventureMapButton *toTowns;//town button
|
|
|
|
AdventureMapButton *toHeroes;//hero button
|
2010-01-25 23:25:14 +02:00
|
|
|
CDefEssential * title; //title bar
|
2010-01-28 18:15:46 +02:00
|
|
|
|
2010-01-26 13:56:29 +02:00
|
|
|
//hero/town lists
|
|
|
|
CSlider * slider;//slider
|
2010-01-28 18:15:46 +02:00
|
|
|
bool showHarrisoned;//show harrisoned hero in heroes list or not, disabled by default
|
|
|
|
int heroPos,townPos;//position of lists
|
2010-01-26 13:56:29 +02:00
|
|
|
std::vector<CHeroItem *> heroes;//heroes list
|
|
|
|
std::vector<CTownItem *> towns;//towns list
|
2010-07-22 03:32:45 +03:00
|
|
|
CDefEssential * slots, *fort, *hall;
|
2010-01-26 13:56:29 +02:00
|
|
|
|
2010-01-28 18:15:46 +02:00
|
|
|
//objects list
|
|
|
|
int objSize, objPos;
|
|
|
|
CDefEssential *objPics;
|
2010-12-17 20:47:07 +02:00
|
|
|
std::map<int,std::pair<int, const std::string*> > objList; //dwelling ID, count, hover text
|
2010-01-28 18:15:46 +02:00
|
|
|
std::vector <HoverableArea* > ObjList;//list of dwellings
|
|
|
|
AdventureMapButton* ObjUp, *ObjDown, *ObjTop, *ObjBottom;//buttons for dwellings list
|
|
|
|
|
2010-01-26 13:56:29 +02:00
|
|
|
//income pics
|
2010-02-01 01:30:47 +02:00
|
|
|
std::vector<HoverableArea*> incomes;//mines + incomes
|
|
|
|
std::vector<int> incomesVal;//values to print
|
2010-02-01 01:22:25 +02:00
|
|
|
CDefEssential * mines;
|
2010-01-25 23:25:14 +02:00
|
|
|
|
|
|
|
CKingdomInterface(); //c-tor
|
2010-01-26 13:56:29 +02:00
|
|
|
~CKingdomInterface(); //d-tor
|
2010-07-22 03:32:45 +03:00
|
|
|
void updateGarrisons();//garrison updater
|
2010-01-28 18:15:46 +02:00
|
|
|
void moveObjectList(int newPos);
|
2010-01-26 13:56:29 +02:00
|
|
|
void recreateHeroList(int pos);//recreating heroes list (on slider move)
|
2010-01-25 23:25:14 +02:00
|
|
|
void recreateTownList(int pos);//same for town list
|
2010-01-26 13:56:29 +02:00
|
|
|
void listToTowns();//changing list to town view
|
|
|
|
void listToHeroes();//changing list to heroes view
|
2010-01-25 23:25:14 +02:00
|
|
|
void sliderMoved(int newpos);//when we move a slider...
|
|
|
|
void show(SDL_Surface * to);
|
|
|
|
void showAll(SDL_Surface * to);
|
|
|
|
void close();
|
|
|
|
void activate();
|
|
|
|
void deactivate();
|
2010-01-26 13:56:29 +02:00
|
|
|
};
|
2010-01-25 23:25:14 +02:00
|
|
|
|
|
|
|
#endif // __CCASTLEINTERFACE_H__
|