map.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. #ifndef MAPD
  2. #define MAPD
  3. #include <string>
  4. #include <vector>
  5. struct Sresource
  6. {
  7. std::string resName; //name of this resource
  8. int amount; //it can be greater and lesser than 0
  9. };
  10. struct TimeEvent
  11. {
  12. std::string eventName;
  13. std::string message;
  14. std::vector<Sresource> decIncRes; //decreases / increases of resources
  15. unsigned int whichPlayers; //which players are affected by this event (+1 - first, +2 - second, +4 - third, +8 - fourth etc.)
  16. bool areHumansAffected;
  17. bool areCompsAffected;
  18. int firstAfterNDays; //how many days after appears this event
  19. int nextAfterNDays; //how many days after the epperance before appaers this event
  20. //bajty wydarzeñ (59 + |teksty|)
  21. //4 bajty na d³ugoœæ nazwy zdarzenia
  22. //nazwa zdarzenia (bajty dodatkowe)
  23. //4 bajty na d³ugoœæ wiadomoœci
  24. //wiadomoϾ (bajty dodatkowe)
  25. //4 bajty na zwiêkszenie siê ilosci drewna (zapis normalny) lub ff,ff,ff,ff - iloœæ drewna do odebrania (maksymalna iloœæ drewna, któr¹ mo¿na daæ/odebraæ to 32767)
  26. //4 bajty na zwiêkszenie siê ilosci rtêci (zapis normalny) lub ff,ff,ff,ff - iloœæ rtêci do odebrania (maksymalna iloœæ rtêci, któr¹ mo¿na daæ/odebraæ to 32767)
  27. //4 bajty na zwiêkszenie siê ilosci rudy (zapis normalny) lub ff,ff,ff,ff - iloœæ rudy do odebrania (maksymalna iloœæ rudy, któr¹ mo¿na daæ/odebraæ to 32767)
  28. //4 bajty na zwiêkszenie siê ilosci siarki (zapis normalny) lub ff,ff,ff,ff - iloœæ siarki do odebrania (maksymalna iloœæ siarki, któr¹ mo¿na daæ/odebraæ to 32767)
  29. //4 bajty na zwiêkszenie siê ilosci kryszta³u (zapis normalny) lub ff,ff,ff,ff - iloœæ kryszta³u do odebrania (maksymalna iloœæ kryszta³u, któr¹ mo¿na daæ/odebraæ to 32767)
  30. //4 bajty na zwiêkszenie siê ilosci klejnotów (zapis normalny) lub ff,ff,ff,ff - iloœæ klejnotów do odebrania (maksymalna iloœæ klejnotów, któr¹ mo¿na daæ/odebraæ to 32767)
  31. //4 bajty na zwiêkszenie siê ilosci z³ota (zapis normalny) lub ff,ff,ff,ff - iloœæ z³ota do odebrania (maksymalna iloœæ z³ota, któr¹ mo¿na daæ/odebraæ to 32767)
  32. //1 bajt - których graczy dotyczy zdarzenie (pole bitowe, +1 - pierwszy, +2 - drugi, +4 - trzeci, +8 - czwarty, +16 - pi¹ty, +32 - szósty, +64 - siódmy, +128 - ósmy)
  33. //1 bajt - czy zdarzenie odnosi siê do graczy - ludzi (00 - nie, 01 - tak)
  34. //1 bajt - czy zdarzenie odnosi siê do graczy komputerowych (00 - nie, 01 - tak)
  35. //2 bajty - opóŸnienie pierwszego wyst¹pienia (w dniach, zapis normalny, maks 671)
  36. //1 bajt - co ile dni wystêpuje zdarzenie (maks 28, 00 oznacza zdarzenie jednorazowe)
  37. //17 bajtów zerowych
  38. };
  39. struct TerrainTile
  40. {
  41. EterrainType tertype; // type of terrain
  42. unsigned int terview; // look of terrain
  43. Eriver nuine; // type of Eriver (0 if there is no Eriver)
  44. unsigned int rivDir; // direction of Eriver
  45. Eroad malle; // type of Eroad (0 if there is no Eriver)
  46. unsigned int roadDir; // direction of Eroad
  47. unsigned int siodmyTajemniczyBajt; // mysterius byte // jak bedzie waidomo co to, to sie nazwie inaczej
  48. };
  49. struct DefInfo //information from def declaration
  50. {
  51. std::string name;
  52. int bytes [42];
  53. };
  54. struct Location
  55. {
  56. int x, y;
  57. bool z; // underground
  58. };
  59. struct SheroName //name of starting hero
  60. {
  61. int heroID;
  62. std::string heroName;
  63. };
  64. struct PlayerInfo
  65. {
  66. bool canHumanPlay;
  67. bool canComputerPlay;
  68. unsigned int AITactic; //(00 - random, 01 - warrior, 02 - builder, 03 - explorer)
  69. unsigned int allowedFactions; //(01 - castle; 02 - rampart; 04 - tower; 08 - inferno; 16 - necropolis; 32 - dungeon; 64 - stronghold; 128 - fortress; 256 - conflux);
  70. bool isFactionRandom;
  71. unsigned int mainHeroPortrait; //it's ID of hero with choosen portrait; 255 if standard
  72. std::string mainHeroName;
  73. std::vector<SheroName> heroesNames;
  74. bool hasMainTown;
  75. bool generateHeroAtMainTown;
  76. Location posOfMainTown;
  77. int team;
  78. };
  79. struct LossCondition
  80. {
  81. ElossCon typeOfLossCon;
  82. union
  83. {
  84. Location castlePos;
  85. Location heroPos;
  86. int timeLimit; // in days
  87. };
  88. };
  89. struct CspecificVictoryConidtions
  90. {
  91. bool allowNormalVictory;
  92. bool appliesToAI;
  93. };
  94. struct VicCon0 : public CspecificVictoryConidtions //acquire artifact
  95. {
  96. int ArtifactID;
  97. };
  98. struct VicCon1 : public CspecificVictoryConidtions //accumulate creatures
  99. {
  100. int monsterID;
  101. int neededQuantity;
  102. };
  103. struct VicCon2 : public CspecificVictoryConidtions // accumulate resources
  104. {
  105. int resourceID;
  106. int neededQuantity;
  107. };
  108. struct VicCon3 : public CspecificVictoryConidtions // upgrade specific town
  109. {
  110. Location posOfCity;
  111. int councilNeededLevel; //0 - town; 1 - city; 2 - capitol
  112. int fortNeededLevel;// 0 - fort; 1 - citadel; 2 - castle
  113. };
  114. struct VicCon4 : public CspecificVictoryConidtions // build grail structure
  115. {
  116. bool anyLocation;
  117. Location whereBuildGrail;
  118. };
  119. struct VicCon5 : public CspecificVictoryConidtions // defeat a specific hero
  120. {
  121. Location locationOfHero;
  122. };
  123. struct VicCon6 : public CspecificVictoryConidtions // capture a specific town
  124. {
  125. Location locationOfTown;
  126. };
  127. struct VicCon7 : public CspecificVictoryConidtions // defeat a specific monster
  128. {
  129. Location locationOfMonster;
  130. };
  131. /*struct VicCon8 : public CspecificVictoryConidtions // flag all creature dwellings
  132. {
  133. };
  134. struct VicCon9 : public CspecificVictoryConidtions // flag all mines
  135. {
  136. };*/
  137. struct VicCona : public CspecificVictoryConidtions //transport specific artifact
  138. {
  139. int artifactID;
  140. Location destinationPlace;
  141. };
  142. struct Rumor
  143. {
  144. std::string name, text;
  145. };
  146. class CMapEvent
  147. {
  148. public:
  149. std::string name, message;
  150. int wood, mercury, ore, sulfur, crystal, gems, gold; //gained / taken resources
  151. unsigned char players; //affected players
  152. bool humanAffected;
  153. bool computerAffected;
  154. int firstOccurence;
  155. int nextOccurence; //after nextOccurance day event will occure; if it it 0, event occures only one time;
  156. };
  157. struct Mapa
  158. {
  159. Eformat version; // version of map Eformat
  160. bool twoLevel; // if map has underground level
  161. int difficulty; // 0 easy - 4 impossible
  162. int levelLimit;
  163. bool areAnyPLayers; // if there are any playable players on map
  164. std::string name; //name of map
  165. std::string description; //and description
  166. int height, width;
  167. TerrainTile** terrain;
  168. TerrainTile** undergroungTerrain; // used only if there is underground level
  169. std::vector<Rumor> rumors;
  170. std::vector<DefInfo> defy; // list of .def files
  171. PlayerInfo players[8]; // info about players
  172. std::vector<int> teams; // teams[i] = team of player nr i
  173. LossCondition lossCondition;
  174. EvictoryConditions victoryCondition; //victory conditions
  175. CspecificVictoryConidtions * vicConDetails; // used only if vistory conditions aren't standard
  176. int howManyTeams;
  177. std::vector<CMapEvent> events;
  178. };
  179. #endif //MAPD