1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
|
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
#ifndef AI_LEGACY_SUPPORT_H
#define AI_LEGACY_SUPPORT_H
#include "System/float3.h"
#include "System/Color.h"
#include <string>
// GetProperty() constants ------------ data type that buffer will be filled with:
#define AIVAL_UNITDEF 1 // const UnitDef*
#define AIVAL_CURRENT_FUEL 2 // float
#define AIVAL_STOCKPILED 3 // int
#define AIVAL_STOCKPILE_QUED 4 // int
#define AIVAL_UNIT_MAXSPEED 5 // float
// GetValue() constants
#define AIVAL_NUMDAMAGETYPES 1 // int
#define AIVAL_MAP_CHECKSUM 3 // unsinged int
#define AIVAL_DEBUG_MODE 4 // bool
//#define AIVAL_GAME_MODE 5 // int // deprecated
#define AIVAL_GAME_PAUSED 6 // bool
#define AIVAL_GAME_SPEED_FACTOR 7 // float
#define AIVAL_GUI_VIEW_RANGE 8 // float
#define AIVAL_GUI_SCREENX 9 // float
#define AIVAL_GUI_SCREENY 10 // float
#define AIVAL_GUI_CAMERA_DIR 11 // float3
#define AIVAL_GUI_CAMERA_POS 12 // float3
#define AIVAL_LOCATE_FILE_R 15 // char*
#define AIVAL_LOCATE_FILE_W 16 // char*
#define AIVAL_UNIT_LIMIT 17 // int
#define AIVAL_SCRIPT 18 // const char* - buffer for pointer to char
#ifdef BUILDING_AI
namespace springLegacyAI {
#endif // BUILDING_AI
struct UnitDef;
struct FeatureDef;
struct WeaponDef;
struct UnitResourceInfo
{
float metalUse;
float energyUse;
float metalMake;
float energyMake;
};
struct PointMarker
{
float3 pos;
SColor color;
// don't store this pointer anywhere, it may become
// invalid at any time after GetMapPoints()
const char* label;
};
struct LineMarker {
float3 pos;
float3 pos2;
SColor color;
};
// HandleCommand structs:
#define AIHCQuerySubVersionId 0
#define AIHCAddMapPointId 1
#define AIHCAddMapLineId 2
#define AIHCRemoveMapPointId 3
#define AIHCSendStartPosId 4
#define AIHCGetUnitDefByIdId 5
#define AIHCGetWeaponDefByIdId 6
#define AIHCGetFeatureDefByIdId 7
#define AIHCTraceRayId 8
#define AIHCPauseId 9
#define AIHCGetDataDirId 10
#define AIHCDebugDrawId 11
#define AIHCFeatureTraceRayId 12
struct AIHCAddMapPoint ///< result of HandleCommand is 1 - ok supported
{
float3 pos; ///< on this position, only x and z matter
const char* label; ///< create this text on pos in my team color
};
struct AIHCAddMapLine ///< result of HandleCommand is 1 - ok supported
{
float3 posfrom; ///< draw line from this pos
float3 posto; ///< to this pos, again only x and z matter
};
struct AIHCRemoveMapPoint ///< result of HandleCommand is 1 - ok supported
{
float3 pos; ///< remove map points and lines near this point (100 distance)
};
struct AIHCSendStartPos ///< result of HandleCommand is 1 - ok supported
{
bool ready;
float3 pos;
};
struct AIHCGetUnitDefById ///< result of HandleCommand is 1 - ok supported
{
int unitDefId;
const UnitDef* ret;
};
struct AIHCGetWeaponDefById ///< result of HandleCommand is 1 - ok supported
{
int weaponDefId;
const WeaponDef* ret;
};
struct AIHCGetFeatureDefById ///< result of HandleCommand is 1 - ok supported
{
int featureDefId;
const FeatureDef* ret;
};
struct AIHCTraceRay
{
float3 rayPos;
float3 rayDir;
float rayLen;
int srcUID;
int hitUID;
int flags;
};
struct AIHCFeatureTraceRay
{
float3 rayPos;
float3 rayDir;
float rayLen;
int srcUID;
int hitFID;
int flags;
};
struct AIHCPause
{
bool enable;
const char* reason;
};
/**
* See Clb_DataDirs_allocatePath in rts/ExternalAI/Interface/SSkirmishAICallback.h
* ret_path should be copied by the AI after retrieving it, but not freed!
*/
struct AIHCGetDataDir ///< result of HandleCommand is 1 for if path fetched, 0 for fail
{
const char* relPath;
bool writeable;
bool create;
bool dir;
bool common;
char* ret_path;
};
struct AIHCDebugDraw
{
enum {
AIHC_DEBUGDRAWER_MODE_ADD_GRAPH_POINT = 0,
AIHC_DEBUGDRAWER_MODE_DEL_GRAPH_POINTS = 1,
AIHC_DEBUGDRAWER_MODE_SET_GRAPH_POS = 2,
AIHC_DEBUGDRAWER_MODE_SET_GRAPH_SIZE = 3,
AIHC_DEBUGDRAWER_MODE_SET_GRAPH_LINE_COLOR = 4,
AIHC_DEBUGDRAWER_MODE_SET_GRAPH_LINE_LABEL = 5,
AIHC_DEBUGDRAWER_MODE_ADD_OVERLAY_TEXTURE = 6,
AIHC_DEBUGDRAWER_MODE_UPDATE_OVERLAY_TEXTURE = 7,
AIHC_DEBUGDRAWER_MODE_DEL_OVERLAY_TEXTURE = 8,
AIHC_DEBUGDRAWER_MODE_SET_OVERLAY_TEXTURE_POS = 9,
AIHC_DEBUGDRAWER_MODE_SET_OVERLAY_TEXTURE_SIZE = 10,
AIHC_DEBUGDRAWER_MODE_SET_OVERLAY_TEXTURE_LABEL = 11,
};
int cmdMode;
float x, y; // in-params
float w, h; // in-params
int lineId; // in-param
int numPoints; // in-param
float3 color; // in-param
std::string label; // in-param
int texHandle; // in/out-param
const float* texData; // in-param
};
#ifdef BUILDING_AI
} // namespace springLegacyAI
#endif // BUILDING_AI
#endif // AI_LEGACY_SUPPORT_H
|