CPlayerInterface.h 19 KB

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