2
0

map.h 7.3 KB

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