GameConstants.h 5.9 KB

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