CPlayerInterface.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. #ifndef CPLAYERINTERFACE_H
  2. #define CPLAYERINTERFACE_H
  3. #include "global.h"
  4. #include "CGameInterface.h"
  5. #include "SDL_framerate.h"
  6. #include <map>
  7. #include <list>
  8. class CDefEssential;
  9. class AdventureMapButton;
  10. class CDefHandler;
  11. struct HeroMoveDetails;
  12. class CDefEssential;
  13. class CGHeroInstance;
  14. class CAdvMapInt;
  15. class CCastleInterface;
  16. class CStack;
  17. class SComponent;
  18. class CCreature;
  19. struct SDL_Surface;
  20. struct CPath;
  21. class CCreatureAnimation;
  22. class CSelectableComponent;
  23. class CCreatureSet;
  24. class CGObjectInstance;
  25. class CSlider;
  26. struct UpgradeInfo;
  27. template <typename T> struct CondSh;
  28. namespace boost
  29. {
  30. class mutex;
  31. class recursive_mutex;
  32. };
  33. class IShowable
  34. {
  35. public:
  36. virtual void show(SDL_Surface * to = NULL)=0;
  37. virtual ~IShowable(){};
  38. };
  39. class IStatusBar
  40. {
  41. public:
  42. virtual ~IStatusBar(){}; //d-tor
  43. virtual void print(std::string text)=0; //prints text and refreshes statusbar
  44. virtual void clear()=0;//clears statusbar and refreshes
  45. virtual void show()=0; //shows statusbar (with current text)
  46. virtual std::string getCurrent()=0;
  47. };
  48. class IActivable
  49. {
  50. public:
  51. virtual void activate()=0;
  52. virtual void deactivate()=0;
  53. virtual ~IActivable(){};
  54. };
  55. class IShowActivable : public IShowable, public IActivable
  56. {
  57. public:
  58. virtual ~IShowActivable(){};
  59. };
  60. class CMainInterface : public IShowActivable
  61. {
  62. public:
  63. IShowActivable *subInt;
  64. };
  65. class CIntObject //interface object
  66. {
  67. public:
  68. SDL_Rect pos;
  69. int ID;
  70. };
  71. class CSimpleWindow : public virtual CIntObject, public IShowable
  72. {
  73. public:
  74. SDL_Surface * bitmap;
  75. CIntObject * owner;
  76. virtual void show(SDL_Surface * to = NULL);
  77. CSimpleWindow():bitmap(NULL),owner(NULL){};
  78. virtual ~CSimpleWindow();
  79. };
  80. class CButtonBase : public virtual CIntObject, public IShowable, public IActivable //basic buttton class
  81. {
  82. public:
  83. int bitmapOffset;
  84. int type; //advmapbutton=2
  85. bool abs;
  86. bool active;
  87. bool notFreeButton;
  88. CIntObject * ourObj; // "owner"
  89. int state;
  90. std::vector< std::vector<SDL_Surface*> > imgs;
  91. int curimg;
  92. virtual void show(SDL_Surface * to = NULL);
  93. virtual void activate()=0;
  94. virtual void deactivate()=0;
  95. CButtonBase();
  96. virtual ~CButtonBase();
  97. };
  98. class ClickableL : public virtual CIntObject //for left-clicks
  99. {
  100. public:
  101. bool pressedL;
  102. ClickableL();
  103. virtual ~ClickableL(){};
  104. virtual void clickLeft (boost::logic::tribool down)=0;
  105. virtual void activate()=0;
  106. virtual void deactivate()=0;
  107. };
  108. class ClickableR : public virtual CIntObject //for right-clicks
  109. {
  110. public:
  111. bool pressedR;
  112. ClickableR();
  113. virtual ~ClickableR(){};
  114. virtual void clickRight (boost::logic::tribool down)=0;
  115. virtual void activate()=0;
  116. virtual void deactivate()=0;
  117. };
  118. class Hoverable : public virtual CIntObject
  119. {
  120. public:
  121. Hoverable(){hovered=false;}
  122. virtual ~Hoverable(){};
  123. bool hovered;
  124. virtual void hover (bool on)=0;
  125. virtual void activate()=0;
  126. virtual void deactivate()=0;
  127. };
  128. class KeyInterested : public virtual CIntObject
  129. {
  130. public:
  131. virtual ~KeyInterested(){};
  132. virtual void keyPressed (SDL_KeyboardEvent & key)=0;
  133. virtual void activate()=0;
  134. virtual void deactivate()=0;
  135. };
  136. class MotionInterested: public virtual CIntObject
  137. {
  138. public:
  139. bool strongInterest; //if true - report all mouse movements, if not - only when hovered
  140. MotionInterested(){strongInterest=false;};
  141. virtual ~MotionInterested(){};
  142. virtual void mouseMoved (SDL_MouseMotionEvent & sEvent)=0;
  143. virtual void activate()=0;
  144. virtual void deactivate()=0;
  145. };
  146. class TimeInterested: public virtual CIntObject
  147. {
  148. public:
  149. virtual ~TimeInterested(){};
  150. int toNextTick;
  151. virtual void tick()=0;
  152. virtual void activate();
  153. virtual void deactivate();
  154. };
  155. class CInfoWindow : public CSimpleWindow //text + comp. + ok button
  156. { //window able to delete its components when closed
  157. public:
  158. bool delComps; //whether comps will be deleted
  159. std::vector<AdventureMapButton *> buttons;
  160. std::vector<SComponent*> components;
  161. virtual void close();
  162. virtual void show(SDL_Surface * to = NULL);
  163. void activate();
  164. void deactivate();
  165. CInfoWindow(std::string text, int player, int charperline, const std::vector<SComponent*> &comps, std::vector<std::pair<std::string,CFunctionList<void()> > > &Buttons);
  166. CInfoWindow();
  167. ~CInfoWindow();
  168. };
  169. class CSelWindow : public CInfoWindow //component selection window
  170. { //uwaga - to okno usuwa swoje komponenty przy zamykaniu
  171. public:
  172. void selectionChange(unsigned to);
  173. void close();
  174. CSelWindow(std::string text, int player, int charperline, std::vector<CSelectableComponent*> &comps, std::vector<std::pair<std::string,boost::function<void()> > > &Buttons);
  175. CSelWindow(){};
  176. };
  177. class CRClickPopup : public IShowable, public ClickableR
  178. {
  179. public:
  180. virtual void activate();
  181. virtual void deactivate();
  182. virtual void close()=0;
  183. void clickRight (boost::logic::tribool down);
  184. virtual ~CRClickPopup(){};
  185. };
  186. class CInfoPopup : public CRClickPopup
  187. {
  188. public:
  189. bool free;
  190. SDL_Surface * bitmap;
  191. CInfoPopup(SDL_Surface * Bitmap, int x, int y, bool Free=false);
  192. void close();
  193. void show(SDL_Surface * to = NULL);
  194. CInfoPopup(){free=false;bitmap=NULL;}
  195. ~CInfoPopup(){};
  196. };
  197. class SComponent : public ClickableR
  198. {
  199. public:
  200. enum Etype
  201. {
  202. primskill, secskill, resource, creature, artifact, experience, secskill44, spell
  203. } type;
  204. int subtype;
  205. int val;
  206. std::string description; //r-click
  207. std::string subtitle;
  208. void init(Etype Type, int Subtype, int Val);
  209. SComponent(Etype Type, int Subtype, int Val);
  210. SComponent(const Component &c);
  211. SComponent(){};
  212. virtual ~SComponent(){};
  213. void clickRight (boost::logic::tribool down);
  214. virtual SDL_Surface * getImg();
  215. virtual void show(SDL_Surface * to = NULL);
  216. virtual void activate();
  217. virtual void deactivate();
  218. };
  219. class CCustomImgComponent : public SComponent
  220. {
  221. public:
  222. bool free; //should surface be freed on delete
  223. SDL_Surface *bmp;
  224. SDL_Surface * getImg();
  225. CCustomImgComponent(Etype Type, int Subtype, int Val, SDL_Surface *sur, bool freeSur);
  226. ~CCustomImgComponent();
  227. };
  228. class CSelectableComponent : public SComponent, public ClickableL
  229. {
  230. public:
  231. bool selected;
  232. bool customB;
  233. SDL_Surface * border, *myBitmap;
  234. boost::function<void()> onSelect;
  235. void clickLeft(boost::logic::tribool down);
  236. void init(SDL_Surface * Border);
  237. CSelectableComponent(Etype Type, int Sub, int Val, boost::function<void()> OnSelect = 0, SDL_Surface * Border=NULL);
  238. CSelectableComponent(const Component &c, boost::function<void()> OnSelect = 0, SDL_Surface * Border=NULL);
  239. ~CSelectableComponent();
  240. virtual void show(SDL_Surface * to = NULL);
  241. void activate();
  242. void deactivate();
  243. void select(bool on);
  244. SDL_Surface * getImg();
  245. };
  246. class CGarrisonInt;
  247. class CGarrisonSlot : public ClickableL, public ClickableR, public Hoverable
  248. {
  249. public:
  250. CGarrisonInt *owner;
  251. const CCreature * creature;
  252. int count;
  253. int upg; //0 - up garrison, 1 - down garrison
  254. bool active;
  255. virtual void hover (bool on);
  256. const CArmedInstance * getObj();
  257. void clickRight (boost::logic::tribool down);
  258. void clickLeft(boost::logic::tribool down);
  259. void activate();
  260. void deactivate();
  261. void show();
  262. CGarrisonSlot(CGarrisonInt *Owner, int x, int y, int IID, int Upg=0, const CCreature * Creature=NULL, int Count=0);
  263. ~CGarrisonSlot();
  264. };
  265. class CGarrisonInt :public CIntObject
  266. {
  267. public:
  268. int interx, intery;
  269. CGarrisonSlot *highlighted;
  270. SDL_Surface *sur;
  271. int offx, offy, p2;
  272. bool ignoreEvent, update, active, splitting, pb;
  273. const CCreatureSet *set1;
  274. const CCreatureSet *set2;
  275. std::vector<CGarrisonSlot*> *sup, *sdown;
  276. const CArmedInstance *oup, *odown;
  277. void activate();
  278. void deactivate();
  279. void show();
  280. void activeteSlots();
  281. void deactiveteSlots();
  282. void deleteSlots();
  283. void createSlots();
  284. void recreateSlots();
  285. void splitClick();
  286. void splitStacks(int am2);
  287. CGarrisonInt(int x, int y, int inx, int iny, SDL_Surface *pomsur, int OX, int OY, const CArmedInstance *s1, const CArmedInstance *s2=NULL);
  288. ~CGarrisonInt();
  289. };
  290. class CPlayerInterface : public CGameInterface
  291. {
  292. public:
  293. //minor interfaces
  294. CondSh<bool> *showingDialog;
  295. boost::recursive_mutex *pim;
  296. bool makingTurn;
  297. SDL_Event * current;
  298. CMainInterface *curint;
  299. CAdvMapInt * adventureInt;
  300. CCastleInterface * castleInt;
  301. FPSmanager * mainFPSmng;
  302. IStatusBar *statusbar;
  303. //to commucate with engine
  304. CCallback * cb;
  305. //GUI elements
  306. std::list<ClickableL*> lclickable;
  307. std::list<ClickableR*> rclickable;
  308. std::list<Hoverable*> hoverable;
  309. std::list<KeyInterested*> keyinterested;
  310. std::list<MotionInterested*> motioninterested;
  311. std::list<TimeInterested*> timeinterested;
  312. std::vector<IShowable*> objsToBlit;
  313. //overloaded funcs from CGameInterface
  314. void buildChanged(const CGTownInstance *town, int buildingID, int what); //what: 1 - built, 2 - demolished
  315. void garrisonChanged(const CGObjectInstance * obj);
  316. void heroArtifactSetChanged(const CGHeroInstance*hero);
  317. void heroCreated(const CGHeroInstance* hero);
  318. void heroGotLevel(const CGHeroInstance *hero, int pskill, std::vector<ui16> &skills, boost::function<void(ui32)> &callback);
  319. void heroInGarrisonChange(const CGTownInstance *town);
  320. void heroKilled(const CGHeroInstance* hero);
  321. void heroMoved(const HeroMoveDetails & details);
  322. void heroPrimarySkillChanged(const CGHeroInstance * hero, int which, int val);
  323. void heroVisitsTown(const CGHeroInstance* hero, const CGTownInstance * town);
  324. void receivedResource(int type, int val);
  325. void showInfoDialog(std::string &text, const std::vector<Component*> &components);
  326. void showSelDialog(std::string &text, const std::vector<Component*> &components, ui32 askID);
  327. void showYesNoDialog(std::string &text, const std::vector<Component*> &components, ui32 askID);
  328. void tileHidden(int3 pos);
  329. void tileRevealed(int3 pos);
  330. void yourTurn();
  331. void availableCreaturesChanged(const CGTownInstance *town);
  332. //for battles
  333. //void actionFinished(BattleAction action);//occurs AFTER every action taken by any stack or by the hero
  334. //void actionStarted(BattleAction action);//occurs BEFORE every action taken by any stack or by the hero
  335. BattleAction activeStack(int stackID); //called when it's turn of that stack
  336. void battleAttack(BattleAttack *ba);
  337. void battleEnd(BattleResult *br);
  338. void battleResultQuited();
  339. void battleNewRound(int round); //called at the beggining of each turn, round=-1 is the tactic phase, round=0 is the first "normal" turn
  340. void battleStackIsShooting(int ID, int dest); //called when stack with id ID is shooting to hex dest
  341. void battleStackKilled(int ID, int dmg, int killed, int IDby, bool byShooting);
  342. void battleStackMoved(int ID, int dest, bool startMoving, bool endMoving);
  343. void battleStart(CCreatureSet *army1, CCreatureSet *army2, int3 tile, CGHeroInstance *hero1, CGHeroInstance *hero2, bool side); //called by engine when battle starts; side=0 - left, side=1 - right
  344. void battlefieldPrepared(int battlefieldType, std::vector<CObstacle*> obstacles); //called when battlefield is prepared, prior the battle beginning
  345. //-------------//
  346. void updateWater();
  347. void showComp(SComponent comp);
  348. void openTownWindow(const CGTownInstance * town); //shows townscreen
  349. void openHeroWindow(const CGHeroInstance * hero); //shows hero window with given hero
  350. SDL_Surface * infoWin(const CGObjectInstance * specific); //specific=0 => draws info about selected town/hero //TODO - gdy sie dorobi sensowna hierarchie klas ins. to wywalic tego brzydkiego void*
  351. void handleEvent(SDL_Event * sEvent);
  352. void handleKeyDown(SDL_Event *sEvent);
  353. void handleKeyUp(SDL_Event *sEvent);
  354. void handleMouseMotion(SDL_Event *sEvent);
  355. void init(ICallback * CB);
  356. int3 repairScreenPos(int3 pos);
  357. void removeObjToBlit(IShowable* obj);
  358. void showInfoDialog(std::string &text, const std::vector<SComponent*> & components);
  359. void showYesNoDialog(std::string &text, const std::vector<SComponent*> & components, CFunctionList<void()> onYes, CFunctionList<void()> onNo, bool deactivateCur, bool DelComps); //deactivateCur - whether current main interface should be deactivated; delComps - if components will be deleted on window close
  360. CPlayerInterface(int Player, int serial);//c-tor
  361. ~CPlayerInterface();//d-tor
  362. };
  363. class CStatusBar
  364. : public CIntObject, public IStatusBar
  365. {
  366. public:
  367. SDL_Surface * bg; //background
  368. int middlex, middley; //middle of statusbar
  369. std::string current; //text currently printed
  370. CStatusBar(int x, int y, std::string name="ADROLLVR.bmp", int maxw=-1); //c-tor
  371. ~CStatusBar(); //d-tor
  372. void print(std::string text); //prints text and refreshes statusbar
  373. void clear();//clears statusbar and refreshes
  374. void show(); //shows statusbar (with current text)
  375. std::string getCurrent();
  376. };
  377. class CList
  378. : public ClickableL, public ClickableR, public Hoverable, public KeyInterested, public virtual CIntObject, public MotionInterested
  379. {
  380. public:
  381. SDL_Surface * bg;
  382. CDefHandler *arrup, *arrdo;
  383. SDL_Surface *empty, *selection;
  384. SDL_Rect arrupp, arrdop; //positions of arrows
  385. int posw, posh; //position width/height
  386. int selected, //id of selected position, <0 if none
  387. from;
  388. const int SIZE;
  389. boost::logic::tribool pressed; //true=up; false=down; indeterminate=none
  390. CList(int Size = 5);
  391. void clickLeft(boost::logic::tribool down);
  392. void activate();
  393. void deactivate();
  394. virtual void mouseMoved (SDL_MouseMotionEvent & sEvent)=0;
  395. virtual void genList()=0;
  396. virtual void select(int which)=0;
  397. virtual void draw()=0;
  398. };
  399. class CHeroList
  400. : public CList
  401. {
  402. public:
  403. CDefHandler *mobile, *mana;
  404. std::vector<std::pair<const CGHeroInstance*, CPath *> > items;
  405. int posmobx, posporx, posmanx, posmoby, pospory, posmany;
  406. CHeroList(int Size = 5);
  407. int getPosOfHero(const CArmedInstance* h);
  408. void genList();
  409. void select(int which);
  410. void mouseMoved (SDL_MouseMotionEvent & sEvent);
  411. void clickLeft(boost::logic::tribool down);
  412. void clickRight(boost::logic::tribool down);
  413. void hover (bool on);
  414. void keyPressed (SDL_KeyboardEvent & key);
  415. void updateHList();
  416. void updateMove(const CGHeroInstance* which); //draws move points bar
  417. void redrawAllOne(int which);
  418. void draw();
  419. void init();
  420. };
  421. class CTownList
  422. : public CList
  423. {
  424. public:
  425. boost::function<void()> fun;
  426. std::vector<const CGTownInstance*> items;
  427. int posporx,pospory;
  428. CTownList(int Size, SDL_Rect * Pos, int arupx, int arupy, int ardox, int ardoy);
  429. ~CTownList();
  430. void genList();
  431. void select(int which);
  432. void mouseMoved (SDL_MouseMotionEvent & sEvent);
  433. void clickLeft(boost::logic::tribool down);
  434. void clickRight(boost::logic::tribool down);
  435. void hover (bool on);
  436. void keyPressed (SDL_KeyboardEvent & key);
  437. void draw();
  438. };
  439. class CCreaturePic //draws picture with creature on background, use nextFrame=true to get animation
  440. {
  441. public:
  442. bool big; //big => 100x130; !big => 100x120
  443. CCreature *c;
  444. CCreatureAnimation *anim;
  445. CCreaturePic(CCreature *cre, bool Big=true);
  446. ~CCreaturePic();
  447. int blitPic(SDL_Surface *to, int x, int y, bool nextFrame);
  448. SDL_Surface * getPic(bool nextFrame);
  449. };
  450. class CRecrutationWindow : public IShowable, public ClickableL
  451. {
  452. public:
  453. struct creinfo
  454. {
  455. SDL_Rect pos;
  456. CCreaturePic *pic;
  457. int ID, amount; //creature ID and available amount
  458. std::vector<std::pair<int,int> > res; //res_id - cost_per_unit
  459. };
  460. std::vector<int> amounts; //how many creatures we can afford
  461. std::vector<creinfo> creatures;
  462. boost::function<void(int,int)> recruit; //void (int ID, int amount) <-- call to recruit creatures
  463. CSlider *slider;
  464. AdventureMapButton *max, *buy, *cancel;
  465. SDL_Surface *bitmap;
  466. int which; //which creature is active
  467. void close();
  468. void Max();
  469. void Buy();
  470. void Cancel();
  471. void sliderMoved(int to);
  472. void clickLeft(boost::logic::tribool down);
  473. void activate();
  474. void deactivate();
  475. void show(SDL_Surface * to = NULL);
  476. CRecrutationWindow(const std::vector<std::pair<int,int> > & Creatures, const boost::function<void(int,int)> & Recruit); //creatures - pairs<creature_ID,amount>
  477. ~CRecrutationWindow();
  478. };
  479. class CSplitWindow : public IShowable, public KeyInterested
  480. {
  481. public:
  482. CGarrisonInt *gar;
  483. CSlider *slider;
  484. CCreaturePic *anim;
  485. AdventureMapButton *ok, *cancel;
  486. SDL_Surface *bitmap;
  487. int a1, a2, c;
  488. bool which;
  489. CSplitWindow(int cid, int max, CGarrisonInt *Owner);
  490. ~CSplitWindow();
  491. void activate();
  492. void split();
  493. void close();
  494. void deactivate();
  495. void show(SDL_Surface * to = NULL);
  496. void keyPressed (SDL_KeyboardEvent & key);
  497. void sliderMoved(int to);
  498. };
  499. class CCreInfoWindow : public IShowable, public KeyInterested, public ClickableR
  500. {
  501. public:
  502. bool active;
  503. int type;//0 - rclick popup; 1 - normal window
  504. SDL_Surface *bitmap;
  505. char anf;
  506. std::string count; //creature count in text format
  507. boost::function<void()> dsm;
  508. CCreaturePic *anim;
  509. CCreature *c;
  510. CInfoWindow *dependant; //it may be dialog asking whther upgrade/dismiss stack (if opened)
  511. std::vector<SComponent*> upgResCost; //cost of upgrade (if not possible then empty)
  512. AdventureMapButton *dismiss, *upgrade, *ok;
  513. CCreInfoWindow(int Cid, int Type, int creatureCount, StackState *State, boost::function<void()> Upg, boost::function<void()> Dsm, UpgradeInfo *ui);
  514. ~CCreInfoWindow();
  515. void activate();
  516. void close();
  517. void clickRight(boost::logic::tribool down);
  518. void dismissF();
  519. void keyPressed (SDL_KeyboardEvent & key);
  520. void deactivate();
  521. void show(SDL_Surface * to = NULL);
  522. void onUpgradeYes();
  523. void onUpgradeNo();
  524. };
  525. class CLevelWindow : public IShowable, public CIntObject
  526. {
  527. public:
  528. int heroType;
  529. SDL_Surface *bitmap;
  530. std::vector<CSelectableComponent *> comps; //skills to select
  531. AdventureMapButton *ok;
  532. boost::function<void(ui32)> cb;
  533. void close();
  534. CLevelWindow(const CGHeroInstance *hero, int pskill, std::vector<ui16> &skills, boost::function<void(ui32)> &callback);
  535. ~CLevelWindow();
  536. void activate();
  537. void deactivate();
  538. void selectionChanged(unsigned to);
  539. void show(SDL_Surface * to = NULL);
  540. };
  541. class CMinorResDataBar : public IShowable, public CIntObject
  542. {
  543. public:
  544. SDL_Surface *bg;
  545. void show(SDL_Surface * to=NULL);
  546. CMinorResDataBar();
  547. ~CMinorResDataBar();
  548. };
  549. class CMarketplaceWindow : public IShowActivable, public CIntObject
  550. {
  551. public:
  552. class CTradeableItem : public ClickableL
  553. {
  554. public:
  555. int type; //0 - res, 1 - artif big, 2 - artif small, 3 - player flag
  556. int id;
  557. bool left;
  558. CFunctionList<void()> callback;
  559. void activate();
  560. void deactivate();
  561. void show(SDL_Surface * to=NULL);
  562. void clickLeft(boost::logic::tribool down);
  563. SDL_Surface *getSurface();
  564. CTradeableItem(int Type, int ID, bool Left);
  565. };
  566. SDL_Surface *bg;
  567. std::vector<CTradeableItem*> left, right;
  568. std::vector<std::string> rSubs;
  569. CTradeableItem *hLeft, *hRight; //highlighted items (NULL if no highlight)
  570. int mode,//0 - res<->res; 1 - res<->plauer; 2 - buy artifact; 3 - sell artifact
  571. r1, r2;
  572. AdventureMapButton *ok, *max, *deal;
  573. CSlider *slider;
  574. void activate();
  575. void deactivate();
  576. void show(SDL_Surface * to=NULL);
  577. void setMax();
  578. void sliderMoved(int to);
  579. void makeDeal();
  580. void selectionChanged(bool side); //true == left
  581. CMarketplaceWindow(int Mode=0);
  582. ~CMarketplaceWindow();
  583. void setMode(int mode);
  584. void clear();
  585. };
  586. extern CPlayerInterface * LOCPLINT;
  587. #endif //CPLAYERINTERFACE_H