global.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #ifndef GLOBAL_H
  2. #define GLOBAL_H
  3. #include <iostream>
  4. #include <boost/logic/tribool.hpp>
  5. #include <boost/cstdint.hpp>
  6. typedef boost::uint32_t ui32; //unsigned int 32 bits (4 bytes)
  7. typedef boost::uint16_t ui16; //unsigned int 16 bits (2 bytes)
  8. typedef boost::uint8_t ui8; //unsigned int 8 bits (1 byte)
  9. typedef boost::int32_t si32; //signed int 32 bits (4 bytes)
  10. typedef boost::int16_t si16; //signed int 16 bits (2 bytes)
  11. typedef boost::int8_t si8; //signed int 8 bits (1 byte)
  12. #include "int3.h"
  13. #define CHECKTIME 1
  14. #if CHECKTIME
  15. #include "timeHandler.h"
  16. #define THC
  17. #endif
  18. #define NAME_VER ("VCMI \"Altanatse\" 0.7")
  19. #ifdef _WIN32
  20. #define PATHSEPARATOR "\\"
  21. #define DATA_DIR ""
  22. #else
  23. #define PATHSEPARATOR "/"
  24. #define DATA_DIR "/progdir/"
  25. #endif
  26. enum Ecolor {RED, BLUE, TAN, GREEN, ORANGE, PURPLE, TEAL, PINK}; //player's colors
  27. enum EterrainType {border=-1, dirt, sand, grass, snow, swamp, rough, subterranean, lava, water, rock};
  28. enum Eriver {noRiver=0, clearRiver, icyRiver, muddyRiver, lavaRiver};
  29. enum Eroad {dirtRoad=1, grazvelRoad, cobblestoneRoad};
  30. enum Eformat { WoG=0x33, AB=0x15, RoE=0x0e, SoD=0x1c};
  31. enum EvictoryConditions {artifact, gatherTroop, gatherResource, buildCity, buildGrail, beatHero,
  32. captureCity, beatMonster, takeDwellings, takeMines, transportItem, winStandard=255};
  33. enum ElossCon {lossCastle, lossHero, timeExpires, lossStandard=255};
  34. enum EHeroClasses {HERO_KNIGHT, HERO_CLERIC, HERO_RANGER, HERO_DRUID, HERO_ALCHEMIST, HERO_WIZARD,
  35. HERO_DEMONIAC, HERO_HERETIC, HERO_DEATHKNIGHT, HERO_NECROMANCER, HERO_WARLOCK, HERO_OVERLORD,
  36. HERO_BARBARIAN, HERO_BATTLEMAGE, HERO_BEASTMASTER, HERO_WITCH, HERO_PLANESWALKER, HERO_ELEMENTALIST};
  37. class CGameInfo;
  38. extern CGameInfo* CGI;
  39. #define HEROI_TYPE (0)
  40. #define TOWNI_TYPE (1)
  41. const int F_NUMBER = 9; //factions (town types) quantity
  42. const int PLAYER_LIMIT = 8; //player limit per map
  43. const int HEROES_PER_TYPE=8; //amount of heroes of each type
  44. const int SKILL_QUANTITY=28;
  45. const int SKILL_PER_HERO=8;
  46. const int ARTIFACTS_QUANTITY=171;
  47. const int HEROES_QUANTITY=156;
  48. const int SPELLS_QUANTITY=70;
  49. const int RESOURCE_QUANTITY=8;
  50. const int TERRAIN_TYPES=10;
  51. const int PRIMARY_SKILLS=4;
  52. const int NEUTRAL_PLAYER=255;
  53. const int NAMES_PER_TOWN=16;
  54. const int CREATURES_PER_TOWN = 7; //without upgrades
  55. const int MAX_BUILDING_PER_TURN = 1;
  56. #define MARK_BLOCKED_POSITIONS false
  57. #define MARK_VISITABLE_POSITIONS false
  58. #define DEFBYPASS
  59. #ifdef _WIN32
  60. #ifdef VCMI_DLL
  61. #define DLL_EXPORT __declspec(dllexport)
  62. #else
  63. #define DLL_EXPORT __declspec(dllimport)
  64. #endif
  65. #else
  66. #if defined(__GNUC__) && __GNUC__ >= 4
  67. #define DLL_EXPORT __attribute__ ((visibility("default")))
  68. #else
  69. #define DLL_EXPORT
  70. #endif
  71. #endif
  72. #define HANDLE_EXCEPTION \
  73. catch (const std::exception& e) { \
  74. std::cerr << e.what() << std::endl; \
  75. } \
  76. catch (const std::exception * e) \
  77. { \
  78. std::cerr << e->what()<< std::endl; \
  79. delete e; \
  80. }
  81. #endif //GLOBAL_H