GameConstants.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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.86e";
  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 bool STACK_EXP = true;
  80. const bool STACK_ARTIFACT = true;
  81. const int SPELLBOOK_GOLD_COST = 500;
  82. const ui16 BACKPACK_START = 19;
  83. const int ID_CATAPULT = 3, ID_LOCK = 145;
  84. const ui16 CREATURE_ART = 0;
  85. }
  86. // Enum declarations
  87. namespace EVictoryConditionType
  88. {
  89. enum EVictoryConditionType { ARTIFACT, GATHERTROOP, GATHERRESOURCE, BUILDCITY, BUILDGRAIL, BEATHERO,
  90. CAPTURECITY, BEATMONSTER, TAKEDWELLINGS, TAKEMINES, TRANSPORTITEM, WINSTANDARD = 255 };
  91. }
  92. namespace ELossConditionType
  93. {
  94. enum ELossConditionType { LOSSCASTLE, LOSSHERO, TIMEEXPIRES, LOSSSTANDARD = 255 };
  95. }
  96. namespace EAlignment
  97. {
  98. enum EAlignment { GOOD, EVIL, NEUTRAL };
  99. }
  100. namespace EBuilding
  101. {
  102. //Quite useful as long as most of building mechanics hardcoded
  103. enum EBuilding
  104. {
  105. MAGES_GUILD_1, MAGES_GUILD_2, MAGES_GUILD_3, MAGES_GUILD_4, MAGES_GUILD_5,
  106. TAVERN, SHIPYARD, FORT, CITADEL, CASTLE,
  107. VILLAGE_HALL, TOWN_HALL, CITY_HALL, CAPITOL, MARKETPLACE,
  108. RESOURCE_SILO, BLACKSMITH, SPECIAL_1, HORDE_1, HORDE_1_UPGR,
  109. SHIP, SPECIAL_2, SPECIAL_3, SPECIAL_4, HORDE_2,
  110. HORDE_2_UPGR, GRAIL, EXTRA_CITY_HALL, EXTRA_TOWN_HALL, EXTRA_CAPITOL,
  111. DWELL_FIRST=30, DWELL_LAST=36, DWELL_UP_FIRST=37, DWELL_UP_LAST=43
  112. };
  113. }
  114. namespace EBuildingState
  115. {
  116. enum EBuildingState
  117. {
  118. HAVE_CAPITAL, NO_WATER, FORBIDDEN, ADD_MAGES_GUILD, ALREADY_PRESENT, CANT_BUILD_TODAY,
  119. NO_RESOURCES, ALLOWED, PREREQUIRES, BUILDING_ERROR
  120. };
  121. }
  122. namespace ESpellCastProblem
  123. {
  124. enum ESpellCastProblem
  125. {
  126. OK, NO_HERO_TO_CAST_SPELL, ALREADY_CASTED_THIS_TURN, NO_SPELLBOOK, ANOTHER_ELEMENTAL_SUMMONED,
  127. HERO_DOESNT_KNOW_SPELL, NOT_ENOUGH_MANA, ADVMAP_SPELL_INSTEAD_OF_BATTLE_SPELL,
  128. SECOND_HEROS_SPELL_IMMUNITY, SPELL_LEVEL_LIMIT_EXCEEDED, NO_SPELLS_TO_DISPEL,
  129. NO_APPROPRIATE_TARGET, STACK_IMMUNE_TO_SPELL, WRONG_SPELL_TARGET
  130. };
  131. }
  132. namespace ECastingMode
  133. {
  134. enum ECastingMode {HERO_CASTING, AFTER_ATTACK_CASTING, //also includes cast before attack
  135. MAGIC_MIRROR, CREATURE_ACTIVE_CASTING, ENCHANTER_CASTING};
  136. }
  137. namespace EMarketMode
  138. {
  139. enum EMarketMode
  140. {
  141. RESOURCE_RESOURCE, RESOURCE_PLAYER, CREATURE_RESOURCE, RESOURCE_ARTIFACT,
  142. ARTIFACT_RESOURCE, ARTIFACT_EXP, CREATURE_EXP, CREATURE_UNDEAD, RESOURCE_SKILL,
  143. MARTKET_AFTER_LAST_PLACEHOLDER
  144. };
  145. }
  146. namespace EBattleStackState
  147. {
  148. enum EBattleStackState{ALIVE = 180, SUMMONED, CLONED, HAD_MORALE, WAITING, MOVED, DEFENDING, FEAR};
  149. }
  150. // Typedef declarations
  151. typedef si64 expType;
  152. typedef ui32 TSpell;
  153. typedef std::pair<ui32, ui32> TDmgRange;
  154. typedef ui8 TBonusType;
  155. typedef si32 TBonusSubtype;
  156. typedef si32 TSlot;
  157. typedef si32 TQuantity;
  158. typedef ui32 TCreature; //creature id