CAdvmapInterface.cpp 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139
  1. #include "stdafx.h"
  2. #include "CAdvmapInterface.h"
  3. #include "hch\CLodHandler.h"
  4. #include "hch\CPreGameTextHandler.h"
  5. #include "hch\CGeneralTextHandler.h"
  6. #include "hch\CTownHandler.h"
  7. #include "CPathfinder.h"
  8. #include "CGameInfo.h"
  9. #include "SDL_Extensions.h"
  10. #include "CCallback.h"
  11. #include <boost/assign/std/vector.hpp>
  12. #include "mapHandler.h"
  13. extern TTF_Font * TNRB16, *TNR, *GEOR13, *GEORXX; //fonts
  14. using namespace boost::logic;
  15. using namespace boost::assign;
  16. using namespace CSDL_Ext;
  17. CAdvMapInt::~CAdvMapInt()
  18. {
  19. SDL_FreeSurface(bg);
  20. }
  21. AdventureMapButton::AdventureMapButton ()
  22. {
  23. type=2;
  24. abs=true;
  25. active=false;
  26. ourObj=NULL;
  27. state=0;
  28. }
  29. AdventureMapButton::AdventureMapButton
  30. ( std::string Name, std::string HelpBox, void(CAdvMapInt::*Function)(), int x, int y, std::string defName, bool activ, std::vector<std::string> * add )
  31. {
  32. type=2;
  33. abs=true;
  34. active=false;
  35. ourObj=NULL;
  36. state=0;
  37. name=Name;
  38. helpBox=HelpBox;
  39. int est = LOCPLINT->playerID;
  40. CDefHandler * temp = CGI->spriteh->giveDef(defName); //todo: moze cieknac
  41. for (int i=0;i<temp->ourImages.size();i++)
  42. {
  43. imgs.resize(1);
  44. imgs[0].push_back(temp->ourImages[i].bitmap);
  45. blueToPlayersAdv(imgs[curimg][i],LOCPLINT->playerID);
  46. }
  47. if (add)
  48. {
  49. imgs.resize(imgs.size()+add->size());
  50. for (int i=0; i<add->size();i++)
  51. {
  52. temp = CGI->spriteh->giveDef((*add)[i]);
  53. for (int j=0;j<temp->ourImages.size();j++)
  54. {
  55. imgs[i+1].push_back(temp->ourImages[j].bitmap);
  56. blueToPlayersAdv(imgs[1+i][j],LOCPLINT->playerID);
  57. }
  58. }
  59. delete add;
  60. }
  61. function = Function;
  62. pos.x=x;
  63. pos.y=y;
  64. pos.w = imgs[curimg][0]->w;
  65. pos.h = imgs[curimg][0]->h -1;
  66. if (activ)
  67. activate();
  68. }
  69. void AdventureMapButton::clickLeft (tribool down)
  70. {
  71. if (down)
  72. {
  73. state=1;
  74. }
  75. else
  76. {
  77. state=0;
  78. }
  79. show();
  80. if (pressedL && (down==false))
  81. (LOCPLINT->adventureInt->*function)();
  82. pressedL=state;
  83. }
  84. void AdventureMapButton::clickRight (tribool down)
  85. {
  86. //TODO: show/hide infobox
  87. }
  88. void AdventureMapButton::hover (bool on)
  89. {
  90. Hoverable::hover(on);
  91. if (on)
  92. LOCPLINT->adventureInt->statusbar.print(name);
  93. else if (LOCPLINT->adventureInt->statusbar.current==name)
  94. LOCPLINT->adventureInt->statusbar.clear();
  95. }
  96. void AdventureMapButton::activate()
  97. {
  98. if (active) return;
  99. active=true;
  100. ClickableL::activate();
  101. Hoverable::activate();
  102. KeyInterested::activate();
  103. }
  104. void AdventureMapButton::keyPressed (SDL_KeyboardEvent & key)
  105. {
  106. //TODO: check if it's shortcut
  107. }
  108. void AdventureMapButton::deactivate()
  109. {
  110. if (!active) return;
  111. active=false;
  112. ClickableL::deactivate();
  113. Hoverable::deactivate();
  114. KeyInterested::deactivate();
  115. }
  116. void CList::activate()
  117. {
  118. ClickableL::activate();
  119. ClickableR::activate();
  120. Hoverable::activate();
  121. KeyInterested::activate();
  122. MotionInterested::activate();
  123. };
  124. void CList::deactivate()
  125. {
  126. ClickableL::deactivate();
  127. ClickableR::deactivate();
  128. Hoverable::deactivate();
  129. KeyInterested::deactivate();
  130. MotionInterested::deactivate();
  131. };
  132. void CList::clickLeft(tribool down)
  133. {
  134. };
  135. CHeroList::CHeroList()
  136. {
  137. pos = genRect(192,64,609,196);
  138. arrupp = genRect(16,64,609,196);
  139. arrdop = genRect(16,64,609,372);
  140. //32px per hero
  141. posmobx = 610;
  142. posmoby = 213;
  143. posporx = 617;
  144. pospory = 212;
  145. posmanx = 666;
  146. posmany = 213;
  147. arrup = CGI->spriteh->giveDef("IAM012.DEF");
  148. arrdo = CGI->spriteh->giveDef("IAM013.DEF");
  149. mobile = CGI->spriteh->giveDef("IMOBIL.DEF");
  150. mana = CGI->spriteh->giveDef("IMANA.DEF");
  151. empty = CGI->bitmaph->loadBitmap("HPSXXX.bmp");
  152. selection = CGI->bitmaph->loadBitmap("HPSYYY.bmp");
  153. SDL_SetColorKey(selection,SDL_SRCCOLORKEY,SDL_MapRGB(selection->format,0,255,255));
  154. from = 0;
  155. pressed = indeterminate;
  156. }
  157. void CHeroList::init()
  158. {
  159. bg = CSDL_Ext::newSurface(68,193,ekran);
  160. SDL_BlitSurface(LOCPLINT->adventureInt->bg,&genRect(193,68,607,196),bg,&genRect(193,68,0,0));
  161. }
  162. void CHeroList::genList()
  163. {
  164. int howMany = LOCPLINT->cb->howManyHeroes(LOCPLINT->playerID);
  165. for (int i=0;i<howMany;i++)
  166. {
  167. items.push_back(std::pair<const CHeroInstance *,CPath *>(LOCPLINT->cb->getHeroInfo(LOCPLINT->playerID,i,0),NULL));
  168. }
  169. }
  170. void CHeroList::select(int which)
  171. {
  172. selected = which;
  173. if (which>=items.size())
  174. return;
  175. LOCPLINT->adventureInt->centerOn(items[which].first->pos);
  176. LOCPLINT->adventureInt->selection.type = HEROI_TYPE;
  177. LOCPLINT->adventureInt->selection.selected = items[which].first;
  178. LOCPLINT->adventureInt->terrain.currentPath = items[which].second;
  179. draw();
  180. LOCPLINT->adventureInt->townList.draw();
  181. }
  182. void CHeroList::clickLeft(tribool down)
  183. {
  184. if (down)
  185. {
  186. /***************************ARROWS*****************************************/
  187. if(isItIn(&arrupp,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y) && from>0)
  188. {
  189. blitAtWR(arrup->ourImages[1].bitmap,arrupp.x,arrupp.y);
  190. pressed = true;
  191. return;
  192. }
  193. else if(isItIn(&arrdop,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y) && (items.size()-from>5))
  194. {
  195. blitAtWR(arrdo->ourImages[1].bitmap,arrdop.x,arrdop.y);
  196. pressed = false;
  197. return;
  198. }
  199. /***************************HEROES*****************************************/
  200. int hx = LOCPLINT->current->motion.x, hy = LOCPLINT->current->motion.y;
  201. hx-=pos.x;
  202. hy-=pos.y; hy-=arrup->ourImages[0].bitmap->h;
  203. float ny = (float)hy/(float)32;
  204. if (ny>5 || ny<0)
  205. return;
  206. select(ny+from);
  207. }
  208. else
  209. {
  210. if (indeterminate(pressed))
  211. return;
  212. if (pressed) //up
  213. {
  214. blitAtWR(arrup->ourImages[0].bitmap,arrupp.x,arrupp.y);
  215. pressed = indeterminate;
  216. if (!down)
  217. {
  218. from--;
  219. if (from<0)
  220. from=0;
  221. draw();
  222. }
  223. }
  224. else if (!pressed) //down
  225. {
  226. blitAtWR(arrdo->ourImages[0].bitmap,arrdop.x,arrdop.y);
  227. pressed = indeterminate;
  228. if (!down)
  229. {
  230. from++;
  231. if (from<items.size()-5)
  232. from=items.size()-5;
  233. draw();
  234. }
  235. }
  236. else
  237. throw 0;
  238. }
  239. }
  240. void CHeroList::mouseMoved (SDL_MouseMotionEvent & sEvent)
  241. {
  242. if(isItIn(&arrupp,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y))
  243. {
  244. if (from>0)
  245. LOCPLINT->adventureInt->statusbar.print(CGI->preth->advHListUp.first);
  246. else
  247. LOCPLINT->adventureInt->statusbar.clear();
  248. return;
  249. }
  250. else if(isItIn(&arrdop,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y))
  251. {
  252. if ((items.size()-from) > 5)
  253. LOCPLINT->adventureInt->statusbar.print(CGI->preth->advHListDown.first);
  254. else
  255. LOCPLINT->adventureInt->statusbar.clear();
  256. return;
  257. }
  258. //if not buttons then heroes
  259. int hx = LOCPLINT->current->motion.x, hy = LOCPLINT->current->motion.y;
  260. hx-=pos.x;
  261. hy-=pos.y; hy-=arrup->ourImages[0].bitmap->h;
  262. float ny = (float)hy/(float)32;
  263. if ((ny>5 || ny<0) || (from+ny>=items.size()))
  264. {
  265. LOCPLINT->adventureInt->statusbar.clear();
  266. return;
  267. }
  268. std::vector<std::string> temp;
  269. temp+=(items[from+ny].first->name),(items[from+ny].first->type->heroClass->name);
  270. LOCPLINT->adventureInt->statusbar.print( processStr(CGI->generaltexth->allTexts[15],temp) );
  271. //select(ny+from);
  272. }
  273. void CHeroList::clickRight(tribool down)
  274. {
  275. }
  276. void CHeroList::hover (bool on)
  277. {
  278. }
  279. void CHeroList::keyPressed (SDL_KeyboardEvent & key)
  280. {
  281. }
  282. void CHeroList::draw()
  283. {
  284. for (int iT=0+from;iT<5+from;iT++)
  285. {
  286. int i = iT-from;
  287. if (iT>=items.size())
  288. {
  289. blitAtWR(mobile->ourImages[0].bitmap,posmobx,posmoby+i*32);
  290. blitAtWR(mana->ourImages[0].bitmap,posmanx,posmany+i*32);
  291. blitAtWR(empty,posporx,pospory+i*32);
  292. continue;
  293. }
  294. int pom = (LOCPLINT->cb->getHeroInfo(LOCPLINT->playerID,iT,0)->movement)/100;
  295. if (pom>25) pom=25;
  296. if (pom<0) pom=0;
  297. blitAtWR(mobile->ourImages[pom].bitmap,posmobx,posmoby+i*32); //move point
  298. pom = (LOCPLINT->cb->getHeroInfo(LOCPLINT->playerID,iT,0)->mana)/5; //bylo: .../10;
  299. if (pom>25) pom=25;
  300. if (pom<0) pom=0;
  301. blitAtWR(mana->ourImages[pom].bitmap,posmanx,posmany+i*32); //mana
  302. SDL_Surface * temp = LOCPLINT->cb->getHeroInfo(LOCPLINT->playerID,iT,0)->type->portraitSmall;
  303. blitAtWR(temp,posporx,pospory+i*32);
  304. if ((selected == iT) && (LOCPLINT->adventureInt->selection.type == HEROI_TYPE))
  305. {
  306. blitAtWR(selection,posporx,pospory+i*32);
  307. }
  308. //TODO: support for custom portraits
  309. }
  310. if (from>0)
  311. blitAtWR(arrup->ourImages[0].bitmap,arrupp.x,arrupp.y);
  312. else
  313. blitAtWR(arrup->ourImages[2].bitmap,arrupp.x,arrupp.y);
  314. if (items.size()-from>5)
  315. blitAtWR(arrdo->ourImages[0].bitmap,arrdop.x,arrdop.y);
  316. else
  317. blitAtWR(arrdo->ourImages[2].bitmap,arrdop.x,arrdop.y);
  318. }
  319. CTownList::CTownList()
  320. {
  321. pos = genRect(192,48,747,196);
  322. arrup = CGI->spriteh->giveDef("IAM014.DEF");
  323. arrdo = CGI->spriteh->giveDef("IAM015.DEF");
  324. arrupp.x=747;
  325. arrupp.y=196;
  326. arrupp.w=arrup->ourImages[0].bitmap->w;
  327. arrupp.h=arrup->ourImages[0].bitmap->h;
  328. arrdop.x=747;
  329. arrdop.y=372;
  330. arrdop.w=arrdo->ourImages[0].bitmap->w;
  331. arrdop.h=arrdo->ourImages[0].bitmap->h;
  332. posporx = 747;
  333. pospory = 212;
  334. pressed = indeterminate;
  335. from = 0;
  336. }
  337. void CTownList::genList()
  338. {
  339. int howMany = LOCPLINT->cb->howManyTowns();
  340. for (int i=0;i<howMany;i++)
  341. {
  342. items.push_back(LOCPLINT->cb->getTownInfo(i,0));
  343. }
  344. }
  345. void CTownList::select(int which)
  346. {
  347. selected = which;
  348. if (which>=items.size())
  349. return;
  350. LOCPLINT->adventureInt->centerOn(items[which]->pos);
  351. LOCPLINT->adventureInt->selection.type = TOWNI_TYPE;
  352. LOCPLINT->adventureInt->selection.selected = items[which];
  353. LOCPLINT->adventureInt->terrain.currentPath = NULL;
  354. draw();
  355. LOCPLINT->adventureInt->heroList.draw();
  356. }
  357. void CTownList::mouseMoved (SDL_MouseMotionEvent & sEvent)
  358. {
  359. }
  360. void CTownList::clickLeft(tribool down)
  361. {
  362. if (down)
  363. {
  364. /***************************ARROWS*****************************************/
  365. if(isItIn(&arrupp,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y) && from>0)
  366. {
  367. blitAtWR(arrup->ourImages[1].bitmap,arrupp.x,arrupp.y);
  368. pressed = true;
  369. return;
  370. }
  371. else if(isItIn(&arrdop,LOCPLINT->current->motion.x,LOCPLINT->current->motion.y) && (items.size()-from>5))
  372. {
  373. blitAtWR(arrdo->ourImages[1].bitmap,arrdop.x,arrdop.y);
  374. pressed = false;
  375. return;
  376. }
  377. /***************************HEROES*****************************************/
  378. int hx = LOCPLINT->current->motion.x, hy = LOCPLINT->current->motion.y;
  379. hx-=pos.x;
  380. hy-=pos.y; hy-=arrup->ourImages[0].bitmap->h;
  381. float ny = (float)hy/(float)32;
  382. if (ny>5 || ny<0)
  383. return;
  384. select(ny+from);
  385. }
  386. else
  387. {
  388. if (indeterminate(pressed))
  389. return;
  390. if (pressed) //up
  391. {
  392. blitAtWR(arrup->ourImages[0].bitmap,arrupp.x,arrupp.y);
  393. pressed = indeterminate;
  394. if (!down)
  395. {
  396. from--;
  397. if (from<0)
  398. from=0;
  399. draw();
  400. }
  401. }
  402. else if (!pressed) //down
  403. {
  404. blitAtWR(arrdo->ourImages[0].bitmap,arrdop.x,arrdop.y);
  405. pressed = indeterminate;
  406. if (!down)
  407. {
  408. from++;
  409. if (from<items.size()-5)
  410. from=items.size()-5;
  411. draw();
  412. }
  413. }
  414. else
  415. throw 0;
  416. }
  417. }
  418. void CTownList::clickRight(tribool down)
  419. {
  420. }
  421. void CTownList::hover (bool on)
  422. {
  423. }
  424. void CTownList::keyPressed (SDL_KeyboardEvent & key)
  425. {
  426. }
  427. void CTownList::draw()
  428. {
  429. for (int iT=0+from;iT<5+from;iT++)
  430. {
  431. int i = iT-from;
  432. if (iT>=items.size())
  433. {
  434. blitAtWR(CGI->townh->getPic(-1),posporx,pospory+i*32);
  435. continue;
  436. }
  437. blitAtWR(CGI->townh->getPic(items[i]->type),posporx,pospory+i*32);
  438. if ((selected == iT) && (LOCPLINT->adventureInt->selection.type == TOWNI_TYPE))
  439. {
  440. blitAtWR(CGI->townh->getPic(-2),posporx,pospory+i*32);
  441. }
  442. //TODO: dodac oznaczanie zbudowania w danej turze i posiadania fortu
  443. }
  444. if (from>0)
  445. blitAtWR(arrup->ourImages[0].bitmap,arrupp.x,arrupp.y);
  446. else
  447. blitAtWR(arrup->ourImages[2].bitmap,arrupp.x,arrupp.y);
  448. if (items.size()-from>5)
  449. blitAtWR(arrdo->ourImages[0].bitmap,arrdop.x,arrdop.y);
  450. else
  451. blitAtWR(arrdo->ourImages[2].bitmap,arrdop.x,arrdop.y);
  452. }
  453. CStatusBar::CStatusBar(int x, int y)
  454. {
  455. bg=CGI->bitmaph->loadBitmap("ADROLLVR.bmp");
  456. SDL_SetColorKey(bg,SDL_SRCCOLORKEY,SDL_MapRGB(bg->format,0,255,255));
  457. pos.x=x;
  458. pos.y=y;
  459. pos.w=bg->w;
  460. pos.h=bg->h;
  461. middlex=(bg->w/2)+x;
  462. middley=(bg->h/2)+y;
  463. }
  464. CStatusBar::~CStatusBar()
  465. {
  466. SDL_FreeSurface(bg);
  467. }
  468. void CStatusBar::clear()
  469. {
  470. current="";
  471. blitAtWR(bg,pos.x,pos.y);
  472. }
  473. void CStatusBar::print(std::string text)
  474. {
  475. current=text;
  476. blitAtWR(bg,pos.x,pos.y);
  477. printAtMiddle(current,middlex,middley,GEOR13,zwykly);
  478. }
  479. void CStatusBar::show()
  480. {
  481. blitAtWR(bg,pos.x,pos.y);
  482. printAtMiddle(current,middlex,middley,GEOR13,zwykly);
  483. }
  484. CMinimap::CMinimap(bool draw)
  485. {
  486. statusbarTxt = CGI->preth->advWorldMap.first;
  487. pos.x=630;
  488. pos.y=26;
  489. pos.h=pos.w=144;
  490. radar = CGI->spriteh->giveDef("RADAR.DEF");
  491. std::ifstream is("config/minimap.txt",std::ifstream::in);
  492. for (int i=0;i<TERRAIN_TYPES;i++)
  493. {
  494. std::pair<int,SDL_Color> vinya;
  495. std::pair<int,SDL_Color> vinya2;
  496. int pom;
  497. is >> pom;
  498. vinya2.first=vinya.first=pom;
  499. is >> pom;
  500. vinya.second.r=pom;
  501. is >> pom;
  502. vinya.second.g=pom;
  503. is >> pom;
  504. vinya.second.b=pom;
  505. is >> pom;
  506. vinya2.second.r=pom;
  507. is >> pom;
  508. vinya2.second.g=pom;
  509. is >> pom;
  510. vinya2.second.b=pom;
  511. vinya.second.unused=vinya2.second.unused=255;
  512. colors.insert(vinya);
  513. colorsBlocked.insert(vinya2);
  514. }
  515. is.close();
  516. if (draw)
  517. redraw();
  518. }
  519. void CMinimap::draw()
  520. {
  521. blitAtWR(map[LOCPLINT->adventureInt->position.z],pos.x,pos.y);
  522. }
  523. void CMinimap::redraw(int level)// (level==-1) => redraw all levels
  524. {
  525. (CGameInfo::mainObj);
  526. for (int i=0; i<CGI->mh->sizes.z; i++)
  527. {
  528. SDL_Surface * pom ;
  529. if ((level>=0) && (i!=level))
  530. continue;
  531. if (map.size()<i+1)
  532. pom = CSDL_Ext::newSurface(pos.w,pos.h,ekran);
  533. else pom = map[i];
  534. for (int x=0;x<pos.w;x++)
  535. {
  536. for (int y=0;y<pos.h;y++)
  537. {
  538. int mx=(CGI->mh->sizes.x*x)/pos.w;
  539. int my=(CGI->mh->sizes.y*y)/pos.h;
  540. if (CGI->mh->ttiles[mx][my][i].blocked && (!CGI->mh->ttiles[mx][my][i].visitable))
  541. SDL_PutPixel(pom,x,y,colorsBlocked[CGI->mh->ttiles[mx][my][i].terType].r,colorsBlocked[CGI->mh->ttiles[mx][my][i].terType].g,colorsBlocked[CGI->mh->ttiles[mx][my][i].terType].b);
  542. else SDL_PutPixel(pom,x,y,colors[CGI->mh->ttiles[mx][my][i].terType].r,colors[CGI->mh->ttiles[mx][my][i].terType].g,colors[CGI->mh->ttiles[mx][my][i].terType].b);
  543. }
  544. }
  545. map.push_back(pom);
  546. }
  547. }
  548. void CMinimap::updateRadar()
  549. {}
  550. void CMinimap::clickRight (tribool down)
  551. {}
  552. void CMinimap::clickLeft (tribool down)
  553. {
  554. if (down && (!pressedL))
  555. MotionInterested::activate();
  556. else if (!down)
  557. {
  558. if (std::find(LOCPLINT->motioninterested.begin(),LOCPLINT->motioninterested.end(),this)!=LOCPLINT->motioninterested.end())
  559. MotionInterested::deactivate();
  560. }
  561. ClickableL::clickLeft(down);
  562. if (!((bool)down))
  563. return;
  564. float dx=((float)(LOCPLINT->current->motion.x-pos.x))/((float)pos.w),
  565. dy=((float)(LOCPLINT->current->motion.y-pos.y))/((float)pos.h);
  566. int3 newCPos;
  567. newCPos.x = (CGI->mh->sizes.x*dx);
  568. newCPos.y = (CGI->mh->sizes.y*dy);
  569. newCPos.z = LOCPLINT->adventureInt->position.z;
  570. LOCPLINT->adventureInt->centerOn(newCPos);
  571. }
  572. void CMinimap::hover (bool on)
  573. {
  574. Hoverable::hover(on);
  575. if (on)
  576. LOCPLINT->adventureInt->statusbar.print(statusbarTxt);
  577. else if (LOCPLINT->adventureInt->statusbar.current==statusbarTxt)
  578. LOCPLINT->adventureInt->statusbar.clear();
  579. }
  580. void CMinimap::mouseMoved (SDL_MouseMotionEvent & sEvent)
  581. {
  582. if (pressedL)
  583. {
  584. clickLeft(true);
  585. }
  586. }
  587. void CMinimap::activate()
  588. {
  589. ClickableL::activate();
  590. ClickableR::activate();
  591. Hoverable::activate();
  592. if (pressedL)
  593. MotionInterested::activate();
  594. }
  595. void CMinimap::deactivate()
  596. {
  597. if (pressedL)
  598. MotionInterested::deactivate();
  599. ClickableL::deactivate();
  600. ClickableR::deactivate();
  601. Hoverable::deactivate();
  602. }
  603. CTerrainRect::CTerrainRect():currentPath(NULL)
  604. {
  605. tilesw=19;
  606. tilesh=18;
  607. pos.x=7;
  608. pos.y=6;
  609. pos.w=593;
  610. pos.h=547;
  611. arrows = CGI->spriteh->giveDef("ADAG.DEF");
  612. for(int y=0; y<arrows->ourImages.size(); ++y)
  613. {
  614. CSDL_Ext::fullAlphaTransform(arrows->ourImages[y].bitmap);
  615. }
  616. }
  617. void CTerrainRect::activate()
  618. {
  619. ClickableL::activate();
  620. ClickableR::activate();
  621. Hoverable::activate();
  622. KeyInterested::activate();
  623. };
  624. void CTerrainRect::deactivate()
  625. {
  626. ClickableL::deactivate();
  627. ClickableR::deactivate();
  628. Hoverable::deactivate();
  629. KeyInterested::deactivate();
  630. };
  631. void CTerrainRect::clickLeft(tribool down)
  632. {
  633. if ((down==false) || indeterminate(down))
  634. return;
  635. if (LOCPLINT->adventureInt->selection.type != HEROI_TYPE)
  636. {
  637. if (currentPath)
  638. {
  639. delete currentPath;
  640. currentPath = NULL;
  641. }
  642. return;
  643. }
  644. int3 mp;
  645. mp.x = LOCPLINT->adventureInt->position.x + ((LOCPLINT->current->motion.x-pos.x)/32);
  646. mp.y = LOCPLINT->adventureInt->position.y + ((LOCPLINT->current->motion.y-pos.y)/32);
  647. mp.z = LOCPLINT->adventureInt->position.z;
  648. if ((mp.x<0) || (mp.y<0))
  649. return;
  650. if (currentPath)
  651. {
  652. if ( (currentPath->endPos()) == mp)
  653. { //move
  654. CPath sended(*currentPath); //temporary path - engine will operate on it
  655. LOCPLINT->cb->moveHero( ((const CHeroInstance*)LOCPLINT->adventureInt->selection.selected)->type->ID,&sended,1,0);
  656. }
  657. else
  658. {
  659. delete currentPath;
  660. currentPath=NULL;
  661. }
  662. }
  663. const CHeroInstance * currentHero = LOCPLINT->adventureInt->heroList.items[LOCPLINT->adventureInt->heroList.selected].first;
  664. int3 bufpos = currentHero->getPosition(false);
  665. //bufpos.x-=1;
  666. currentPath = LOCPLINT->adventureInt->heroList.items[LOCPLINT->adventureInt->heroList.selected].second = CGI->pathf->getPath(bufpos,mp,currentHero,1);
  667. }
  668. void CTerrainRect::clickRight(tribool down)
  669. {
  670. }
  671. void CTerrainRect::mouseMoved (SDL_MouseMotionEvent & sEvent)
  672. {
  673. //TODO: print names of objects in toolbar
  674. }
  675. void CTerrainRect::hover(bool on){}
  676. void CTerrainRect::keyPressed (SDL_KeyboardEvent & key){}
  677. void CTerrainRect::show()
  678. {
  679. SDL_Surface * teren = CGI->mh->terrainRect
  680. (LOCPLINT->adventureInt->position.x,LOCPLINT->adventureInt->position.y,
  681. tilesw,tilesh,LOCPLINT->adventureInt->position.z,LOCPLINT->adventureInt->anim);
  682. SDL_BlitSurface(teren,&genRect(pos.h,pos.w,0,0),ekran,&genRect(547,594,7,6));
  683. SDL_FreeSurface(teren);
  684. if (currentPath) //drawing path
  685. {
  686. for (int i=0;i<currentPath->nodes.size()-1;i++)
  687. {
  688. int pn=-1;//number of picture
  689. if (i==0) //last tile
  690. {
  691. int x = 32*(currentPath->nodes[i].coord.x-LOCPLINT->adventureInt->position.x)+7,
  692. y = 32*(currentPath->nodes[i].coord.y-LOCPLINT->adventureInt->position.y)+6;
  693. if (x<0 || y<0 || x>pos.w || y>pos.h)
  694. continue;
  695. pn=0;
  696. }
  697. else
  698. {
  699. std::vector<CPathNode> & cv = currentPath->nodes;
  700. if (cv[i+1].coord.x == cv[i].coord.x-1 && cv[i+1].coord.y == cv[i].coord.y-1)
  701. {
  702. if(cv[i-1].coord.x == cv[i].coord.x+1 && cv[i-1].coord.y == cv[i].coord.y)
  703. {
  704. pn = 3;
  705. }
  706. else if(cv[i-1].coord.x == cv[i].coord.x+1 && cv[i-1].coord.y == cv[i].coord.y+1)
  707. {
  708. pn = 12;
  709. }
  710. else if(cv[i-1].coord.x == cv[i].coord.x && cv[i-1].coord.y == cv[i].coord.y+1)
  711. {
  712. pn = 21;
  713. }
  714. else if(cv[i-1].coord.x == cv[i].coord.x-1 && cv[i-1].coord.y == cv[i].coord.y+1)
  715. {
  716. pn = 22;
  717. }
  718. else if(cv[i-1].coord.x == cv[i].coord.x+1 && cv[i-1].coord.y == cv[i].coord.y-1)
  719. {
  720. pn = 2;
  721. }
  722. }
  723. else if (cv[i+1].coord.x == cv[i].coord.x && cv[i+1].coord.y == cv[i].coord.y-1)
  724. {
  725. if(cv[i-1].coord.x == cv[i].coord.x+1 && cv[i-1].coord.y == cv[i].coord.y+1)
  726. {
  727. pn = 4;
  728. }
  729. else if(cv[i-1].coord.x == cv[i].coord.x && cv[i-1].coord.y == cv[i].coord.y+1)
  730. {
  731. pn = 13;
  732. }
  733. else if(cv[i-1].coord.x == cv[i].coord.x-1 && cv[i-1].coord.y == cv[i].coord.y+1)
  734. {
  735. pn = 22;
  736. }
  737. }
  738. else if (cv[i+1].coord.x == cv[i].coord.x+1 && cv[i+1].coord.y == cv[i].coord.y-1)
  739. {
  740. if(cv[i-1].coord.x == cv[i].coord.x && cv[i-1].coord.y == cv[i].coord.y+1)
  741. {
  742. pn = 5;
  743. }
  744. else if(cv[i-1].coord.x == cv[i].coord.x-1 && cv[i-1].coord.y == cv[i].coord.y+1)
  745. {
  746. pn = 14;
  747. }
  748. else if(cv[i-1].coord.x+1 == cv[i].coord.x && cv[i-1].coord.y == cv[i].coord.y)
  749. {
  750. pn = 23;
  751. }
  752. else if(cv[i-1].coord.x == cv[i].coord.x-1 && cv[i-1].coord.y == cv[i].coord.y-1)
  753. {
  754. pn = 24;
  755. }
  756. else if(cv[i-1].coord.x == cv[i].coord.x+1 && cv[i-1].coord.y == cv[i].coord.y+1)
  757. {
  758. pn = 4;
  759. }
  760. }
  761. else if (cv[i+1].coord.x == cv[i].coord.x+1 && cv[i+1].coord.y == cv[i].coord.y)
  762. {
  763. if(cv[i-1].coord.x == cv[i].coord.x-1 && cv[i-1].coord.y == cv[i].coord.y+1)
  764. {
  765. pn = 6;
  766. }
  767. else if(cv[i-1].coord.x == cv[i].coord.x-1 && cv[i-1].coord.y == cv[i].coord.y)
  768. {
  769. pn = 15;
  770. }
  771. else if(cv[i-1].coord.x == cv[i].coord.x-1 && cv[i-1].coord.y == cv[i].coord.y-1)
  772. {
  773. pn = 24;
  774. }
  775. }
  776. else if (cv[i+1].coord.x == cv[i].coord.x+1 && cv[i+1].coord.y == cv[i].coord.y+1)
  777. {
  778. if(cv[i-1].coord.x == cv[i].coord.x-1 && cv[i-1].coord.y == cv[i].coord.y)
  779. {
  780. pn = 7;
  781. }
  782. else if(cv[i-1].coord.x == cv[i].coord.x-1 && cv[i-1].coord.y == cv[i].coord.y-1)
  783. {
  784. pn = 16;
  785. }
  786. else if(cv[i-1].coord.x == cv[i].coord.x && cv[i-1].coord.y == cv[i].coord.y-1)
  787. {
  788. pn = 17;
  789. }
  790. else if(cv[i-1].coord.x == cv[i].coord.x-1 && cv[i-1].coord.y == cv[i].coord.y+1)
  791. {
  792. pn = 6;
  793. }
  794. else if(cv[i-1].coord.x == cv[i].coord.x+1 && cv[i-1].coord.y == cv[i].coord.y-1)
  795. {
  796. pn = 18;
  797. }
  798. }
  799. else if (cv[i+1].coord.x == cv[i].coord.x && cv[i+1].coord.y == cv[i].coord.y+1)
  800. {
  801. if(cv[i-1].coord.x == cv[i].coord.x-1 && cv[i-1].coord.y == cv[i].coord.y-1)
  802. {
  803. pn = 8;
  804. }
  805. else if(cv[i-1].coord.x == cv[i].coord.x && cv[i-1].coord.y == cv[i].coord.y-1)
  806. {
  807. pn = 9;
  808. }
  809. else if(cv[i-1].coord.x == cv[i].coord.x+1 && cv[i-1].coord.y == cv[i].coord.y-1)
  810. {
  811. pn = 18;
  812. }
  813. }
  814. else if (cv[i+1].coord.x == cv[i].coord.x-1 && cv[i+1].coord.y == cv[i].coord.y+1)
  815. {
  816. if(cv[i-1].coord.x == cv[i].coord.x && cv[i-1].coord.y == cv[i].coord.y-1)
  817. {
  818. pn = 1;
  819. }
  820. else if(cv[i-1].coord.x == cv[i].coord.x+1 && cv[i-1].coord.y == cv[i].coord.y-1)
  821. {
  822. pn = 10;
  823. }
  824. else if(cv[i-1].coord.x == cv[i].coord.x+1 && cv[i-1].coord.y == cv[i].coord.y)
  825. {
  826. pn = 19;
  827. }
  828. else if(cv[i-1].coord.x == cv[i].coord.x-1 && cv[i-1].coord.y == cv[i].coord.y-1)
  829. {
  830. pn = 8;
  831. }
  832. else if(cv[i-1].coord.x == cv[i].coord.x+1 && cv[i-1].coord.y == cv[i].coord.y+1)
  833. {
  834. pn = 20;
  835. }
  836. }
  837. else if (cv[i+1].coord.x == cv[i].coord.x-1 && cv[i+1].coord.y == cv[i].coord.y)
  838. {
  839. if(cv[i-1].coord.x == cv[i].coord.x+1 && cv[i-1].coord.y == cv[i].coord.y-1)
  840. {
  841. pn = 2;
  842. }
  843. else if(cv[i-1].coord.x == cv[i].coord.x+1 && cv[i-1].coord.y == cv[i].coord.y)
  844. {
  845. pn = 11;
  846. }
  847. else if(cv[i-1].coord.x == cv[i].coord.x+1 && cv[i-1].coord.y == cv[i].coord.y+1)
  848. {
  849. pn = 20;
  850. }
  851. }
  852. }
  853. if (pn>=0)
  854. {
  855. int x = 32*(currentPath->nodes[i].coord.x-LOCPLINT->adventureInt->position.x)+7,
  856. y = 32*(currentPath->nodes[i].coord.y-LOCPLINT->adventureInt->position.y)+6;
  857. if (x<0 || y<0 || x>pos.w || y>pos.h)
  858. continue;
  859. int hvx = (x+arrows->ourImages[pn].bitmap->w)-(pos.x+pos.w),
  860. hvy = (y+arrows->ourImages[pn].bitmap->h)-(pos.y+pos.h);
  861. if (hvx<0 && hvy<0)
  862. blitAtWR(arrows->ourImages[pn].bitmap,x,y);
  863. else if(hvx<0)
  864. SDL_BlitSurface
  865. (arrows->ourImages[pn].bitmap,&genRect(arrows->ourImages[pn].bitmap->h-hvy,arrows->ourImages[pn].bitmap->w,0,0),
  866. ekran,&genRect(arrows->ourImages[pn].bitmap->h-hvy,arrows->ourImages[pn].bitmap->w,x,y));
  867. else if (hvy<0)
  868. {
  869. SDL_BlitSurface
  870. (arrows->ourImages[pn].bitmap,&genRect(arrows->ourImages[pn].bitmap->h,arrows->ourImages[pn].bitmap->w-hvx,0,0),
  871. ekran,&genRect(arrows->ourImages[pn].bitmap->h,arrows->ourImages[pn].bitmap->w-hvx,x,y));
  872. }
  873. else
  874. SDL_BlitSurface
  875. (arrows->ourImages[pn].bitmap,&genRect(arrows->ourImages[pn].bitmap->h-hvy,arrows->ourImages[pn].bitmap->w-hvx,0,0),
  876. ekran,&genRect(arrows->ourImages[pn].bitmap->h-hvy,arrows->ourImages[pn].bitmap->w-hvx,x,y));
  877. }
  878. } //for (int i=0;i<currentPath->nodes.size()-1;i++)
  879. } // if (currentPath)
  880. }
  881. void CResDataBar::clickRight (tribool down)
  882. {
  883. }
  884. void CResDataBar::activate()
  885. {
  886. ClickableR::activate();
  887. }
  888. void CResDataBar::deactivate()
  889. {
  890. ClickableR::deactivate();
  891. }
  892. CResDataBar::CResDataBar()
  893. {
  894. bg = CGI->bitmaph->loadBitmap("ZRESBAR.bmp");
  895. SDL_SetColorKey(bg,SDL_SRCCOLORKEY,SDL_MapRGB(bg->format,0,255,255));
  896. blueToPlayersAdv(bg,LOCPLINT->playerID);
  897. //blueToPlayersNice(bg,LOCPLINT->playerID);
  898. pos = genRect(bg->h,bg->w,3,575);
  899. txtpos += (std::pair<int,int>(35,577)),(std::pair<int,int>(120,577)),(std::pair<int,int>(205,577)),
  900. (std::pair<int,int>(290,577)),(std::pair<int,int>(375,577)),(std::pair<int,int>(460,577)),
  901. (std::pair<int,int>(545,577)),(std::pair<int,int>(620,577));
  902. datetext = CGI->generaltexth->allTexts[62]+": %s, " + CGI->generaltexth->allTexts[63] + ": %s, " +
  903. CGI->generaltexth->allTexts[64] + ": %s";
  904. }
  905. CResDataBar::~CResDataBar()
  906. {
  907. SDL_FreeSurface(bg);
  908. }
  909. void CResDataBar::draw()
  910. {
  911. blitAt(bg,pos.x,pos.y);
  912. char * buf = new char[15];
  913. for (int i=0;i<7;i++)
  914. {
  915. itoa(LOCPLINT->cb->getResourceAmount(i),buf,10);
  916. printAt(buf,txtpos[i].first,txtpos[i].second,GEOR13,zwykly);
  917. }
  918. std::vector<std::string> temp;
  919. itoa(LOCPLINT->cb->getDate(3),buf,10); temp+=std::string(buf);
  920. itoa(LOCPLINT->cb->getDate(2),buf,10); temp+=std::string(buf);
  921. itoa(LOCPLINT->cb->getDate(1),buf,10); temp+=std::string(buf);
  922. printAt(processStr(datetext,temp),txtpos[7].first,txtpos[7].second,GEOR13,zwykly);
  923. temp.clear();
  924. updateRect(&pos,ekran);
  925. delete buf;
  926. }
  927. CInfoBar::CInfoBar()
  928. {
  929. pos.x=604;
  930. pos.y=389;
  931. pos.w=194;
  932. pos.h=186;
  933. }
  934. void CInfoBar::draw(void * specific)
  935. {
  936. SDL_Surface * todr = LOCPLINT->infoWin(specific);
  937. blitAt(todr,pos.x,pos.y);
  938. SDL_FreeSurface(todr);
  939. }
  940. CAdvMapInt::CAdvMapInt(int Player)
  941. :player(Player),
  942. statusbar(7,556),
  943. kingOverview(CGI->preth->advKingdomOverview.first,CGI->preth->advKingdomOverview.second,
  944. &CAdvMapInt::fshowOverview, 679, 196, "IAM002.DEF"),
  945. underground(CGI->preth->advSurfaceSwitch.first,CGI->preth->advSurfaceSwitch.second,
  946. &CAdvMapInt::fswitchLevel, 711, 196, "IAM010.DEF", false, new std::vector<std::string>(1,std::string("IAM003.DEF"))),
  947. questlog(CGI->preth->advQuestlog.first,CGI->preth->advQuestlog.second,
  948. &CAdvMapInt::fshowQuestlog, 679, 228, "IAM004.DEF"),
  949. sleepWake(CGI->preth->advSleepWake.first,CGI->preth->advSleepWake.second,
  950. &CAdvMapInt::fsleepWake, 711, 228, "IAM005.DEF"),
  951. moveHero(CGI->preth->advMoveHero.first,CGI->preth->advMoveHero.second,
  952. &CAdvMapInt::fmoveHero, 679, 260, "IAM006.DEF"),
  953. spellbook(CGI->preth->advCastSpell.first,CGI->preth->advCastSpell.second,
  954. &CAdvMapInt::fshowSpellbok, 711, 260, "IAM007.DEF"),
  955. advOptions(CGI->preth->advAdvOptions.first,CGI->preth->advAdvOptions.second,
  956. &CAdvMapInt::fadventureOPtions, 679, 292, "IAM008.DEF"),
  957. sysOptions(CGI->preth->advSystemOptions.first,CGI->preth->advSystemOptions.second,
  958. &CAdvMapInt::fsystemOptions, 711, 292, "IAM009.DEF"),
  959. nextHero(CGI->preth->advNextHero.first,CGI->preth->advNextHero.second,
  960. &CAdvMapInt::fnextHero, 679, 324, "IAM000.DEF"),
  961. endTurn(CGI->preth->advEndTurn.first,CGI->preth->advEndTurn.second,
  962. &CAdvMapInt::fendTurn, 679, 356, "IAM001.DEF")
  963. {
  964. LOCPLINT->adventureInt=this;
  965. bg = CGI->bitmaph->loadBitmap("ADVMAP.bmp");
  966. blueToPlayersAdv(bg,player);
  967. scrollingLeft = false;
  968. scrollingRight = false;
  969. scrollingUp = false ;
  970. scrollingDown = false ;
  971. updateScreen = false;
  972. anim=0;
  973. animValHitCount=0; //animation frame
  974. heroList.init();
  975. heroList.genList();
  976. //townList.init();
  977. townList.genList();
  978. gems.push_back(CGI->spriteh->giveDef("agemLL.def"));
  979. gems.push_back(CGI->spriteh->giveDef("agemLR.def"));
  980. gems.push_back(CGI->spriteh->giveDef("agemUL.def"));
  981. gems.push_back(CGI->spriteh->giveDef("agemUR.def"));
  982. }
  983. void CAdvMapInt::fshowOverview()
  984. {
  985. }
  986. void CAdvMapInt::fswitchLevel()
  987. {
  988. if(!CGI->ac->map.twoLevel)
  989. return;
  990. if (position.z)
  991. {
  992. position.z--;
  993. underground.curimg=0;
  994. underground.show();
  995. }
  996. else
  997. {
  998. underground.curimg=1;
  999. position.z++;
  1000. underground.show();
  1001. }
  1002. updateScreen = true;
  1003. minimap.draw();
  1004. }
  1005. void CAdvMapInt::fshowQuestlog()
  1006. {
  1007. }
  1008. void CAdvMapInt::fsleepWake()
  1009. {
  1010. }
  1011. void CAdvMapInt::fmoveHero()
  1012. {
  1013. }
  1014. void CAdvMapInt::fshowSpellbok()
  1015. {
  1016. }
  1017. void CAdvMapInt::fadventureOPtions()
  1018. {
  1019. }
  1020. void CAdvMapInt::fsystemOptions()
  1021. {
  1022. }
  1023. void CAdvMapInt::fnextHero()
  1024. {
  1025. }
  1026. void CAdvMapInt::fendTurn()
  1027. {
  1028. }
  1029. void CAdvMapInt::show()
  1030. {
  1031. blitAt(bg,0,0);
  1032. kingOverview.show();
  1033. kingOverview.activate();
  1034. underground.show();
  1035. underground.activate();
  1036. questlog.show();
  1037. questlog.activate();
  1038. sleepWake.show();
  1039. sleepWake.activate();
  1040. moveHero.show();
  1041. moveHero.activate();
  1042. spellbook.show();
  1043. spellbook.activate();
  1044. advOptions.show();
  1045. advOptions.activate();
  1046. sysOptions.show();
  1047. sysOptions.activate();
  1048. nextHero.show();
  1049. nextHero.activate();
  1050. endTurn.show();
  1051. endTurn.activate();
  1052. minimap.activate();
  1053. minimap.draw();
  1054. heroList.activate();
  1055. heroList.draw();
  1056. townList.activate();
  1057. townList.draw();
  1058. terrain.activate();
  1059. resdatabar.draw();
  1060. statusbar.show();
  1061. SDL_Flip(ekran);
  1062. }
  1063. void CAdvMapInt::update()
  1064. {
  1065. terrain.show();
  1066. blitAt(gems[2]->ourImages[LOCPLINT->playerID].bitmap,6,6);
  1067. blitAt(gems[0]->ourImages[LOCPLINT->playerID].bitmap,6,508);
  1068. blitAt(gems[1]->ourImages[LOCPLINT->playerID].bitmap,556,508);
  1069. blitAt(gems[3]->ourImages[LOCPLINT->playerID].bitmap,556,6);
  1070. updateRect(&genRect(550,600,6,6));
  1071. }
  1072. void CAdvMapInt::centerOn(int3 on)
  1073. {
  1074. on.x -= (LOCPLINT->adventureInt->terrain.tilesw/2);
  1075. on.y -= (LOCPLINT->adventureInt->terrain.tilesh/2);
  1076. if (on.x<0)
  1077. on.x=-(Woff/2);
  1078. else if((on.x+LOCPLINT->adventureInt->terrain.tilesw) > (CGI->mh->sizes.x))
  1079. on.x=CGI->mh->sizes.x-LOCPLINT->adventureInt->terrain.tilesw+(Woff/2);
  1080. if (on.y<0)
  1081. on.y = -(Hoff/2);
  1082. else if((on.y+LOCPLINT->adventureInt->terrain.tilesh) > (CGI->mh->sizes.y))
  1083. on.y = CGI->mh->sizes.y-LOCPLINT->adventureInt->terrain.tilesh+(Hoff/2);
  1084. LOCPLINT->adventureInt->position.x=on.x;
  1085. LOCPLINT->adventureInt->position.y=on.y;
  1086. LOCPLINT->adventureInt->position.z=on.z;
  1087. LOCPLINT->adventureInt->updateScreen=true;
  1088. }
  1089. CAdvMapInt::CurrentSelection::CurrentSelection()
  1090. {
  1091. type=-1;
  1092. selected=NULL;
  1093. }