GameConstants.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. #pragma once
  2. /*
  3. * GameConstants.h, part of VCMI engine
  4. *
  5. * Authors: listed in file AUTHORS in main folder
  6. *
  7. * License: GNU General Public License v2.0 or later
  8. * Full text of license available in license.txt file, in main folder
  9. *
  10. */
  11. namespace GameConstants
  12. {
  13. const std::string VCMI_VERSION = "VCMI 0.88b";
  14. /*
  15. * DATA_DIR contains the game data (Data/, MP3/, ...).
  16. * BIN_DIR is where the vcmiclient/vcmiserver binaries reside
  17. * LIB_DIR is where the AI libraries reside (linux only)
  18. */
  19. #ifdef _WIN32
  20. const std::string DATA_DIR = ".";
  21. const std::string BIN_DIR = ".";
  22. const std::string LIB_DIR = ".";
  23. const std::string SERVER_NAME = "VCMI_server.exe";
  24. const std::string LIB_EXT = "dll";
  25. const std::string PATH_SEPARATOR = "\\";
  26. #else
  27. #ifndef M_DATA_DIR
  28. #error M_DATA_DIR undefined.
  29. #else
  30. const std::string DATA_DIR = M_DATA_DIR;
  31. #endif
  32. #ifndef M_BIN_DIR
  33. #error M_BIN_DIR undefined.
  34. #else
  35. const std::string BIN_DIR = M_BIN_DIR;
  36. #endif
  37. #ifndef M_LIB_DIR
  38. #error M_LIB_DIR undefined.
  39. #else
  40. const std::string LIB_DIR = M_LIB_DIR;
  41. #endif
  42. const std::string SERVER_NAME = "vcmiserver";
  43. const std::string LIB_EXT = "so";
  44. const std::string PATH_SEPARATOR = "/";
  45. #endif
  46. const int BFIELD_WIDTH = 17;
  47. const int BFIELD_HEIGHT = 11;
  48. const int BFIELD_SIZE = BFIELD_WIDTH * BFIELD_HEIGHT;
  49. const int ARMY_SIZE = 7;
  50. const int BOATI_TYPE = 8;
  51. const int HEROI_TYPE = 34;
  52. const int TOWNI_TYPE = 98;
  53. const int SUBTERRANEAN_GATE_TYPE = 103;
  54. const int CREI_TYPE = 54;
  55. const int EVENTI_TYPE = 26;
  56. const int CREATURES_COUNT = 197;
  57. const int CRE_LEVELS = 10;
  58. const int F_NUMBER = 9; //factions (town types) quantity
  59. const int PLAYER_LIMIT = 8; //player limit per map
  60. const int MAX_HEROES_PER_PLAYER = 8;
  61. const int ALL_PLAYERS = 255; //bitfield
  62. const int HEROES_PER_TYPE=8; //amount of heroes of each type
  63. const int SKILL_QUANTITY=28;
  64. const int SKILL_PER_HERO=8;
  65. const int ARTIFACTS_QUANTITY=171;
  66. const int HEROES_QUANTITY=156;
  67. const int SPELLS_QUANTITY=70;
  68. const int RESOURCE_QUANTITY=8;
  69. const int TERRAIN_TYPES=10;
  70. const int PRIMARY_SKILLS=4;
  71. const int NEUTRAL_PLAYER=255;
  72. const int NAMES_PER_TOWN=16;
  73. const int CREATURES_PER_TOWN = 7; //without upgrades
  74. const int MAX_BUILDING_PER_TURN = 1;
  75. const int SPELL_LEVELS = 5;
  76. const int CREEP_SIZE = 4000; // neutral stacks won't grow beyond this number
  77. const int WEEKLY_GROWTH = 10; //percent
  78. const int AVAILABLE_HEROES_PER_PLAYER = 2;
  79. const bool DWELLINGS_ACCUMULATE_CREATURES = false;
  80. const int SPELLBOOK_GOLD_COST = 500;
  81. const ui16 BACKPACK_START = 19;
  82. const int ID_CATAPULT = 3, ID_LOCK = 145;
  83. //game modules
  84. const bool STACK_EXP = true;
  85. const bool STACK_ARTIFACT = true; //now toggle for testing
  86. const bool COMMANDERS = true;
  87. const bool MITHRIL = false;
  88. }
  89. // Enum declarations
  90. namespace PrimarySkill
  91. {
  92. enum { ATTACK, DEFENSE, SPELL_POWER, KNOWLEDGE};
  93. }
  94. namespace EVictoryConditionType
  95. {
  96. enum EVictoryConditionType { ARTIFACT, GATHERTROOP, GATHERRESOURCE, BUILDCITY, BUILDGRAIL, BEATHERO,
  97. CAPTURECITY, BEATMONSTER, TAKEDWELLINGS, TAKEMINES, TRANSPORTITEM, WINSTANDARD = 255 };
  98. }
  99. namespace ELossConditionType
  100. {
  101. enum ELossConditionType { LOSSCASTLE, LOSSHERO, TIMEEXPIRES, LOSSSTANDARD = 255 };
  102. }
  103. namespace EAlignment
  104. {
  105. enum EAlignment { GOOD, EVIL, NEUTRAL };
  106. }
  107. namespace EBuilding
  108. {
  109. //Quite useful as long as most of building mechanics hardcoded
  110. enum EBuilding
  111. {
  112. MAGES_GUILD_1, MAGES_GUILD_2, MAGES_GUILD_3, MAGES_GUILD_4, MAGES_GUILD_5,
  113. TAVERN, SHIPYARD, FORT, CITADEL, CASTLE,
  114. VILLAGE_HALL, TOWN_HALL, CITY_HALL, CAPITOL, MARKETPLACE,
  115. RESOURCE_SILO, BLACKSMITH, SPECIAL_1, HORDE_1, HORDE_1_UPGR,
  116. SHIP, SPECIAL_2, SPECIAL_3, SPECIAL_4, HORDE_2,
  117. HORDE_2_UPGR, GRAIL, EXTRA_CITY_HALL, EXTRA_TOWN_HALL, EXTRA_CAPITOL,
  118. DWELL_FIRST=30, DWELL_LAST=36, DWELL_UP_FIRST=37, DWELL_UP_LAST=43
  119. };
  120. }
  121. namespace EBuildingState
  122. {
  123. enum EBuildingState
  124. {
  125. HAVE_CAPITAL, NO_WATER, FORBIDDEN, ADD_MAGES_GUILD, ALREADY_PRESENT, CANT_BUILD_TODAY,
  126. NO_RESOURCES, ALLOWED, PREREQUIRES, BUILDING_ERROR
  127. };
  128. }
  129. namespace ESpellCastProblem
  130. {
  131. enum ESpellCastProblem
  132. {
  133. OK, NO_HERO_TO_CAST_SPELL, ALREADY_CASTED_THIS_TURN, NO_SPELLBOOK, ANOTHER_ELEMENTAL_SUMMONED,
  134. HERO_DOESNT_KNOW_SPELL, NOT_ENOUGH_MANA, ADVMAP_SPELL_INSTEAD_OF_BATTLE_SPELL,
  135. SECOND_HEROS_SPELL_IMMUNITY, SPELL_LEVEL_LIMIT_EXCEEDED, NO_SPELLS_TO_DISPEL,
  136. NO_APPROPRIATE_TARGET, STACK_IMMUNE_TO_SPELL, WRONG_SPELL_TARGET, ONGOING_TACTIC_PHASE
  137. };
  138. }
  139. namespace ECastingMode
  140. {
  141. enum ECastingMode {HERO_CASTING, AFTER_ATTACK_CASTING, //also includes cast before attack
  142. MAGIC_MIRROR, CREATURE_ACTIVE_CASTING, ENCHANTER_CASTING};
  143. }
  144. namespace EMarketMode
  145. {
  146. enum EMarketMode
  147. {
  148. RESOURCE_RESOURCE, RESOURCE_PLAYER, CREATURE_RESOURCE, RESOURCE_ARTIFACT,
  149. ARTIFACT_RESOURCE, ARTIFACT_EXP, CREATURE_EXP, CREATURE_UNDEAD, RESOURCE_SKILL,
  150. MARTKET_AFTER_LAST_PLACEHOLDER
  151. };
  152. }
  153. namespace EBattleStackState
  154. {
  155. enum EBattleStackState{ALIVE = 180, SUMMONED, CLONED, HAD_MORALE, WAITING, MOVED, DEFENDING, FEAR,
  156. DRAINED_MANA /*remember to drain mana only once per turn*/};
  157. }
  158. namespace ECommander
  159. {
  160. enum SecondarySkills {ATTACK, DEFENSE, HEALTH, DAMAGE, SPEED, SPELL_POWER, CASTS, RESISTANCE};
  161. const int MAX_SKILL_LEVEL = 5;
  162. }
  163. namespace Obj
  164. {
  165. enum
  166. {
  167. BOAT = 8,
  168. CREATURE_BANK = 16,
  169. CREATURE_GENERATOR1 = 17,
  170. CURSED_GROUND1 = 21,
  171. DERELICT_SHIP = 24,
  172. DRAGON_UTOPIA = 25,
  173. GARRISON = 33,
  174. LIBRARY_OF_ENLIGHTENMENT = 41,
  175. MONOLITH1 = 43,
  176. MONOLITH2 = 44,
  177. MONOLITH3 = 45,
  178. MAGIC_PLAINS1 = 46,
  179. SCHOOL_OF_MAGIC = 47,
  180. MINE = 53,
  181. MONSTER = 54,
  182. OBELISK = 57,
  183. PYRAMID = 63,
  184. CRYPT = 84,
  185. SHIPWRECK = 85,
  186. STABLES = 94,
  187. TRADING_POST = 99,
  188. TREE_OF_KNOWLEDGE = 102,
  189. SUBTERRANEAN_GATE = 103,
  190. UNIVERSITY = 104,
  191. SCHOOL_OF_WAR = 107,
  192. WHIRLPOOL = 111,
  193. BORDER_GATE = 212,
  194. GARRISON2 = 219,
  195. CLOVER_FIELD = 222,
  196. CURSED_GROUND2 = 223,
  197. EVIL_FOG = 224,
  198. FAVORABLE_WINDS = 225,
  199. FIERY_FIELDS = 226,
  200. HOLY_GROUNDS = 227,
  201. LUCID_POOLS = 228,
  202. MAGIC_CLOUDS = 229,
  203. MAGIC_PLAINS2 = 230,
  204. ROCKLANDS = 231,
  205. };
  206. }
  207. //follows ERM BI (battle image) format
  208. namespace BattlefieldBI
  209. {
  210. enum
  211. {
  212. NONE = -1,
  213. COASTAL,
  214. //Discrepency from ERM BI description - we have magic plains and cursed gronds swapped
  215. MAGIC_PLAINS,
  216. CURSED_GROUND,
  217. //
  218. HOLY_GROUND,
  219. EVIL_FOG,
  220. CLOVER_FIELD,
  221. LUCID_POOLS,
  222. FIERY_FIELDS,
  223. ROCKLANDS,
  224. MAGIC_CLOUDS,
  225. };
  226. }
  227. // Typedef declarations
  228. typedef si64 expType;
  229. typedef ui32 TSpell;
  230. typedef std::pair<ui32, ui32> TDmgRange;
  231. typedef ui8 TBonusType;
  232. typedef si32 TBonusSubtype;
  233. typedef si32 TSlot;
  234. typedef si32 TQuantity;
  235. typedef ui32 TCreature; //creature id