GameConstants.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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 ALL_PLAYERS = 255; //bitfield
  61. const int HEROES_PER_TYPE=8; //amount of heroes of each type
  62. const int SKILL_QUANTITY=28;
  63. const int SKILL_PER_HERO=8;
  64. const int ARTIFACTS_QUANTITY=171;
  65. const int HEROES_QUANTITY=156;
  66. const int SPELLS_QUANTITY=70;
  67. const int RESOURCE_QUANTITY=8;
  68. const int TERRAIN_TYPES=10;
  69. const int PRIMARY_SKILLS=4;
  70. const int NEUTRAL_PLAYER=255;
  71. const int NAMES_PER_TOWN=16;
  72. const int CREATURES_PER_TOWN = 7; //without upgrades
  73. const int MAX_BUILDING_PER_TURN = 1;
  74. const int SPELL_LEVELS = 5;
  75. const int CREEP_SIZE = 4000; // neutral stacks won't grow beyond this number
  76. const int WEEKLY_GROWTH = 10; //percent
  77. const int AVAILABLE_HEROES_PER_PLAYER = 2;
  78. const bool DWELLINGS_ACCUMULATE_CREATURES = false;
  79. const int SPELLBOOK_GOLD_COST = 500;
  80. const ui16 BACKPACK_START = 19;
  81. const int ID_CATAPULT = 3, ID_LOCK = 145;
  82. const ui16 CREATURE_ART = 0; //position in CCreatureArtifactSet
  83. //game modules
  84. const bool STACK_EXP = true;
  85. const bool STACK_ARTIFACT = true; //now toggle for testing
  86. const bool COMMANDERS = false;
  87. const bool MITHRIL = false;
  88. }
  89. // Enum declarations
  90. namespace EVictoryConditionType
  91. {
  92. enum EVictoryConditionType { ARTIFACT, GATHERTROOP, GATHERRESOURCE, BUILDCITY, BUILDGRAIL, BEATHERO,
  93. CAPTURECITY, BEATMONSTER, TAKEDWELLINGS, TAKEMINES, TRANSPORTITEM, WINSTANDARD = 255 };
  94. }
  95. namespace ELossConditionType
  96. {
  97. enum ELossConditionType { LOSSCASTLE, LOSSHERO, TIMEEXPIRES, LOSSSTANDARD = 255 };
  98. }
  99. namespace EAlignment
  100. {
  101. enum EAlignment { GOOD, EVIL, NEUTRAL };
  102. }
  103. namespace EBuilding
  104. {
  105. //Quite useful as long as most of building mechanics hardcoded
  106. enum EBuilding
  107. {
  108. MAGES_GUILD_1, MAGES_GUILD_2, MAGES_GUILD_3, MAGES_GUILD_4, MAGES_GUILD_5,
  109. TAVERN, SHIPYARD, FORT, CITADEL, CASTLE,
  110. VILLAGE_HALL, TOWN_HALL, CITY_HALL, CAPITOL, MARKETPLACE,
  111. RESOURCE_SILO, BLACKSMITH, SPECIAL_1, HORDE_1, HORDE_1_UPGR,
  112. SHIP, SPECIAL_2, SPECIAL_3, SPECIAL_4, HORDE_2,
  113. HORDE_2_UPGR, GRAIL, EXTRA_CITY_HALL, EXTRA_TOWN_HALL, EXTRA_CAPITOL,
  114. DWELL_FIRST=30, DWELL_LAST=36, DWELL_UP_FIRST=37, DWELL_UP_LAST=43
  115. };
  116. }
  117. namespace EBuildingState
  118. {
  119. enum EBuildingState
  120. {
  121. HAVE_CAPITAL, NO_WATER, FORBIDDEN, ADD_MAGES_GUILD, ALREADY_PRESENT, CANT_BUILD_TODAY,
  122. NO_RESOURCES, ALLOWED, PREREQUIRES, BUILDING_ERROR
  123. };
  124. }
  125. namespace ESpellCastProblem
  126. {
  127. enum ESpellCastProblem
  128. {
  129. OK, NO_HERO_TO_CAST_SPELL, ALREADY_CASTED_THIS_TURN, NO_SPELLBOOK, ANOTHER_ELEMENTAL_SUMMONED,
  130. HERO_DOESNT_KNOW_SPELL, NOT_ENOUGH_MANA, ADVMAP_SPELL_INSTEAD_OF_BATTLE_SPELL,
  131. SECOND_HEROS_SPELL_IMMUNITY, SPELL_LEVEL_LIMIT_EXCEEDED, NO_SPELLS_TO_DISPEL,
  132. NO_APPROPRIATE_TARGET, STACK_IMMUNE_TO_SPELL, WRONG_SPELL_TARGET
  133. };
  134. }
  135. namespace ECastingMode
  136. {
  137. enum ECastingMode {HERO_CASTING, AFTER_ATTACK_CASTING, //also includes cast before attack
  138. MAGIC_MIRROR, CREATURE_ACTIVE_CASTING, ENCHANTER_CASTING};
  139. }
  140. namespace EMarketMode
  141. {
  142. enum EMarketMode
  143. {
  144. RESOURCE_RESOURCE, RESOURCE_PLAYER, CREATURE_RESOURCE, RESOURCE_ARTIFACT,
  145. ARTIFACT_RESOURCE, ARTIFACT_EXP, CREATURE_EXP, CREATURE_UNDEAD, RESOURCE_SKILL,
  146. MARTKET_AFTER_LAST_PLACEHOLDER
  147. };
  148. }
  149. namespace EBattleStackState
  150. {
  151. enum EBattleStackState{ALIVE = 180, SUMMONED, CLONED, HAD_MORALE, WAITING, MOVED, DEFENDING, FEAR};
  152. }
  153. namespace Obj
  154. {
  155. enum
  156. {
  157. BOAT = 8,
  158. CREATURE_BANK = 16,
  159. CREATURE_GENERATOR1 = 17,
  160. DERELICT_SHIP = 24,
  161. DRAGON_UTOPIA = 25,
  162. GARRISON = 33,
  163. MONOLITH1 = 43,
  164. MONOLITH2 = 44,
  165. MONOLITH3 = 45,
  166. MINE = 53,
  167. MONSTER = 54,
  168. OBELISK = 57,
  169. PYRAMID = 63,
  170. CRYPT = 84,
  171. SHIPWRECK = 85,
  172. STABLES = 94,
  173. TRADING_POST = 99,
  174. SUBTERRANEAN_GATE = 103,
  175. WHIRLPOOL = 111,
  176. BORDER_GATE = 212,
  177. GARRISON2 = 219,
  178. };
  179. }
  180. // Typedef declarations
  181. typedef si64 expType;
  182. typedef ui32 TSpell;
  183. typedef std::pair<ui32, ui32> TDmgRange;
  184. typedef ui8 TBonusType;
  185. typedef si32 TBonusSubtype;
  186. typedef si32 TSlot;
  187. typedef si32 TQuantity;
  188. typedef ui32 TCreature; //creature id