CMapGenOptions.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. /*
  2. * CMapGenOptions.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. namespace EWaterContent
  12. {
  13. enum EWaterContent
  14. {
  15. RANDOM = -1,
  16. NONE,
  17. NORMAL,
  18. ISLANDS
  19. };
  20. }
  21. namespace EMonsterStrength
  22. {
  23. enum EMonsterStrength
  24. {
  25. RANDOM = -1,
  26. WEAK,
  27. NORMAL,
  28. STRONG
  29. };
  30. }
  31. /**
  32. * The map gen options class holds values about general map
  33. * generation settings e.g. the size of the map, the count of players,...
  34. */
  35. class DLL_LINKAGE CMapGenOptions
  36. {
  37. public:
  38. /**
  39. * C-tor.
  40. */
  41. CMapGenOptions();
  42. /**
  43. * Gets the width of the map. The default value is 72.
  44. *
  45. * @return width of the map in tiles
  46. */
  47. si32 getWidth() const;
  48. /**
  49. * Sets the width of the map.
  50. *
  51. * @param value the width of the map in tiles, any values higher than 0 are allowed
  52. */
  53. void setWidth(si32 value);
  54. /**
  55. * Gets the height of the map. The default value is 72.
  56. *
  57. * @return height of the map in tiles
  58. */
  59. si32 getHeight() const;
  60. /**
  61. * Sets the height of the map.
  62. *
  63. * @param value the height of the map in tiles, any values higher than 0 are allowed
  64. */
  65. void setHeight(si32 value);
  66. /**
  67. * Gets the flag whether the map should be generated with two levels. The
  68. * default value is true.
  69. *
  70. * @return true for two level map
  71. */
  72. bool getHasTwoLevels() const;
  73. /**
  74. * Sets the flag whether the map should be generated with two levels.
  75. *
  76. * @param value true for two level map
  77. */
  78. void setHasTwoLevels(bool value);
  79. /**
  80. * Gets the count of the players. The default value is RANDOM_SIZE representing a random
  81. * player count.
  82. *
  83. * @return the count of the players ranging from 1 to PlayerColor::PLAYER_LIMIT or RANDOM_SIZE for random
  84. */
  85. si8 getPlayersCnt() const;
  86. /**
  87. * Sets the count of the players.
  88. *
  89. * @param value the count of the players ranging from 1 to PlayerColor::PLAYER_LIMIT, RANDOM_SIZE for random
  90. */
  91. void setPlayersCnt(si8 value);
  92. /**
  93. * Gets the count of the teams. The default value is RANDOM_SIZE representing a random
  94. * team count.
  95. *
  96. * @return the count of the teams ranging from 0 to <players count - 1> or RANDOM_SIZE for random
  97. */
  98. si8 getTeamsCnt() const;
  99. /**
  100. * Sets the count of the teams
  101. *
  102. * @param value the count of the teams ranging from 0 to <players count - 1>, RANDOM_SIZE for random
  103. */
  104. void setTeamsCnt(si8 value);
  105. /**
  106. * Gets the count of the computer only players. The default value is 0.
  107. *
  108. * @return the count of the computer only players ranging from 0 to <PlayerColor::PLAYER_LIMIT - players count> or RANDOM_SIZE for random
  109. */
  110. si8 getCompOnlyPlayersCnt() const;
  111. /**
  112. * Sets the count of the computer only players.
  113. *
  114. * @param value the count of the computer only players ranging from 0 to <PlayerColor::PLAYER_LIMIT - players count>, RANDOM_SIZE for random
  115. */
  116. void setCompOnlyPlayersCnt(si8 value);
  117. /**
  118. * Gets the count of the computer only teams. The default value is RANDOM_SIZE representing
  119. * a random computer only team count.
  120. *
  121. * @return the count of the computer only teams ranging from 0 to <comp only players - 1> or RANDOM_SIZE for random
  122. */
  123. si8 getCompOnlyTeamsCnt() const;
  124. /**
  125. * Sets the count of the computer only teams.
  126. *
  127. * @param value the count of the computer only teams ranging from 0 to <comp only players - 1>, RANDOM_SIZE for random
  128. */
  129. void setCompOnlyTeamsCnt(si8 value);
  130. /**
  131. * Gets the water content. The default value is random.
  132. *
  133. * @return the water content
  134. */
  135. EWaterContent::EWaterContent getWaterContent() const;
  136. /**
  137. * Sets the water content.
  138. *
  139. * @param value the water content
  140. */
  141. void setWaterContent(EWaterContent::EWaterContent value);
  142. /**
  143. * Gets the strength of the monsters. The default value is random.
  144. *
  145. * @return the strenght of the monsters
  146. */
  147. EMonsterStrength::EMonsterStrength getMonsterStrength() const;
  148. /**
  149. * Sets the strength of the monsters.
  150. *
  151. * @param value the strenght of the monsters
  152. */
  153. void setMonsterStrength(EMonsterStrength::EMonsterStrength value);
  154. /** The constant for specifying a random number of sth. */
  155. static const si8 RANDOM_SIZE = -1;
  156. private:
  157. /** The width of the map in tiles. */
  158. si32 width;
  159. /** The height of the map in tiles. */
  160. si32 height;
  161. /** True if the map has two levels that means an underground. */
  162. bool hasTwoLevels;
  163. /** The count of the players(human + computer). */
  164. si8 playersCnt;
  165. /** The count of the teams. */
  166. si8 teamsCnt;
  167. /** The count of computer only players. */
  168. si8 compOnlyPlayersCnt;
  169. /** The count of computer only teams. */
  170. si8 compOnlyTeamsCnt;
  171. /** The amount of water content. */
  172. EWaterContent::EWaterContent waterContent;
  173. /** The strength of the monsters. */
  174. EMonsterStrength::EMonsterStrength monsterStrength;
  175. public:
  176. /**
  177. * Serialize method.
  178. */
  179. template <typename Handler>
  180. void serialize(Handler & h, const int version)
  181. {
  182. //FIXME: Enum is not a fixed with data type. Add enum class to both enums
  183. // later. For now it is ok.
  184. h & width & height & hasTwoLevels & playersCnt & teamsCnt & compOnlyPlayersCnt;
  185. h & compOnlyTeamsCnt & waterContent & monsterStrength;
  186. }
  187. };