PageRenderTime 54ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/AI/Skirmish/AAI/aidef.h

http://github.com/spring/spring
C Header | 115 lines | 81 code | 23 blank | 11 comment | 0 complexity | e22395631bc6e9021b67fa6df68b94b8 MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-3.0
  1. // -------------------------------------------------------------------------
  2. // AAI
  3. //
  4. // A skirmish AI for the Spring engine.
  5. // Copyright Alexander Seizinger
  6. //
  7. // Released under GPL license: see LICENSE.html for more information.
  8. // -------------------------------------------------------------------------
  9. #ifndef AAI_DEF_H
  10. #define AAI_DEF_H
  11. #include <string>
  12. #include "System/float3.h"
  13. #ifdef _MSC_VER
  14. #pragma warning(disable: 4244 4018) // signed/unsigned and loss of precision...
  15. #endif
  16. // The following two helper functions implementations are in AAIBuildTable.cpp
  17. void ReplaceExtension(const char *n, char *dst, int s, const char *ext);
  18. #define AAI_VERSION aiexport_getVersion()
  19. #define MAP_CACHE_VERSION "MAP_DATA_0_89"
  20. #define MAP_LEARN_VERSION "MAP_LEARN_0_89"
  21. #define MOD_LEARN_VERSION "MOD_LEARN_0_90"
  22. #define CONTINENT_DATA_VERSION "MOVEMENT_MAPS_0_87"
  23. #define AILOG_PATH "log/"
  24. #define MAP_LEARN_PATH "learn/mod/"
  25. #define MOD_LEARN_PATH "learn/mod/"
  26. class AAIMetalSpot
  27. {
  28. public:
  29. AAIMetalSpot(float3 _pos, float _amount):
  30. pos(_pos),
  31. occupied(false),
  32. extractor(-1),
  33. extractor_def(-1),
  34. amount(_amount)
  35. {}
  36. AAIMetalSpot():
  37. pos(ZeroVector),
  38. occupied(false),
  39. extractor(-1),
  40. extractor_def(-1),
  41. amount(0)
  42. {}
  43. float3 pos;
  44. bool occupied;
  45. int extractor; // -1 if unocuppied
  46. int extractor_def; // -1 if unocuppied
  47. float amount;
  48. };
  49. // movement types (for bitfield)
  50. #define MOVE_TYPE_GROUND (unsigned int) 1
  51. #define MOVE_TYPE_AIR (unsigned int) 2
  52. #define MOVE_TYPE_HOVER (unsigned int) 4
  53. #define MOVE_TYPE_SEA (unsigned int) 8
  54. #define MOVE_TYPE_AMPHIB (unsigned int) 16
  55. #define MOVE_TYPE_STATIC (unsigned int) 32
  56. #define MOVE_TYPE_FLOATER (unsigned int) 64
  57. #define MOVE_TYPE_UNDERWATER (unsigned int) 128
  58. #define MOVE_TYPE_STATIC_LAND (unsigned int) 256
  59. #define MOVE_TYPE_STATIC_WATER (unsigned int) 512
  60. #define MOVE_TYPE_UNIT (unsigned int) 31 // used to filter out unit movement type (e.g. only MOVE_TYPE_SEA for sumarines (that also have MOVE_TYPE_UNDERWATER set))
  61. #define MOVE_TYPE_CONTINENT_BOUND (unsigned int) 9
  62. // unit types (for bitfield)
  63. #define UNIT_TYPE_BUILDER (unsigned int) 1
  64. #define UNIT_TYPE_FACTORY (unsigned int) 2
  65. #define UNIT_TYPE_ASSISTER (unsigned int) 4
  66. #define UNIT_TYPE_RESURRECTOR (unsigned int) 8
  67. #define UNIT_TYPE_COMMANDER (unsigned int) 16
  68. #define UNIT_TYPE_ASSAULT (unsigned int) 32
  69. #define UNIT_TYPE_ANTI_AIR (unsigned int) 64
  70. #define UNIT_TYPE_ARTY (unsigned int) 128
  71. #define UNIT_TYPE_FIGHTER (unsigned int) 256
  72. #define UNIT_TYPE_BOMBER (unsigned int) 512
  73. #define UNIT_TYPE_GUNSHIP (unsigned int) 1024
  74. enum UnitCategory {UNKNOWN, STATIONARY_DEF, STATIONARY_ARTY, STORAGE, STATIONARY_CONSTRUCTOR, AIR_BASE,
  75. STATIONARY_RECON, STATIONARY_JAMMER, STATIONARY_LAUNCHER, DEFLECTION_SHIELD, POWER_PLANT, EXTRACTOR, METAL_MAKER,
  76. COMMANDER, GROUND_ASSAULT, AIR_ASSAULT, HOVER_ASSAULT, SEA_ASSAULT, SUBMARINE_ASSAULT, GROUND_ARTY, SEA_ARTY, HOVER_ARTY,
  77. SCOUT, MOBILE_TRANSPORT, MOBILE_JAMMER, MOBILE_LAUNCHER, MOBILE_CONSTRUCTOR};
  78. enum UnitType {UNKNOWN_UNIT, ASSAULT_UNIT, ANTI_AIR_UNIT, BOMBER_UNIT, ARTY_UNIT};
  79. enum UnitTask {UNIT_IDLE, UNIT_ATTACKING, DEFENDING, GUARDING, MOVING, BUILDING, SCOUTING, ASSISTING, RECLAIMING, HEADING_TO_RALLYPOINT, UNIT_KILLED, ENEMY_UNIT, BOMB_TARGET};
  80. enum MapType {LAND_MAP, LAND_WATER_MAP, WATER_MAP, UNKNOWN_MAP};
  81. class AAIGroup;
  82. class AAIConstructor;
  83. struct AAIUnit
  84. {
  85. int unit_id;
  86. int def_id;
  87. AAIGroup *group;
  88. AAIConstructor *cons;
  89. UnitTask status;
  90. int last_order;
  91. };
  92. #endif