GUIClasses.h 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209
  1. #ifndef __GUICLASSES_H__
  2. #define __GUICLASSES_H__
  3. #include "../global.h"
  4. #include "GUIBase.h"
  5. #include "FunctionList.h"
  6. #include <set>
  7. #include <list>
  8. #include <boost/thread/mutex.hpp>
  9. #ifdef max
  10. #undef max
  11. #endif
  12. #ifdef min
  13. #undef min
  14. #endif
  15. /*
  16. * GUIClasses.h, part of VCMI engine
  17. *
  18. * Authors: listed in file AUTHORS in main folder
  19. *
  20. * License: GNU General Public License v2.0 or later
  21. * Full text of license available in license.txt file, in main folder
  22. *
  23. */
  24. struct ArtifactLocation;
  25. class CStackBasicDescriptor;
  26. class CBonusSystemNode;
  27. class CArtifact;
  28. class CDefEssential;
  29. class AdventureMapButton;
  30. class CHighlightableButtonsGroup;
  31. class CDefHandler;
  32. struct HeroMoveDetails;
  33. class CDefEssential;
  34. class CGHeroInstance;
  35. class CAdvMapInt;
  36. class CCastleInterface;
  37. class CBattleInterface;
  38. class CStack;
  39. class SComponent;
  40. class CCreature;
  41. struct SDL_Surface;
  42. struct CPath;
  43. class CCreatureAnim;
  44. class CSelectableComponent;
  45. class CCreatureSet;
  46. class CGObjectInstance;
  47. class CGDwelling;
  48. class CSlider;
  49. struct UpgradeInfo;
  50. template <typename T> struct CondSh;
  51. class CInGameConsole;
  52. class CGarrisonInt;
  53. class CInGameConsole;
  54. struct Component;
  55. class CArmedInstance;
  56. class CGTownInstance;
  57. class StackState;
  58. class CPlayerInterface;
  59. class CHeroWindow;
  60. class CArtifact;
  61. class CArtifactsOfHero;
  62. class CResDataBar;
  63. struct SPuzzleInfo;
  64. class CGGarrison;
  65. class CStackInstance;
  66. class IMarket;
  67. class CTextBox;
  68. class CArtifactInstance;
  69. extern SDL_Color tytulowy, tlo, zwykly ;
  70. class CInfoWindow : public CSimpleWindow //text + comp. + ok button
  71. { //window able to delete its components when closed
  72. bool delComps; //whether comps will be deleted
  73. public:
  74. int ID; //for identification
  75. CTextBox *text;
  76. std::vector<AdventureMapButton *> buttons;
  77. std::vector<SComponent*> components;
  78. CSlider *slider;
  79. void setDelComps(bool DelComps);
  80. virtual void close();
  81. void show(SDL_Surface * to);
  82. void showAll(SDL_Surface * to);
  83. void sliderMoved(int to);
  84. CInfoWindow(std::string Text, int player, const std::vector<SComponent*> &comps, std::vector<std::pair<std::string,CFunctionList<void()> > > &Buttons, bool delComps); //c-tor
  85. CInfoWindow(); //c-tor
  86. ~CInfoWindow(); //d-tor
  87. static void showYesNoDialog( const std::string & text, const std::vector<SComponent*> *components, const CFunctionList<void( ) > &onYes, const CFunctionList<void()> &onNo, bool DelComps = true, int player = 1); //use only before the game starts! (showYesNoDialog in LOCPLINT must be used then)
  88. static CInfoWindow *create(const std::string &text, int playerID = 1, const std::vector<SComponent*> *components = NULL, bool DelComps = false);
  89. };
  90. class CSelWindow : public CInfoWindow //component selection window
  91. { //warning - this window deletes its components by closing!
  92. public:
  93. void selectionChange(unsigned to);
  94. void madeChoice(); //looks for selected component and calls callback
  95. CSelWindow(const std::string& text, int player, int charperline ,const std::vector<CSelectableComponent*> &comps, const std::vector<std::pair<std::string,CFunctionList<void()> > > &Buttons, int askID); //c-tor
  96. CSelWindow(){}; //c-tor
  97. //notification - this class inherits important destructor from CInfoWindow
  98. };
  99. class CRClickPopup : public CIntObject //popup displayed on R-click
  100. {
  101. public:
  102. virtual void activate();
  103. virtual void deactivate();
  104. virtual void close();
  105. void clickRight(tribool down, bool previousState);
  106. CRClickPopup();
  107. virtual ~CRClickPopup(); //d-tor
  108. static void createAndPush(const std::string &txt);
  109. static void createAndPush(const CGObjectInstance *obj, const Point &p, EAlignment alignment = BOTTOMRIGHT);
  110. };
  111. class CRClickPopupInt : public CRClickPopup //popup displayed on R-click
  112. {
  113. public:
  114. IShowActivable *inner;
  115. bool delInner;
  116. void show(SDL_Surface * to);
  117. void showAll(SDL_Surface * to);
  118. CRClickPopupInt(IShowActivable *our, bool deleteInt); //c-tor
  119. virtual ~CRClickPopupInt(); //d-tor
  120. };
  121. class CInfoPopup : public CRClickPopup
  122. {
  123. public:
  124. bool free; //TODO: comment me
  125. SDL_Surface * bitmap; //popup background
  126. void close();
  127. void show(SDL_Surface * to);
  128. CInfoPopup(SDL_Surface * Bitmap, int x, int y, bool Free=false); //c-tor
  129. CInfoPopup(SDL_Surface * Bitmap, const Point &p, EAlignment alignment, bool Free=false); //c-tor
  130. CInfoPopup(SDL_Surface *Bitmap = NULL, bool Free = false); //default c-tor
  131. void init(int x, int y);
  132. ~CInfoPopup(); //d-tor
  133. };
  134. class SComponent : public virtual CIntObject //common popup window component
  135. {
  136. public:
  137. enum Etype
  138. {
  139. primskill, secskill, resource, creature, artifact, experience, secskill44, spell, morale, luck, building, hero, flag
  140. } type; //component type
  141. int subtype; //TODO: comment me
  142. int val; //TODO: comment me
  143. std::string description; //r-click
  144. std::string subtitle; //TODO: comment me
  145. SDL_Surface *img; //our image
  146. bool free; //should surface be freed on delete
  147. SDL_Surface * setSurface(std::string defName, int imgPos);
  148. void init(Etype Type, int Subtype, int Val);
  149. SComponent(Etype Type, int Subtype, int Val, SDL_Surface *sur=NULL, bool freeSur=false); //c-tor
  150. SComponent(const Component &c); //c-tor
  151. SComponent();; //c-tor
  152. virtual ~SComponent(); //d-tor
  153. void clickRight(tribool down, bool previousState); //call-in
  154. SDL_Surface * getImg();
  155. virtual void show(SDL_Surface * to);
  156. virtual void activate();
  157. virtual void deactivate();
  158. };
  159. class CSelectableComponent : public SComponent, public KeyShortcut
  160. {
  161. public:
  162. bool selected; //if true, this component is selected
  163. boost::function<void()> onSelect; //function called on selection change
  164. void clickLeft(tribool down, bool previousState); //call-in
  165. void init();
  166. CSelectableComponent(Etype Type, int Sub, int Val, boost::function<void()> OnSelect = 0); //c-tor
  167. CSelectableComponent(const Component &c, boost::function<void()> OnSelect = 0); //c-tor
  168. ~CSelectableComponent(); //d-tor
  169. virtual void show(SDL_Surface * to);
  170. void activate();
  171. void deactivate();
  172. void select(bool on);
  173. };
  174. class CGarrisonInt;
  175. class CGarrisonSlot : public CIntObject
  176. {
  177. public:
  178. int ID; //for identification
  179. CGarrisonInt *owner;
  180. const CStackInstance *myStack; //NULL if slot is empty
  181. const CCreature *creature;
  182. int count; //number of creatures
  183. int upg; //0 - up garrison, 1 - down garrison
  184. bool active; //TODO: comment me
  185. virtual void hover (bool on); //call-in
  186. const CArmedInstance * getObj();
  187. bool our();
  188. void clickRight(tribool down, bool previousState);
  189. void clickLeft(tribool down, bool previousState);
  190. void activate();
  191. void deactivate();
  192. void showAll(SDL_Surface * to);
  193. CGarrisonSlot(CGarrisonInt *Owner, int x, int y, int IID, int Upg=0, const CStackInstance * Creature=NULL);
  194. ~CGarrisonSlot(); //d-tor
  195. };
  196. class CGarrisonInt :public CIntObject
  197. {
  198. public:
  199. int interx; //space between slots
  200. Point garOffset, //offset between garrisons (not used if only one hero)
  201. surOffset; //offset between garrison position on the bg surface and position on the screen
  202. CGarrisonSlot *highlighted; //chosen slot
  203. std::vector<AdventureMapButton *> splitButtons; //may be empty if no buttons
  204. SDL_Surface *&sur; //bg surface
  205. int p2, //TODO: comment me
  206. shiftPos;//1st slot of the second row, set shiftPoint for effect
  207. bool splitting, pb,
  208. smallIcons, //true - 32x32 imgs, false - 58x64
  209. removableUnits,//player can remove units from up
  210. twoRows,//slots will be placed in 2 rows
  211. owned[2];//player owns up or down army [0] upper, [1] lower
  212. // const CCreatureSet *set1; //top set of creatures
  213. // const CCreatureSet *set2; //bottom set of creatures
  214. std::vector<CGarrisonSlot*> slotsUp, slotsDown; //slots of upper and lower garrison
  215. const CArmedInstance *armedObjs[2]; //[0] is upper, [1] is down
  216. //const CArmedInstance *oup, *odown; //upper and lower garrisons (heroes or towns)
  217. void setArmy(const CArmedInstance *army, bool bottomGarrison);
  218. void addSplitBtn(AdventureMapButton * button);
  219. void createSet(std::vector<CGarrisonSlot*> &ret, const CCreatureSet * set, int posX, int distance, int posY, int Upg );
  220. void activate();
  221. void createSlots();
  222. void deleteSlots();
  223. void recreateSlots();
  224. void splitClick(); //handles click on split button
  225. void splitStacks(int am2); //TODO: comment me
  226. //x, y - position; inx - distance between slots; pomsur - background surface, SurOffset - ?; s1, s2 - top and bottom armies; removableUnits - you can take units from top; smallImgs - units images size 64x58 or 32x32; twoRows - display slots in 2 row (1st row = 4, 2nd = 3)
  227. CGarrisonInt(int x, int y, int inx, const Point &garsOffset, SDL_Surface *&pomsur, const Point &SurOffset, const CArmedInstance *s1, const CArmedInstance *s2=NULL, bool _removableUnits = true, bool smallImgs = false, bool _twoRows=false); //c-tor
  228. ~CGarrisonInt(); //d-tor
  229. };
  230. class CStatusBar
  231. : public CIntObject, public IStatusBar
  232. {
  233. public:
  234. SDL_Surface * bg; //background
  235. int middlex, middley; //middle of statusbar
  236. std::string current; //text currently printed
  237. CStatusBar(int x, int y, std::string name="ADROLLVR.bmp", int maxw=-1); //c-tor
  238. ~CStatusBar(); //d-tor
  239. void print(const std::string & text); //prints text and refreshes statusbar
  240. void clear();//clears statusbar and refreshes
  241. void show(SDL_Surface * to); //shows statusbar (with current text)
  242. std::string getCurrent(); //getter for current
  243. };
  244. class CLabel
  245. : public virtual CIntObject
  246. {
  247. public:
  248. EAlignment alignment;
  249. EFonts font;
  250. SDL_Color color;
  251. std::string text;
  252. CPicture *bg;
  253. bool autoRedraw; //whether control will redraw itself on setTxt
  254. Point textOffset; //text will be blitted at pos + textOffset with appropriate alignment
  255. bool ignoreLeadingWhitespace;
  256. virtual void setTxt(const std::string &Txt);
  257. void showAll(SDL_Surface * to); //shows statusbar (with current text)
  258. CLabel(int x=0, int y=0, EFonts Font = FONT_SMALL, EAlignment Align = TOPLEFT, const SDL_Color &Color = zwykly, const std::string &Text = "");
  259. };
  260. //a multi-line label that tries to fit text with given available width and height; if not possible, it creates a slider for scrolling text
  261. class CTextBox
  262. : public CLabel
  263. {
  264. public:
  265. int maxW; //longest line of text in px
  266. int maxH; //total height needed to print all lines
  267. int sliderStyle;
  268. bool redrawParentOnScrolling;
  269. std::vector<std::string> lines;
  270. CSlider *slider;
  271. //CTextBox( std::string Text, const Point &Pos, int w, int h, EFonts Font = FONT_SMALL, EAlignment Align = TOPLEFT, const SDL_Color &Color = zwykly);
  272. CTextBox(std::string Text, const Rect &rect, int SliderStyle, EFonts Font = FONT_SMALL, EAlignment Align = TOPLEFT, const SDL_Color &Color = zwykly);
  273. void showAll(SDL_Surface * to); //shows statusbar (with current text)
  274. void setTxt(const std::string &Txt);
  275. void setBounds(int limitW, int limitH);
  276. void recalculateLines(const std::string &Txt);
  277. void sliderMoved(int to);
  278. };
  279. class CGStatusBar
  280. : public CLabel, public IStatusBar
  281. {
  282. void init();
  283. public:
  284. IStatusBar *oldStatusBar;
  285. //statusbar interface overloads
  286. void print(const std::string & Text); //prints text and refreshes statusbar
  287. void clear();//clears statusbar and refreshes
  288. std::string getCurrent(); //returns currently displayed text
  289. void show(SDL_Surface * to); //shows statusbar (with current text)
  290. CGStatusBar(int x, int y, EFonts Font = FONT_SMALL, EAlignment Align = CENTER, const SDL_Color &Color = zwykly, const std::string &Text = "");
  291. CGStatusBar(CPicture *BG, EFonts Font = FONT_SMALL, EAlignment Align = CENTER, const SDL_Color &Color = zwykly); //given CPicture will be captured by created sbar and it's pos will be used as pos for sbar
  292. CGStatusBar(int x, int y, std::string name, int maxw=-1);
  293. ~CGStatusBar();
  294. void calcOffset();
  295. };
  296. class CFocusable
  297. : public virtual CIntObject
  298. {
  299. public:
  300. bool focus; //only one focusable control can have focus at one moment
  301. void giveFocus(); //captures focus
  302. void moveFocus(); //moves focus to next active control (may be used for tab switching)
  303. static std::list<CFocusable*> focusables; //all existing objs
  304. static CFocusable *inputWithFocus; //who has focus now
  305. CFocusable();
  306. ~CFocusable();
  307. };
  308. class CTextInput
  309. : public CLabel, public CFocusable
  310. {
  311. public:
  312. CFunctionList<void(const std::string &)> cb;
  313. void setText(const std::string &nText, bool callCb = false);
  314. CTextInput(const Rect &Pos, const Point &bgOffset, const std::string &bgName, const CFunctionList<void(const std::string &)> &CB);
  315. CTextInput(const Rect &Pos, SDL_Surface *srf = NULL);
  316. ~CTextInput();
  317. void showAll(SDL_Surface * to);
  318. void clickLeft(tribool down, bool previousState);
  319. void keyPressed(const SDL_KeyboardEvent & key);
  320. };
  321. class CList : public CIntObject
  322. {
  323. public:
  324. SDL_Surface * bg; //background bitmap
  325. CDefHandler *arrup, *arrdo; //button arrows for scrolling list
  326. SDL_Surface *empty, *selection;
  327. SDL_Rect arrupp, arrdop; //positions of arrows
  328. int posw, posh; //position width/height
  329. int selected, //id of selected position, <0 if none
  330. from;
  331. const int SIZE; //size of list
  332. tribool pressed; //true=up; false=down; indeterminate=none
  333. CList(int Size = 5); //c-tor
  334. void clickLeft(tribool down, bool previousState);
  335. void activate();
  336. void deactivate();
  337. virtual void mouseMoved (const SDL_MouseMotionEvent & sEvent)=0; //call-in
  338. virtual void genList()=0;
  339. virtual void select(int which)=0;
  340. virtual void draw(SDL_Surface * to)=0;
  341. virtual int size() = 0; //how many elements do we have
  342. void fixPos(); //scrolls list, so the selection will be visible
  343. };
  344. class CHeroList
  345. : public CList
  346. {
  347. public:
  348. CDefHandler *mobile, *mana; //mana and movement indicators
  349. int posmobx, posporx, posmanx, posmoby, pospory, posmany;
  350. CHeroList(int Size); //c-tor
  351. int getPosOfHero(const CGHeroInstance* h); //hero's position on list
  352. void genList();
  353. void select(int which); //call-in
  354. void mouseMoved (const SDL_MouseMotionEvent & sEvent); //call-in
  355. void clickLeft(tribool down, bool previousState); //call-in
  356. void clickRight(tribool down, bool previousState); //call-in
  357. void hover (bool on); //call-in
  358. void keyPressed (const SDL_KeyboardEvent & key); //call-in
  359. void updateHList(const CGHeroInstance *toRemove=NULL); //removes specific hero from the list or recreates it
  360. void updateMove(const CGHeroInstance* which); //draws move points bar
  361. void draw(SDL_Surface * to);
  362. void show(SDL_Surface * to);
  363. void init();
  364. int size(); //how many elements do we have
  365. };
  366. class CTownList
  367. : public CList
  368. {
  369. public:
  370. boost::function<void()> fun; //function called on selection change
  371. int posporx,pospory;
  372. CTownList(int Size, int x, int y, std::string arrupg, std::string arrdog); //c-tor
  373. ~CTownList(); //d-tor
  374. void genList();
  375. void select(int which); //call-in
  376. void mouseMoved (const SDL_MouseMotionEvent & sEvent); //call-in
  377. void clickLeft(tribool down, bool previousState); //call-in
  378. void clickRight(tribool down, bool previousState); //call-in
  379. void hover (bool on); //call-in
  380. void keyPressed (const SDL_KeyboardEvent & key); //call-in
  381. void draw(SDL_Surface * to);
  382. void show(SDL_Surface * to);
  383. int size(); //how many elements do we have
  384. };
  385. class CCreaturePic : public CIntObject //draws picture with creature on background, use Animated=true to get animation
  386. {
  387. private:
  388. CPicture *bg; //background
  389. CCreatureAnim *anim; //displayed animation
  390. public:
  391. CCreaturePic(int x, int y, const CCreature *cre, bool Big=true, bool Animated=true); //c-tor
  392. ~CCreaturePic(); //d-tor
  393. };
  394. class CRecruitmentWindow : public CIntObject
  395. {
  396. public:
  397. static const int SPACE_BETWEEN = 18;
  398. static const int CREATURE_WIDTH = 102;
  399. static const int TOTAL_CREATURE_WIDTH = SPACE_BETWEEN + CREATURE_WIDTH;
  400. struct creinfo
  401. {
  402. SDL_Rect pos;
  403. CCreaturePic *pic; //creature's animation
  404. int ID, amount; //creature ID and available amount
  405. std::vector<std::pair<int,int> > res; //res_id - cost_per_unit
  406. };
  407. std::vector<int> amounts; //how many creatures we can afford
  408. std::vector<creinfo> creatures; //recruitable creatures
  409. boost::function<void(int,int)> recruit; //void (int ID, int amount) <-- call to recruit creatures
  410. CSlider *slider; //for selecting amount
  411. AdventureMapButton *max, *buy, *cancel;
  412. CPicture *bitmap; //background
  413. CGStatusBar *bar;
  414. int which; //which creature is active
  415. const CGDwelling *dwelling;
  416. int level;
  417. const CArmedInstance *dst;
  418. void close();
  419. void Max();
  420. void Buy();
  421. void Cancel();
  422. void sliderMoved(int to);
  423. void clickLeft(tribool down, bool previousState);
  424. void clickRight(tribool down, bool previousState);
  425. void showAll(SDL_Surface * to);
  426. void initCres();
  427. CRecruitmentWindow(const CGDwelling *Dwelling, int Level, const CArmedInstance *Dst, const boost::function<void(int,int)> & Recruit, int y_offset = 0); //creatures - pairs<creature_ID,amount> //c-tor
  428. ~CRecruitmentWindow(); //d-tor
  429. };
  430. class CSplitWindow : public CIntObject
  431. {
  432. public:
  433. CGarrisonInt *gar;
  434. CSlider *slider;
  435. CCreaturePic *animLeft, *animRight; //creature's animation
  436. AdventureMapButton *ok, *cancel;
  437. SDL_Surface *bitmap; //background
  438. int a1, a2, c; //TODO: comment me
  439. bool which; //which creature is selected
  440. int last; //0/1/2 - at least one creature must be in the src/dst/both stacks; -1 - no restrictions
  441. CSplitWindow(int cid, int max, CGarrisonInt *Owner, int Last = -1, int val=0); //c-tor; val - initial amount of second stack
  442. ~CSplitWindow(); //d-tor
  443. void activate();
  444. void split();
  445. void close();
  446. void deactivate();
  447. void show(SDL_Surface * to);
  448. void clickLeft(tribool down, bool previousState); //call-in
  449. void keyPressed (const SDL_KeyboardEvent & key); //call-in
  450. void sliderMoved(int to);
  451. };
  452. class CLevelWindow : public CIntObject
  453. {
  454. public:
  455. int heroPortrait;
  456. SDL_Surface *bitmap; //background
  457. std::vector<CSelectableComponent *> comps; //skills to select
  458. AdventureMapButton *ok;
  459. boost::function<void(ui32)> cb;
  460. void close();
  461. CLevelWindow(const CGHeroInstance *hero, int pskill, std::vector<ui16> &skills, boost::function<void(ui32)> &callback); //c-tor
  462. ~CLevelWindow(); //d-tor
  463. void activate();
  464. void deactivate();
  465. void selectionChanged(unsigned to);
  466. void show(SDL_Surface * to);
  467. };
  468. class CMinorResDataBar : public CIntObject
  469. {
  470. public:
  471. SDL_Surface *bg; //background bitmap
  472. void show(SDL_Surface * to);
  473. void showAll(SDL_Surface * to);
  474. CMinorResDataBar(); //c-tor
  475. ~CMinorResDataBar(); //d-tor
  476. };
  477. class CObjectListWindow : public CIntObject
  478. {
  479. public:
  480. boost::function<void(int)> onSelect;//called when OK button is pressed, returns id of selected item.
  481. std::string title,descr;//text for title and description
  482. CPicture *bg; //background
  483. CSlider *slider;
  484. CPicture *titleImage;//title image (castle gate\town portal picture)
  485. AdventureMapButton *ok, *exit;
  486. std::vector<Rect> areas;//areas for each visible item
  487. std::vector<int> items;//id of all items present in list
  488. int selected;//currently selected item
  489. int length;//size of list (=9)
  490. bool init;//true = initialization completed
  491. /// Callback will be called when OK button is pressed, returns id of selected item. initState = initially selected item
  492. CObjectListWindow(const std::vector<int> &_items, CPicture * titlePic, std::string _title, std::string _descr,
  493. boost::function<void(int)> Callback, int initState=-1); //c-tor
  494. ~CObjectListWindow(); //d-tor
  495. void elementSelected();//call callback and exit
  496. void moveList(int which);//called when slider moves
  497. void clickLeft(tribool down, bool previousState); //call-in
  498. void keyPressed (const SDL_KeyboardEvent & key); //call-in
  499. void show(SDL_Surface * to);
  500. void showAll(SDL_Surface * to);
  501. };
  502. class CWindowWithArtifacts : public virtual CIntObject
  503. {
  504. public:
  505. std::vector<CArtifactsOfHero *> artSets;
  506. CWindowWithArtifacts();
  507. ~CWindowWithArtifacts();
  508. };
  509. class CTradeWindow : public CWindowWithArtifacts //base for markets and altar of sacrifice
  510. {
  511. public:
  512. enum EType
  513. {
  514. RESOURCE, PLAYER, ARTIFACT_TYPE, CREATURE, CREATURE_PLACEHOLDER, ARTIFACT_PLACEHOLDER, ARTIFACT_INSTANCE
  515. };
  516. class CTradeableItem : public CIntObject
  517. {
  518. public:
  519. EType type;
  520. int id;
  521. int serial;
  522. bool left;
  523. std::string subtitle; //empty if default
  524. const CArtifactInstance *hlp; //holds ptr to artifact instance id type artifact
  525. const CArtifactInstance *getArtInstance() const;
  526. // const CArtifact *getArt() const;
  527. // void setArtInstance(const CArtifactInstance *art) const;
  528. // void setArt(const CArtifact *artT) const;
  529. CFunctionList<void()> callback;
  530. bool downSelection;
  531. void showAllAt(const Point &dstPos, const std::string &customSub, SDL_Surface * to);
  532. void clickRight(tribool down, bool previousState);
  533. void hover (bool on);
  534. void showAll(SDL_Surface * to);
  535. void clickLeft(tribool down, bool previousState);
  536. SDL_Surface *getSurface();
  537. std::string getName(int number = -1) const;
  538. CTradeableItem(EType Type, int ID, bool Left, int Serial);
  539. };
  540. const IMarket *market;
  541. const CGHeroInstance *hero;
  542. CPicture *bg; //background
  543. CArtifactsOfHero *arts;
  544. //all indexes: 1 = left, 0 = right
  545. std::vector<CTradeableItem*> items[2];
  546. CTradeableItem *hLeft, *hRight; //highlighted items (NULL if no highlight)
  547. EType itemsType[2];
  548. EMarketMode mode;//0 - res<->res; 1 - res<->plauer; 2 - buy artifact; 3 - sell artifact
  549. AdventureMapButton *ok, *max, *deal;
  550. CSlider *slider; //for choosing amount to be exchanged
  551. bool readyToTrade;
  552. CTradeWindow(const IMarket *Market, const CGHeroInstance *Hero, EMarketMode Mode); //c
  553. void showAll(SDL_Surface * to);
  554. void initSubs(bool Left);
  555. void initTypes();
  556. void initItems(bool Left);
  557. std::vector<int> *getItemsIds(bool Left); //NULL if default
  558. void getPositionsFor(std::vector<Rect> &poss, bool Left, EType type) const;
  559. void removeItems(const std::set<CTradeableItem *> &toRemove);
  560. void removeItem(CTradeableItem * t);
  561. void getEmptySlots(std::set<CTradeableItem *> &toRemove);
  562. void setMode(EMarketMode Mode); //mode setter
  563. virtual void getBaseForPositions(EType type, int &dx, int &dy, int &x, int &y, int &h, int &w, bool Right, int &leftToRightOffset) const = 0;
  564. virtual void selectionChanged(bool side) = 0; //true == left
  565. virtual Point selectionOffset(bool Left) const = 0;
  566. virtual std::string selectionSubtitle(bool Left) const = 0;
  567. virtual void garrisonChanged() = 0;
  568. virtual void artifactsChanged(bool left) = 0;
  569. };
  570. class CMarketplaceWindow : public CTradeWindow
  571. {
  572. bool printButtonFor(EMarketMode M) const;
  573. public:
  574. int r1, r2; //suggested amounts of traded resources
  575. bool madeTransaction; //if player made at least one transaction
  576. CTextBox *traderText;
  577. void setMax();
  578. void sliderMoved(int to);
  579. void makeDeal();
  580. void selectionChanged(bool side); //true == left
  581. CMarketplaceWindow(const IMarket *Market, const CGHeroInstance *Hero = NULL, EMarketMode Mode = RESOURCE_RESOURCE); //c-tor
  582. ~CMarketplaceWindow(); //d-tor
  583. Point selectionOffset(bool Left) const;
  584. std::string selectionSubtitle(bool Left) const;
  585. void garrisonChanged(); //removes creatures with count 0 from the list (apparently whole stack has been sold)
  586. void artifactsChanged(bool left);
  587. void resourceChanged(int type, int val);
  588. void getBaseForPositions(EType type, int &dx, int &dy, int &x, int &y, int &h, int &w, bool Right, int &leftToRightOffset) const;
  589. void updateTraderText();
  590. };
  591. class CAltarWindow : public CTradeWindow
  592. {
  593. public:
  594. CAltarWindow(const IMarket *Market, const CGHeroInstance *Hero, EMarketMode Mode); //c-tor
  595. void getExpValues();
  596. ~CAltarWindow(); //d-tor
  597. std::vector<int> sacrificedUnits, //[slot_nr] -> how many creatures from that slot will be sacrificed
  598. expPerUnit;
  599. AdventureMapButton *sacrificeAll, *sacrificeBackpack;
  600. CLabel *expToLevel, *expOnAltar;
  601. void selectionChanged(bool side); //true == left
  602. void SacrificeAll();
  603. void SacrificeBackpack();
  604. void putOnAltar(int backpackIndex);
  605. bool putOnAltar(CTradeableItem* altarSlot, const CArtifactInstance *art);
  606. void makeDeal();
  607. void showAll(SDL_Surface * to);
  608. void blockTrade();
  609. void sliderMoved(int to);
  610. void getBaseForPositions(EType type, int &dx, int &dy, int &x, int &y, int &h, int &w, bool Right, int &leftToRightOffset) const;
  611. void mimicCres();
  612. Point selectionOffset(bool Left) const;
  613. std::string selectionSubtitle(bool Left) const;
  614. void garrisonChanged();
  615. void artifactsChanged(bool left);
  616. void calcTotalExp();
  617. void setExpToLevel();
  618. void updateRight(CTradeableItem *toUpdate);
  619. void artifactPicked();
  620. int firstFreeSlot();
  621. void moveFromSlotToAltar(int slotID, CTradeableItem* altarSlot, const CArtifactInstance *art);
  622. };
  623. class CSystemOptionsWindow : public CIntObject
  624. {
  625. private:
  626. SDL_Surface * background; //background of window
  627. AdventureMapButton *load, *save, *restart, *mainMenu, *quitGame, *backToMap; //load and restart are not used yet
  628. CHighlightableButtonsGroup * heroMoveSpeed;
  629. CHighlightableButtonsGroup * mapScrollSpeed;
  630. CHighlightableButtonsGroup * musicVolume, * effectsVolume;
  631. public:
  632. CSystemOptionsWindow(const SDL_Rect & pos, CPlayerInterface * owner); //c-tor
  633. ~CSystemOptionsWindow(); //d-tor
  634. //functions bound to buttons
  635. void bsavef(); //save game
  636. void bquitf(); //quit game
  637. void breturnf(); //return to game
  638. void bmainmenuf(); //return to main menu
  639. void pushSDLEvent(int type, int usercode);
  640. void activate();
  641. void deactivate();
  642. void show(SDL_Surface * to);
  643. };
  644. class CTavernWindow : public CIntObject
  645. {
  646. public:
  647. class HeroPortrait : public CIntObject
  648. {
  649. public:
  650. std::string hoverName;
  651. vstd::assigner<int,int> as;
  652. const CGHeroInstance *h;
  653. char descr[100]; // "XXX is a level Y ZZZ with N artifacts"
  654. void clickLeft(tribool down, bool previousState);
  655. void clickRight(tribool down, bool previousState);
  656. void hover (bool on);
  657. HeroPortrait(int &sel, int id, int x, int y, const CGHeroInstance *H);
  658. void show(SDL_Surface * to);
  659. } *h1, *h2; //recruitable heroes
  660. CPicture *bg; //background
  661. CGStatusBar *bar; //tavern's internal status bar
  662. int selected;//0 (left) or 1 (right)
  663. int oldSelected;//0 (left) or 1 (right)
  664. AdventureMapButton *thiefGuild, *cancel, *recruit;
  665. const CGObjectInstance *tavernObj;
  666. CTavernWindow(const CGObjectInstance *TavernObj); //c-tor
  667. ~CTavernWindow(); //d-tor
  668. void recruitb();
  669. void close();
  670. void thievesguildb();
  671. void show(SDL_Surface * to);
  672. };
  673. class CInGameConsole : public CIntObject
  674. {
  675. private:
  676. std::list< std::pair< std::string, int > > texts; //<text to show, time of add>
  677. boost::mutex texts_mx; // protects texts
  678. std::vector< std::string > previouslyEntered; //previously entered texts, for up/down arrows to work
  679. int prevEntDisp; //displayed entry from previouslyEntered - if none it's -1
  680. int defaultTimeout; //timeout for new texts (in ms)
  681. int maxDisplayedTexts; //hiw many texts can be displayed simultaneously
  682. public:
  683. std::string enteredText;
  684. void activate();
  685. void deactivate();
  686. void show(SDL_Surface * to);
  687. void print(const std::string &txt);
  688. void keyPressed (const SDL_KeyboardEvent & key); //call-in
  689. void startEnteringText();
  690. void endEnteringText(bool printEnteredText);
  691. void refreshEnteredText();
  692. CInGameConsole(); //c-tor
  693. };
  694. class HoverableArea: public virtual CIntObject
  695. {
  696. public:
  697. std::string hoverText;
  698. virtual void hover (bool on);
  699. HoverableArea();
  700. virtual ~HoverableArea();
  701. };
  702. class LRClickableAreaWText: public HoverableArea
  703. {
  704. public:
  705. std::string text;
  706. LRClickableAreaWText();
  707. LRClickableAreaWText(const Rect &Pos, const std::string &HoverText = "", const std::string &ClickText = "");
  708. virtual ~LRClickableAreaWText();
  709. void init();
  710. virtual void clickLeft(tribool down, bool previousState);
  711. virtual void clickRight(tribool down, bool previousState);
  712. };
  713. class LRClickableAreaWTextComp: public LRClickableAreaWText
  714. {
  715. public:
  716. int baseType;
  717. int bonusValue, type;
  718. virtual void clickLeft(tribool down, bool previousState);
  719. LRClickableAreaWTextComp(const Rect &Pos = Rect(0,0,0,0), int BaseType = -1);
  720. };
  721. class MoraleLuckBox : public LRClickableAreaWTextComp
  722. {
  723. public:
  724. bool morale; //true if morale, false if luck
  725. void set(const CBonusSystemNode *node);
  726. void showAll(SDL_Surface * to);
  727. MoraleLuckBox(bool Morale, const Rect &r);
  728. ~MoraleLuckBox();
  729. };
  730. class CHeroArea: public CIntObject
  731. {
  732. public:
  733. const CGHeroInstance * hero;
  734. CHeroArea(int x, int y, const CGHeroInstance * _hero);
  735. void clickLeft(tribool down, bool previousState);
  736. void clickRight(tribool down, bool previousState);
  737. void hover(bool on);
  738. void showAll(SDL_Surface * to);
  739. };
  740. class LRClickableAreaOpenTown: public LRClickableAreaWTextComp
  741. {
  742. public:
  743. const CGTownInstance * town;
  744. void clickLeft(tribool down, bool previousState);
  745. void clickRight(tribool down, bool previousState);
  746. LRClickableAreaOpenTown();
  747. };
  748. class CCreInfoWindow : public CIntObject
  749. {
  750. public:
  751. //bool active; //TODO: comment me
  752. int type;//0 - rclick popup; 1 - normal window
  753. CPicture *bitmap; //background
  754. std::string count; //creature count in text format
  755. boost::function<void()> dsm; //dismiss button callback
  756. CCreaturePic *anim; //related creature's animation
  757. const CCreature *c; //related creature
  758. std::vector<SComponent*> upgResCost; //cost of upgrade (if not possible then empty)
  759. MoraleLuckBox *luck, *morale;
  760. AdventureMapButton *dismiss, *upgrade, *ok;
  761. CCreInfoWindow(const CStackInstance &st, int Type = 0, boost::function<void()> Upg = 0, boost::function<void()> Dsm = 0, UpgradeInfo *ui = NULL); //c-tor
  762. CCreInfoWindow(const CStack &st, int Type = 0); //c-tor
  763. CCreInfoWindow(int Cid, int Type, int creatureCount); //c-tor
  764. void init(const CCreature *cre, const CBonusSystemNode *stackNode, const CGHeroInstance *heroOwner, int creatureCount);
  765. void printLine(int nr, const std::string &text, int baseVal, int val=-1, bool range=false);
  766. ~CCreInfoWindow(); //d-tor
  767. void activate();
  768. void close();
  769. void clickRight(tribool down, bool previousState); //call-in
  770. void dismissF();
  771. void keyPressed (const SDL_KeyboardEvent & key); //call-in
  772. void deactivate();
  773. void show(SDL_Surface * to);
  774. };
  775. class CArtPlace: public LRClickableAreaWTextComp
  776. {
  777. public:
  778. int slotID; //0 head 1 shoulders 2 neck 3 right hand 4 left hand 5 torso 6 right ring 7 left ring 8 feet 9 misc. slot 1 10 misc. slot 2 11 misc. slot 3 12 misc. slot 4 13 ballista (war machine 1) 14 ammo cart (war machine 2) 15 first aid tent (war machine 3) 16 catapult 17 spell book 18 misc. slot 5 19+ backpack slots
  779. bool picked;
  780. bool marked;
  781. bool locked;
  782. CArtifactsOfHero * ourOwner;
  783. const CArtifactInstance * ourArt;
  784. CArtPlace(const CArtifactInstance * Art); //c-tor
  785. void clickLeft(tribool down, bool previousState);
  786. void clickRight(tribool down, bool previousState);
  787. void select ();
  788. void deselect ();
  789. void activate();
  790. void deactivate();
  791. void showAll(SDL_Surface * to);
  792. bool fitsHere (const CArtifactInstance * art) const; //returns true if given artifact can be placed here
  793. void setMeAsDest(bool backpackAsVoid = true);
  794. void setArtifact(const CArtifactInstance *art);
  795. ~CArtPlace(); //d-tor
  796. };
  797. class CArtifactsOfHero : public CIntObject
  798. {
  799. const CGHeroInstance * curHero; //local copy of hero on which we operate
  800. std::vector<CArtPlace *> artWorn; // 0 - head; 1 - shoulders; 2 - neck; 3 - right hand; 4 - left hand; 5 - torso; 6 - right ring; 7 - left ring; 8 - feet; 9 - misc1; 10 - misc2; 11 - misc3; 12 - misc4; 13 - mach1; 14 - mach2; 15 - mach3; 16 - mach4; 17 - spellbook; 18 - misc5
  801. std::vector<CArtPlace *> backpack; //hero's visible backpack (only 5 elements!)
  802. int backpackPos; //number of first art visible in backpack (in hero's vector)
  803. public:
  804. struct SCommonPart
  805. {
  806. struct Artpos
  807. {
  808. int slotID;
  809. const CArtifactsOfHero * AOH;
  810. const CArtifactInstance *art;
  811. Artpos();
  812. void clear();
  813. void setTo(const CArtPlace *place, bool dontTakeBackpack);
  814. bool valid();
  815. bool operator==(const ArtifactLocation &al) const;
  816. } src, dst;
  817. std::set<CArtifactsOfHero *> participants; // Needed to mark slots.
  818. void reset();
  819. } * commonInfo; //when we have more than one CArtifactsOfHero in one window with exchange possibility, we use this (eg. in exchange window); to be provided externally
  820. bool updateState; // Whether the commonInfo should be updated on setHero or not.
  821. AdventureMapButton * leftArtRoll, * rightArtRoll;
  822. bool allowedAssembling;
  823. std::multiset<const CArtifactInstance*> artifactsOnAltar; //artifacts id that are technically present in backpack but in GUI are moved to the altar - they'll be ommited in backpack slots
  824. void realizeCurrentTransaction(); //calls callback with parameters stored in commonInfo
  825. void artifactMoved(const ArtifactLocation &src, const ArtifactLocation &dst);
  826. void artifactAssembled(const ArtifactLocation &al);
  827. void artifactDisassembled(const ArtifactLocation &al);
  828. CArtPlace *getArtPlace(int slot);
  829. void setHero(const CGHeroInstance * hero);
  830. void dispose(); //free resources not needed after closing windows and reset state
  831. void scrollBackpack(int dir); //dir==-1 => to left; dir==1 => to right
  832. void safeRedraw();
  833. void markPossibleSlots(const CArtifactInstance* art);
  834. void unmarkSlots(bool withRedraw = true);
  835. void setSlotData (CArtPlace* artPlace, int slotID);
  836. void updateWornSlots ();
  837. void eraseSlotData (CArtPlace* artPlace, int slotID);
  838. CArtifactsOfHero(const Point& position, bool createCommonPart = false); //c-tor
  839. ~CArtifactsOfHero(); //d-tor
  840. void updateParentWindow();
  841. friend class CArtPlace;
  842. };
  843. class CGarrisonWindow : public CWindowWithGarrison
  844. {
  845. public:
  846. CPicture *bg; //background surface
  847. AdventureMapButton *quit;
  848. void close();
  849. void showAll(SDL_Surface * to);
  850. CGarrisonWindow(const CArmedInstance *up, const CGHeroInstance *down, bool removableUnits); //c-tor
  851. ~CGarrisonWindow(); //d-tor
  852. };
  853. class CExchangeWindow : public CWindowWithGarrison, public CWindowWithArtifacts
  854. {
  855. CStatusBar * ourBar; //internal statusbar
  856. SDL_Surface *bg; //background
  857. AdventureMapButton * quit, * questlogButton[2];
  858. std::vector<LRClickableAreaWTextComp *> secSkillAreas[2], primSkillAreas;
  859. MoraleLuckBox *morale[2], *luck[2];
  860. LRClickableAreaWText *speciality[2];
  861. LRClickableAreaWText *experience[2];
  862. LRClickableAreaWText *spellPoints[2];
  863. CHeroArea *portrait[2];
  864. public:
  865. const CGHeroInstance * heroInst[2];
  866. CArtifactsOfHero * artifs[2];
  867. void close();
  868. void activate();
  869. void deactivate();
  870. void show(SDL_Surface * to);
  871. void questlog(int whichHero); //questlog button callback; whichHero: 0 - left, 1 - right
  872. void prepareBackground(); //prepares or redraws bg
  873. CExchangeWindow(si32 hero1, si32 hero2); //c-tor
  874. ~CExchangeWindow(); //d-tor
  875. };
  876. class CShipyardWindow : public CIntObject
  877. {
  878. public:
  879. CStatusBar *bar;
  880. SDL_Surface *bg; //background
  881. AdventureMapButton *build, *quit;
  882. unsigned char frame; //frame of the boat animation
  883. int boat; //which boat graphic should be used
  884. void activate();
  885. void deactivate();
  886. void show(SDL_Surface * to);
  887. CShipyardWindow(const std::vector<si32> &cost, int state, int boatType, const boost::function<void()> &onBuy);
  888. ~CShipyardWindow();
  889. };
  890. class CPuzzleWindow : public CIntObject
  891. {
  892. private:
  893. SDL_Surface * background;
  894. AdventureMapButton * quitb;
  895. CResDataBar * resdatabar;
  896. std::vector<std::pair<SDL_Surface *, const SPuzzleInfo *> > puzzlesToPullBack;
  897. ui8 animCount;
  898. public:
  899. void activate();
  900. void deactivate();
  901. void show(SDL_Surface * to);
  902. CPuzzleWindow(const int3 &grailPos, float discoveredRatio);
  903. ~CPuzzleWindow();
  904. };
  905. class CTransformerWindow : public CIntObject
  906. {
  907. public:
  908. class CItem : public CIntObject
  909. {
  910. public:
  911. int id;//position of creature in hero army
  912. bool left;//position of the item
  913. int size; //size of creature stack
  914. CTransformerWindow * parent;
  915. void move();
  916. void showAll(SDL_Surface * to);
  917. void clickLeft(tribool down, bool previousState);
  918. CItem(CTransformerWindow * _parent, int _size, int _id);
  919. ~CItem();
  920. };
  921. const CArmedInstance *army;//object with army for transforming (hero or town)
  922. const CGHeroInstance *hero;//only if we have hero in town
  923. const CGTownInstance *town;//market, town garrison is used if hero == NULL
  924. CPicture *bg; //background
  925. std::vector<CItem*> items;
  926. AdventureMapButton *all, *convert, *cancel;
  927. CGStatusBar *bar;
  928. void showAll(SDL_Surface * to);
  929. void makeDeal();
  930. void addAll();
  931. CTransformerWindow(const CGHeroInstance * _hero, const CGTownInstance * _town); //c-tor
  932. ~CTransformerWindow(); //d-tor
  933. };
  934. class CUniversityWindow : public CIntObject
  935. {
  936. class CItem : public CPicture
  937. {
  938. public:
  939. int ID;//id of selected skill
  940. CUniversityWindow * parent;
  941. void showAll(SDL_Surface * to);
  942. void clickLeft(tribool down, bool previousState);
  943. void clickRight(tribool down, bool previousState);
  944. void hover(bool on);
  945. int state();//0=can't learn, 1=learned, 2=can learn
  946. CItem(CUniversityWindow * _parent, int _ID, int X, int Y);
  947. };
  948. public:
  949. const CGHeroInstance *hero;
  950. const IMarket * market;
  951. CPicture * green, * yellow, * red;//colored bars near skills
  952. CPicture *bg; //background
  953. std::vector<CItem*> items;
  954. AdventureMapButton *cancel;
  955. CGStatusBar *bar;
  956. CUniversityWindow(const CGHeroInstance * _hero, const IMarket * _market); //c-tor
  957. ~CUniversityWindow(); //d-tor
  958. };
  959. class CUnivConfirmWindow : public CIntObject//Confirmation window for University
  960. {
  961. public:
  962. CUniversityWindow * parent;
  963. CPicture * bg;
  964. CGStatusBar *bar;
  965. AdventureMapButton *confirm, *cancel;
  966. CUnivConfirmWindow(CUniversityWindow * PARENT, int SKILL, bool available); //c-tor
  967. void makeDeal(int skill);
  968. };
  969. class CHillFortWindow : public CWindowWithGarrison
  970. {
  971. public:
  972. int slotsCount;//=7;
  973. CGStatusBar * bar;
  974. CDefEssential *resources;
  975. CPicture *bg; //background surface
  976. CHeroArea *heroPic;//clickable hero image
  977. AdventureMapButton *quit,//closes window
  978. *upgradeAll,//upgrade all creatures
  979. *upgrade[7];//upgrade single creature
  980. const CGObjectInstance * fort;
  981. const CGHeroInstance * hero;
  982. std::vector<int> currState;//current state of slot - to avoid calls to getState or updating buttons
  983. std::vector<std::map<int,int> > costs;// costs [slot ID] [resource ID] = resource count for upgrade
  984. std::vector<int> totalSumm; // totalSum[resource ID] = value
  985. CHillFortWindow(const CGHeroInstance *visitor, const CGObjectInstance *object); //c-tor
  986. ~CHillFortWindow(); //d-tor
  987. void activate();
  988. void showAll (SDL_Surface *to);
  989. std::string getDefForSlot(int slot);//return def name for this slot
  990. std::string getTextForSlot(int slot);//return hover text for this slot
  991. void makeDeal(int slot);//-1 for upgrading all creatures
  992. int getState(int slot); //-1 = no creature 0=can't upgrade, 1=upgraded, 2=can upgrade
  993. void updateGarrisons();//update buttons after garrison changes
  994. };
  995. class CThievesGuildWindow : public CIntObject
  996. {
  997. const CGObjectInstance * owner;
  998. CGStatusBar * statusBar;
  999. AdventureMapButton * exitb;
  1000. SDL_Surface * background;
  1001. CMinorResDataBar * resdatabar;
  1002. public:
  1003. void activate();
  1004. void show(SDL_Surface * to);
  1005. void bexitf();
  1006. CThievesGuildWindow(const CGObjectInstance * _owner);
  1007. ~CThievesGuildWindow();
  1008. };
  1009. #endif //__GUICLASSES_H__