1 #ifndef KAIK_DEFINES_HDR
2 #define KAIK_DEFINES_HDR
3 
4 #include <cfloat>     // FLT_MAX, FLT_MIN
5 
6 #include "AIExport.h" // for aiexport_getVersion()
7 
8 #define AI_VERSION_NUMBER	aiexport_getVersion()
9 #define AI_NAME				std::string("KAIK ") + AI_VERSION_NUMBER + " Unofficial"
10 #define AI_DATE				__DATE__
11 #define AI_VERSION			AI_NAME + " (built " + AI_DATE + ")"
12 #define AI_CREDITS			"(developed by Krogothe, Tournesol, Firenu; now maintained by Kloot)"
13 
14 // as of (at least) 58f99d175e79c02b1abc9be50d48325447cf7015
15 // float3::max{x,z}pos do not have their proper values when
16 // accessed in AI code, so float3::{Check,Is}InBounds() are
17 // both unreliable
18 #define MAPPOS_IN_BOUNDS(pos) \
19 	((pos.x >= 0) && (pos.x < ai->cb->GetMapWidth()  * SQUARE_SIZE)  && \
20 	 (pos.z >= 0) && (pos.z < ai->cb->GetMapHeight() * SQUARE_SIZE))
21 
22 // Shortcuts
23 #define GCAT(a)         (ai->ut->GetCategory(a))
24 
25 // RNGs
26 #define RANDINT         ai->math->RandInt()
27 #define RANDFLOAT       ai->math->MTRandFloat()
28 
29 // Timer
30 #define TIMER_START     ai->math->TimerStart()
31 #define TIMER_TICKS     ai->math->TimerTicks()
32 #define TIMER_SECS      ai->math->TimerSecs()
33 
34 // Folders
35 //    relative to "AI/Skirmish/KAIK/0.13"
36 #define ROOTFOLDER      ""
37 
38 #define LOGFOLDER       std::string(ROOTFOLDER) + "logs/"
39 #define METALFOLDER     std::string(ROOTFOLDER) + "metal/"
40 #define CFGFOLDER       std::string(ROOTFOLDER) + "configs/"
41 #define CFGVERSION      1
42 
43 // Error outputs
44 #define ERRORVECTOR     float3(-1.0f, 0.0f, 0.0f)
45 
46 // Maths
47 #define MY_FLT_MAX      FLT_MAX
48 #define MY_FLT_MIN      FLT_MIN
49 
50 #define DEG2RAD         0.01745329252f
51 #define RAD2DEG         57.2957795f
52 
53 // Map sizing multipliers
54 #define METALMAP2MAPUNIT         2
55 #define MAPUNIT2POS              8
56 #define METALMAP2POS            16
57 
58 // Threatmap / pathfinder resolution
59 #define THREATRES                8
60 #define THREATVAL_BASE           1.0f
61 
62 // Maximum Builders helping each factory
63 #define MAXBUILDERSPERFACTORY    2
64 #define BUILDERFACTORYCOSTRATIO  0.5
65 // #define DEFENSEFACTORYRATIO   5
66 #define DEFENSEFACTORYRATIO      4
67 
68 // Metal to energy ratio for cost calculations
69 #define METAL2ENERGY            45
70 
71 // Minimum stocks for a "feasible" construction (ratio of storage)
72 #define FEASIBLEMSTORRATIO       0.3
73 #define FEASIBLEESTORRATIO       0.6
74 
75 // Time idle units stay in limbo mode (in frames)
76 #define LIMBOTIME               40
77 // Income multiplier for tech tree advancement
78 #define INCOMEMULTIPLIER         5
79 // Seconds of storage to be had
80 #define STORAGETIME              6
81 // factory-feasibility ratio
82 #define ECONRATIO                0.85
83 // HACK: use only the last movetype
84 #define PATHTOUSE                ai->pather->NumOfMoveTypes - 1
85 
86 // ClosestBuildsite Stuff
87 #define DEFCBS_SEPARATION        8
88 #define DEFCBS_RADIUS         2000
89 
90 // Command lag acceptance 5 sec (30 * 5)
91 #define LAG_ACCEPTANCE         150
92 
93 // SpotFinder stuff
94 #define CACHEFACTOR              8
95 
96 
97 // hub build-placement stuff
98 #define QUADRANT_TOP_LEFT        0
99 #define QUADRANT_TOP_RIGHT       1
100 #define QUADRANT_BOT_RIGHT       2
101 #define QUADRANT_BOT_LEFT        3
102 #define FACING_DOWN              0
103 #define FACING_RIGHT             1
104 #define FACING_UP                2
105 #define FACING_LEFT              3
106 
107 #define MAX_NUKE_SILOS          16
108 
109 // Unit categories
110 enum UnitCategory {
111 	CAT_COMM,
112 	CAT_ENERGY,
113 	CAT_MEX,
114 	CAT_MMAKER,
115 	CAT_BUILDER,
116 	CAT_ESTOR,
117 	CAT_MSTOR,
118 	CAT_FACTORY,
119 	CAT_DEFENCE,
120 	CAT_G_ATTACK,
121 	CAT_NUKE,
122 	// CAT_SHIELD,
123 	CAT_LAST
124 };
125 
126 // UnitDef categories
127 enum UnitDefCategory {
128 	CAT_GROUND_FACTORY,
129 	CAT_GROUND_BUILDER,
130 	CAT_GROUND_ATTACKER,
131 	CAT_METAL_EXTRACTOR,
132 	CAT_METAL_MAKER,
133 	CAT_METAL_STORAGE,
134 	CAT_ENERGY_STORAGE,
135 	CAT_GROUND_ENERGY,
136 	CAT_GROUND_DEFENSE,
137 	CAT_NUKE_SILO
138 };
139 
140 #endif
141