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 
10 #ifndef AAI_DEF_H
11 #define AAI_DEF_H
12 
13 #include <string>
14 
15 #include "System/float3.h"
16 
17 #ifdef _MSC_VER
18 #pragma warning(disable: 4244 4018) // signed/unsigned and loss of precision...
19 #endif
20 
21 // The following two helper functions implementations are in AAIBuildTable.cpp
22 
23 void ReplaceExtension(const char *n, char *dst, int s, const char *ext);
24 
25 #define AAI_VERSION aiexport_getVersion()
26 #define MAP_CACHE_VERSION "MAP_DATA_0_89"
27 #define MAP_LEARN_VERSION "MAP_LEARN_0_89"
28 #define MOD_LEARN_VERSION "MOD_LEARN_0_90"
29 #define CONTINENT_DATA_VERSION "MOVEMENT_MAPS_0_87"
30 
31 #define AILOG_PATH "log/"
32 #define MAP_LEARN_PATH "learn/mod/"
33 #define MOD_LEARN_PATH "learn/mod/"
34 
35 
36 class AAIMetalSpot
37 {
38 public:
AAIMetalSpot(float3 pos,float amount)39 	AAIMetalSpot(float3 pos, float amount) {this->pos = pos; this->amount = amount; occupied = false; extractor = -1; extractor_def = -1;}
AAIMetalSpot()40 	AAIMetalSpot() {pos = ZeroVector; amount = 0; occupied = false; extractor = -1; extractor_def = -1;}
41 
42 	float3 pos;
43 	bool occupied;
44 	int extractor;		// -1 if unocuppied
45 	int extractor_def;	// -1 if unocuppied
46 	float amount;
47 };
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 
61 
62 #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))
63 #define MOVE_TYPE_CONTINENT_BOUND (unsigned int) 9
64 
65 
66 // unit types (for bitfield)
67 #define UNIT_TYPE_BUILDER (unsigned int) 1
68 #define UNIT_TYPE_FACTORY (unsigned int) 2
69 #define UNIT_TYPE_ASSISTER (unsigned int) 4
70 #define UNIT_TYPE_RESURRECTOR (unsigned int) 8
71 #define UNIT_TYPE_COMMANDER (unsigned int) 16
72 #define UNIT_TYPE_ASSAULT (unsigned int) 32
73 #define UNIT_TYPE_ANTI_AIR (unsigned int) 64
74 #define UNIT_TYPE_ARTY (unsigned int) 128
75 #define UNIT_TYPE_FIGHTER (unsigned int) 256
76 #define UNIT_TYPE_BOMBER (unsigned int) 512
77 #define UNIT_TYPE_GUNSHIP (unsigned int) 1024
78 
79 
80 enum UnitCategory {UNKNOWN, STATIONARY_DEF, STATIONARY_ARTY, STORAGE, STATIONARY_CONSTRUCTOR, AIR_BASE,
81 STATIONARY_RECON, STATIONARY_JAMMER, STATIONARY_LAUNCHER, DEFLECTION_SHIELD, POWER_PLANT, EXTRACTOR, METAL_MAKER,
82 COMMANDER, GROUND_ASSAULT, AIR_ASSAULT, HOVER_ASSAULT, SEA_ASSAULT, SUBMARINE_ASSAULT, GROUND_ARTY, SEA_ARTY, HOVER_ARTY,
83 SCOUT, MOBILE_TRANSPORT, MOBILE_JAMMER, MOBILE_LAUNCHER, MOBILE_CONSTRUCTOR};
84 
85 enum UnitType {UNKNOWN_UNIT, ASSAULT_UNIT, ANTI_AIR_UNIT, BOMBER_UNIT, ARTY_UNIT};
86 enum UnitTask {UNIT_IDLE, UNIT_ATTACKING, DEFENDING, GUARDING, MOVING, BUILDING, SCOUTING, ASSISTING, RECLAIMING, HEADING_TO_RALLYPOINT, UNIT_KILLED, ENEMY_UNIT, BOMB_TARGET};
87 enum MapType {LAND_MAP, LAND_WATER_MAP, WATER_MAP, UNKNOWN_MAP};
88 
89 class AAIGroup;
90 class AAIConstructor;
91 
92 struct AAIUnit
93 {
94 	int unit_id;
95 	int def_id;
96 	AAIGroup *group;
97 	AAIConstructor *cons;
98 	UnitTask status;
99 	int last_order;
100 };
101 
102 #endif
103 
104