1 /* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */ 2 3 #ifndef AI_S_COMMANDS_H 4 #define AI_S_COMMANDS_H 5 6 // IMPORTANT NOTE: external systems parse this file, 7 // so DO NOT CHANGE the style and format it uses without 8 // major though in advance, and deliberation with hoijui! 9 10 #include "aidefines.h" 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 // NOTE structs should not be empty (C90), so add a useless member if needed 17 18 #define COMMAND_TO_ID_ENGINE -1 19 20 /** 21 * Commands are used for all activities that change game state, 22 * in spring terms: synced events 23 * Activities that leave the game state as it is (-> unsynced events) 24 * are handled through function pointers in SSkirmishAICallback.h. 25 * 26 * Each command type can be identified through a unique ID, 27 * which we call command topic. 28 * Commands are usually sent from AIs to the engine, 29 * but there are plans for the future to allow AI -> AI command scheduling. 30 * 31 * Note: Do NOT change the values assigned to these topics in enum CommandTopic, 32 * as this would be bad for inter-version compatibility. 33 * You should always append new command topics at the end of this list, 34 * adjust NUM_CMD_TOPICS and add the struct in AIINTERFACE_COMMANDS_ABI_VERSION. 35 * 36 * @see SSkirmishAICallback.handleCommand() 37 */ 38 enum CommandTopic { 39 COMMAND_NULL = 0, 40 COMMAND_DRAWER_POINT_ADD = 1, 41 COMMAND_DRAWER_LINE_ADD = 2, 42 COMMAND_DRAWER_POINT_REMOVE = 3, 43 COMMAND_SEND_START_POS = 4, 44 COMMAND_CHEATS_SET_MY_INCOME_MULTIPLIER = 5, 45 COMMAND_SEND_TEXT_MESSAGE = 6, 46 COMMAND_SET_LAST_POS_MESSAGE = 7, 47 COMMAND_SEND_RESOURCES = 8, 48 COMMAND_SEND_UNITS = 9, 49 COMMAND_UNUSED_0 = 10, // unused 50 COMMAND_UNUSED_1 = 11, // unused 51 COMMAND_GROUP_CREATE = 12, // unused 52 COMMAND_GROUP_ERASE = 13, // unused 53 COMMAND_GROUP_ADD_UNIT = 14, // unused 54 COMMAND_GROUP_REMOVE_UNIT = 15, // unused 55 COMMAND_PATH_INIT = 16, 56 COMMAND_PATH_GET_APPROXIMATE_LENGTH = 17, 57 COMMAND_PATH_GET_NEXT_WAYPOINT = 18, 58 COMMAND_PATH_FREE = 19, 59 COMMAND_CHEATS_GIVE_ME_RESOURCE = 20, 60 COMMAND_CALL_LUA_RULES = 21, 61 COMMAND_DRAWER_ADD_NOTIFICATION = 22, 62 COMMAND_DRAWER_DRAW_UNIT = 23, 63 COMMAND_DRAWER_PATH_START = 24, 64 COMMAND_DRAWER_PATH_FINISH = 25, 65 COMMAND_DRAWER_PATH_DRAW_LINE = 26, 66 COMMAND_DRAWER_PATH_DRAW_LINE_AND_ICON = 27, 67 COMMAND_DRAWER_PATH_DRAW_ICON_AT_LAST_POS = 28, 68 COMMAND_DRAWER_PATH_BREAK = 29, 69 COMMAND_DRAWER_PATH_RESTART = 30, 70 COMMAND_DRAWER_FIGURE_CREATE_SPLINE = 31, 71 COMMAND_DRAWER_FIGURE_CREATE_LINE = 32, 72 COMMAND_DRAWER_FIGURE_SET_COLOR = 33, 73 COMMAND_DRAWER_FIGURE_DELETE = 34, 74 COMMAND_UNIT_BUILD = 35, 75 COMMAND_UNIT_STOP = 36, 76 COMMAND_UNIT_WAIT = 37, 77 COMMAND_UNIT_WAIT_TIME = 38, 78 COMMAND_UNIT_WAIT_DEATH = 39, 79 COMMAND_UNIT_WAIT_SQUAD = 40, 80 COMMAND_UNIT_WAIT_GATHER = 41, 81 COMMAND_UNIT_MOVE = 42, 82 COMMAND_UNIT_PATROL = 43, 83 COMMAND_UNIT_FIGHT = 44, 84 COMMAND_UNIT_ATTACK = 45, 85 COMMAND_UNIT_ATTACK_AREA = 46, 86 COMMAND_UNIT_GUARD = 47, 87 COMMAND_UNIT_AI_SELECT = 48, 88 COMMAND_UNIT_GROUP_ADD = 49, 89 COMMAND_UNIT_GROUP_CLEAR = 50, 90 COMMAND_UNIT_REPAIR = 51, 91 COMMAND_UNIT_SET_FIRE_STATE = 52, 92 COMMAND_UNIT_SET_MOVE_STATE = 53, 93 COMMAND_UNIT_SET_BASE = 54, 94 COMMAND_UNIT_SELF_DESTROY = 55, 95 COMMAND_UNIT_SET_WANTED_MAX_SPEED = 56, 96 COMMAND_UNIT_LOAD_UNITS = 57, 97 COMMAND_UNIT_LOAD_UNITS_AREA = 58, 98 COMMAND_UNIT_LOAD_ONTO = 59, 99 COMMAND_UNIT_UNLOAD_UNITS_AREA = 60, 100 COMMAND_UNIT_UNLOAD_UNIT = 61, 101 COMMAND_UNIT_SET_ON_OFF = 62, 102 COMMAND_UNIT_RECLAIM_UNIT = 63, 103 COMMAND_UNIT_RECLAIM_AREA = 64, 104 COMMAND_UNIT_CLOAK = 65, 105 COMMAND_UNIT_STOCKPILE = 66, 106 COMMAND_UNIT_D_GUN = 67, 107 COMMAND_UNIT_D_GUN_POS = 68, 108 COMMAND_UNIT_RESTORE_AREA = 69, 109 COMMAND_UNIT_SET_REPEAT = 70, 110 COMMAND_UNIT_SET_TRAJECTORY = 71, 111 COMMAND_UNIT_RESURRECT = 72, 112 COMMAND_UNIT_RESURRECT_AREA = 73, 113 COMMAND_UNIT_CAPTURE = 74, 114 COMMAND_UNIT_CAPTURE_AREA = 75, 115 COMMAND_UNIT_SET_AUTO_REPAIR_LEVEL = 76, 116 COMMAND_UNIT_SET_IDLE_MODE = 77, 117 COMMAND_UNIT_CUSTOM = 78, 118 COMMAND_CHEATS_GIVE_ME_NEW_UNIT = 79, 119 COMMAND_TRACE_RAY = 80, 120 COMMAND_PAUSE = 81, 121 COMMAND_UNIT_RECLAIM_FEATURE = 82, 122 //const int COMMAND_UNIT_ATTACK_POS 123 //const int COMMAND_UNIT_INSERT 124 //const int COMMAND_UNIT_REMOVE 125 //const int COMMAND_UNIT_ATTACK_AREA 126 //const int COMMAND_UNIT_ATTACK_LOOPBACK 127 //const int COMMAND_UNIT_GROUP_SELECT 128 //const int COMMAND_UNIT_INTERNAL 129 COMMAND_DEBUG_DRAWER_GRAPH_SET_POS = 83, 130 COMMAND_DEBUG_DRAWER_GRAPH_SET_SIZE = 84, 131 COMMAND_DEBUG_DRAWER_GRAPH_LINE_ADD_POINT = 85, 132 COMMAND_DEBUG_DRAWER_GRAPH_LINE_DELETE_POINTS = 86, 133 COMMAND_DEBUG_DRAWER_GRAPH_LINE_SET_COLOR = 87, 134 COMMAND_DEBUG_DRAWER_GRAPH_LINE_SET_LABEL = 88, 135 COMMAND_DEBUG_DRAWER_OVERLAYTEXTURE_ADD = 89, 136 COMMAND_DEBUG_DRAWER_OVERLAYTEXTURE_UPDATE = 90, 137 COMMAND_DEBUG_DRAWER_OVERLAYTEXTURE_DELETE = 91, 138 COMMAND_DEBUG_DRAWER_OVERLAYTEXTURE_SET_POS = 92, 139 COMMAND_DEBUG_DRAWER_OVERLAYTEXTURE_SET_SIZE = 93, 140 COMMAND_DEBUG_DRAWER_OVERLAYTEXTURE_SET_LABEL = 94, 141 COMMAND_TRACE_RAY_FEATURE = 95, 142 COMMAND_CALL_LUA_UI = 96, 143 }; 144 const int NUM_CMD_TOPICS = 97; 145 146 147 /** 148 * These are used in all S*UnitCommand's, 149 * in their options field, which is used as a bitfield. 150 * This allows to enable special modes of commands, 151 * which may be command specific. 152 * For example (one you all know): 153 * if (SBuildUnitCommand.options & UNIT_COMMAND_OPTION_SHIFT_KEY != 0) 154 * then: add to unit command queue, instead of replacing it 155 * 156 */ 157 enum UnitCommandOptions { 158 UNIT_COMMAND_OPTION_INTERNAL_ORDER = (1 << 3), // 8 159 UNIT_COMMAND_OPTION_RIGHT_MOUSE_KEY = (1 << 4), // 16 160 UNIT_COMMAND_OPTION_SHIFT_KEY = (1 << 5), // 32 161 UNIT_COMMAND_OPTION_CONTROL_KEY = (1 << 6), // 64 162 UNIT_COMMAND_OPTION_ALT_KEY = (1 << 7), // 128 163 }; 164 165 166 #define UNIT_COMMAND_BUILD_NO_FACING -1 167 168 169 #define AIINTERFACE_COMMANDS_ABI_VERSION ( \ 170 sizeof(struct SSetMyIncomeMultiplierCheatCommand) \ 171 + sizeof(struct SGiveMeResourceCheatCommand) \ 172 + sizeof(struct SGiveMeNewUnitCheatCommand) \ 173 + sizeof(struct SSendTextMessageCommand) \ 174 + sizeof(struct SSetLastPosMessageCommand) \ 175 + sizeof(struct SSendResourcesCommand) \ 176 + sizeof(struct SSendUnitsCommand) \ 177 + sizeof(struct SCreateGroupCommand) \ 178 + sizeof(struct SEraseGroupCommand) \ 179 + sizeof(struct SInitPathCommand) \ 180 + sizeof(struct SGetApproximateLengthPathCommand) \ 181 + sizeof(struct SGetNextWaypointPathCommand) \ 182 + sizeof(struct SFreePathCommand) \ 183 + sizeof(struct SCallLuaRulesCommand) \ 184 + sizeof(struct SCallLuaUICommand) \ 185 + sizeof(struct SSendStartPosCommand) \ 186 + sizeof(struct SAddNotificationDrawerCommand) \ 187 + sizeof(struct SAddPointDrawCommand) \ 188 + sizeof(struct SRemovePointDrawCommand) \ 189 + sizeof(struct SAddLineDrawCommand) \ 190 + sizeof(struct SStartPathDrawerCommand) \ 191 + sizeof(struct SFinishPathDrawerCommand) \ 192 + sizeof(struct SDrawLinePathDrawerCommand) \ 193 + sizeof(struct SDrawLineAndIconPathDrawerCommand) \ 194 + sizeof(struct SDrawIconAtLastPosPathDrawerCommand) \ 195 + sizeof(struct SBreakPathDrawerCommand) \ 196 + sizeof(struct SRestartPathDrawerCommand) \ 197 + sizeof(struct SCreateSplineFigureDrawerCommand) \ 198 + sizeof(struct SCreateLineFigureDrawerCommand) \ 199 + sizeof(struct SSetColorFigureDrawerCommand) \ 200 + sizeof(struct SDeleteFigureDrawerCommand) \ 201 + sizeof(struct SDrawUnitDrawerCommand) \ 202 + sizeof(struct SBuildUnitCommand) \ 203 + sizeof(struct SStopUnitCommand) \ 204 + sizeof(struct SWaitUnitCommand) \ 205 + sizeof(struct STimeWaitUnitCommand) \ 206 + sizeof(struct SDeathWaitUnitCommand) \ 207 + sizeof(struct SSquadWaitUnitCommand) \ 208 + sizeof(struct SGatherWaitUnitCommand) \ 209 + sizeof(struct SMoveUnitCommand) \ 210 + sizeof(struct SPatrolUnitCommand) \ 211 + sizeof(struct SFightUnitCommand) \ 212 + sizeof(struct SAttackUnitCommand) \ 213 + sizeof(struct SAttackAreaUnitCommand) \ 214 + sizeof(struct SGuardUnitCommand) \ 215 + sizeof(struct SAiSelectUnitCommand) \ 216 + sizeof(struct SGroupAddUnitCommand) \ 217 + sizeof(struct SGroupClearUnitCommand) \ 218 + sizeof(struct SRepairUnitCommand) \ 219 + sizeof(struct SSetFireStateUnitCommand) \ 220 + sizeof(struct SSetMoveStateUnitCommand) \ 221 + sizeof(struct SSetBaseUnitCommand) \ 222 + sizeof(struct SSelfDestroyUnitCommand) \ 223 + sizeof(struct SSetWantedMaxSpeedUnitCommand) \ 224 + sizeof(struct SLoadUnitsUnitCommand) \ 225 + sizeof(struct SLoadUnitsAreaUnitCommand) \ 226 + sizeof(struct SLoadOntoUnitCommand) \ 227 + sizeof(struct SUnloadUnitCommand) \ 228 + sizeof(struct SUnloadUnitsAreaUnitCommand) \ 229 + sizeof(struct SSetOnOffUnitCommand) \ 230 + sizeof(struct SReclaimUnitUnitCommand) \ 231 + sizeof(struct SReclaimAreaUnitCommand) \ 232 + sizeof(struct SCloakUnitCommand) \ 233 + sizeof(struct SStockpileUnitCommand) \ 234 + sizeof(struct SDGunUnitCommand) \ 235 + sizeof(struct SDGunPosUnitCommand) \ 236 + sizeof(struct SRestoreAreaUnitCommand) \ 237 + sizeof(struct SSetRepeatUnitCommand) \ 238 + sizeof(struct SSetTrajectoryUnitCommand) \ 239 + sizeof(struct SResurrectUnitCommand) \ 240 + sizeof(struct SResurrectAreaUnitCommand) \ 241 + sizeof(struct SCaptureUnitCommand) \ 242 + sizeof(struct SCaptureAreaUnitCommand) \ 243 + sizeof(struct SSetAutoRepairLevelUnitCommand) \ 244 + sizeof(struct SSetIdleModeUnitCommand) \ 245 + sizeof(struct SCustomUnitCommand) \ 246 + sizeof(struct STraceRayCommand) \ 247 + sizeof(struct SPauseCommand) \ 248 + sizeof(struct SReclaimFeatureUnitCommand) \ 249 + sizeof(struct SSetPositionGraphDrawerDebugCommand) \ 250 + sizeof(struct SSetSizeGraphDrawerDebugCommand) \ 251 + sizeof(struct SAddPointLineGraphDrawerDebugCommand) \ 252 + sizeof(struct SDeletePointsLineGraphDrawerDebugCommand) \ 253 + sizeof(struct SSetColorLineGraphDrawerDebugCommand) \ 254 + sizeof(struct SSetLabelLineGraphDrawerDebugCommand) \ 255 + sizeof(struct SAddOverlayTextureDrawerDebugCommand) \ 256 + sizeof(struct SUpdateOverlayTextureDrawerDebugCommand) \ 257 + sizeof(struct SDeleteOverlayTextureDrawerDebugCommand) \ 258 + sizeof(struct SSetPositionOverlayTextureDrawerDebugCommand) \ 259 + sizeof(struct SSetSizeOverlayTextureDrawerDebugCommand) \ 260 + sizeof(struct SSetLabelOverlayTextureDrawerDebugCommand) \ 261 + sizeof(struct SFeatureTraceRayCommand) \ 262 ) 263 264 /** 265 * Allows one to give an income (dis-)advantage to the team 266 * controlled by the Skirmish AI. 267 * This value can also be set through the GameSetup script, 268 * with the difference that it causes an instant desync when set here. 269 */ 270 struct SSetMyIncomeMultiplierCheatCommand { 271 /// default: 1.0; common: [0.0, 2.0]; valid: [0.0, FLOAT_MAX] 272 float factor; 273 }; //$ COMMAND_CHEATS_SET_MY_INCOME_MULTIPLIER Cheats_setMyIncomeMultiplier 274 275 /** 276 * The AI team receives the specified amount of units of the specified resource. 277 */ 278 struct SGiveMeResourceCheatCommand { 279 int resourceId; 280 float amount; 281 }; //$ COMMAND_CHEATS_GIVE_ME_RESOURCE Cheats_giveMeResource REF:resourceId->Resource 282 283 /** 284 * Creates a new unit with the selected name at pos, 285 * and returns its unit ID in ret_newUnitId. 286 */ 287 struct SGiveMeNewUnitCheatCommand { 288 int unitDefId; 289 float* pos_posF3; 290 int ret_newUnitId; 291 }; //$ COMMAND_CHEATS_GIVE_ME_NEW_UNIT Cheats_giveMeUnit REF:unitDefId->UnitDef REF:ret_newUnitId->Unit 292 293 /** 294 * @brief Sends a chat/text message to other players. 295 * This text will also end up in infolog.txt. 296 */ 297 struct SSendTextMessageCommand { 298 const char* text; 299 int zone; 300 }; //$ COMMAND_SEND_TEXT_MESSAGE Game_sendTextMessage 301 302 /** 303 * Assigns a map location to the last text message sent by the AI. 304 */ 305 struct SSetLastPosMessageCommand { 306 float* pos_posF3; 307 }; //$ COMMAND_SET_LAST_POS_MESSAGE Game_setLastMessagePosition 308 309 /** 310 * Give \<amount\> units of resource \<resourceId\> to team \<receivingTeam\>. 311 * - the amount is capped to the AI team's resource levels 312 * - does not check for alliance with \<receivingTeam\> 313 * - LuaRules might not allow resource transfers, AI's must verify the deduction 314 */ 315 struct SSendResourcesCommand { 316 int resourceId; 317 float amount; 318 int receivingTeamId; 319 bool ret_isExecuted; 320 }; //$ COMMAND_SEND_RESOURCES Economy_sendResource REF:resourceId->Resource REF:receivingTeamId->Team 321 322 /** 323 * Give units specified by \<unitIds\> to team \<receivingTeam\>. 324 * \<ret_sentUnits\> represents how many actually were transferred. 325 * Make sure this always matches the size of \<unitIds\> you passed in. 326 * If it does not, then some unitId's were filtered out. 327 * - does not check for alliance with \<receivingTeam\> 328 * - AI's should check each unit if it is still under control of their 329 * team after the transaction via UnitTaken() and UnitGiven(), since 330 * LuaRules might block part of it 331 */ 332 struct SSendUnitsCommand { 333 int* unitIds; 334 int unitIds_size; 335 int receivingTeamId; 336 int ret_sentUnits; 337 }; //$ COMMAND_SEND_UNITS Economy_sendUnits REF:MULTI:unitIds->Unit REF:receivingTeamId->Team 338 339 /// Creates a group and returns the id it was given, returns -1 on failure 340 struct SCreateGroupCommand { 341 int ret_groupId; 342 }; //$ COMMAND_GROUP_CREATE Group_create REF:ret_groupId->Group STATIC 343 344 /// Erases a specified group 345 struct SEraseGroupCommand { 346 int groupId; 347 }; //$ COMMAND_GROUP_ERASE Group_erase REF:groupId->Group 348 349 /** 350 * The following functions allow the AI to use the built-in path-finder. 351 * 352 * - call InitPath and you get a pathId back 353 * - use this to call GetNextWaypoint to get subsequent waypoints; 354 * the waypoints are centered on 8*8 squares 355 * - note that the pathfinder calculates the waypoints as needed, 356 * so do not retrieve them until they are needed 357 * - the waypoint's x and z coordinates are returned in x and z, 358 * while y is used for status codes: 359 * y = 0: legal path waypoint IFF x >= 0 and z >= 0 360 * y = -1: temporary waypoint, path not yet available 361 * - for pathType, @see UnitDef_MoveData_getPathType() 362 * - goalRadius defines a goal area within which any square could be accepted as 363 * path target. If a singular goal position is wanted, use 0.0f. 364 * default: 8.0f 365 */ 366 struct SInitPathCommand { 367 /// The starting location of the requested path 368 float* start_posF3; 369 /// The goal location of the requested path 370 float* end_posF3; 371 /// For what type of unit should the path be calculated 372 int pathType; 373 /// default: 8.0f 374 float goalRadius; 375 int ret_pathId; 376 }; //$ COMMAND_PATH_INIT Pathing_initPath REF:ret_pathId->Path 377 378 /** 379 * Returns the approximate path cost between two points. 380 * - for pathType @see UnitDef_MoveData_getPathType() 381 * - goalRadius defines a goal area within which any square could be accepted as 382 * path target. If a singular goal position is wanted, use 0.0f. 383 * default: 8.0f 384 */ 385 struct SGetApproximateLengthPathCommand { 386 /// The starting location of the requested path 387 float* start_posF3; 388 /// The goal location of the requested path 389 float* end_posF3; 390 /// For what type of unit should the path be calculated 391 int pathType; 392 /// default: 8.0f 393 float goalRadius; 394 float ret_approximatePathLength; 395 }; //$ COMMAND_PATH_GET_APPROXIMATE_LENGTH Pathing_getApproximateLength 396 397 struct SGetNextWaypointPathCommand { 398 int pathId; 399 float* ret_nextWaypoint_posF3_out; 400 }; //$ COMMAND_PATH_GET_NEXT_WAYPOINT Pathing_getNextWaypoint REF:pathId->Path 401 402 struct SFreePathCommand { 403 int pathId; 404 }; //$ COMMAND_PATH_FREE Pathing_freePath REF:pathId->Path 405 406 struct SCallLuaRulesCommand { 407 /// Can be set to NULL to skip passing in a string 408 const char* inData; 409 /// If this is less than 0, the data size is calculated using strlen() 410 int inSize; 411 /// this is subject to Lua garbage collection, copy it if you wish to continue using it 412 const char* ret_outData; 413 }; //$ COMMAND_CALL_LUA_RULES Lua_callRules 414 415 struct SCallLuaUICommand { 416 /// Can be set to NULL to skip passing in a string 417 const char* inData; 418 /// If this is less than 0, the data size is calculated using strlen() 419 int inSize; 420 /// this is subject to Lua garbage collection, copy it if you wish to continue using it 421 const char* ret_outData; 422 }; //$ COMMAND_CALL_LUA_UI Lua_callUI 423 424 struct SSendStartPosCommand { 425 bool ready; 426 /// on this position, only x and z matter 427 float* pos_posF3; 428 }; //$ COMMAND_SEND_START_POS Game_sendStartPosition 429 430 struct SAddNotificationDrawerCommand { 431 /// on this position, only x and z matter 432 float* pos_posF3; 433 short* color_colorS3; 434 short alpha; 435 }; //$ COMMAND_DRAWER_ADD_NOTIFICATION Map_Drawer_addNotification 436 437 struct SAddPointDrawCommand { 438 /// on this position, only x and z matter 439 float* pos_posF3; 440 /// create this text on pos in my team color 441 const char* label; 442 }; //$ COMMAND_DRAWER_POINT_ADD Map_Drawer_addPoint 443 444 struct SRemovePointDrawCommand { 445 /// remove map points and lines near this point (100 distance) 446 float* pos_posF3; 447 }; //$ COMMAND_DRAWER_POINT_REMOVE Map_Drawer_deletePointsAndLines 448 449 struct SAddLineDrawCommand { 450 /// draw line from this pos 451 float* posFrom_posF3; 452 /// to this pos, again only x and z matter 453 float* posTo_posF3; 454 }; //$ COMMAND_DRAWER_LINE_ADD Map_Drawer_addLine 455 456 struct SStartPathDrawerCommand { 457 float* pos_posF3; 458 short* color_colorS3; 459 short alpha; 460 }; //$ COMMAND_DRAWER_PATH_START Map_Drawer_PathDrawer_start 461 462 struct SFinishPathDrawerCommand { 463 // NOTE structs should not be empty (C90), so we add a useless member 464 bool iAmUseless; 465 }; //$ COMMAND_DRAWER_PATH_FINISH Map_Drawer_PathDrawer_finish 466 467 struct SDrawLinePathDrawerCommand { 468 float* endPos_posF3; 469 short* color_colorS3; 470 short alpha; 471 }; //$ COMMAND_DRAWER_PATH_DRAW_LINE Map_Drawer_PathDrawer_drawLine 472 473 struct SDrawLineAndIconPathDrawerCommand { 474 int cmdId; 475 float* endPos_posF3; 476 short* color_colorS3; 477 short alpha; 478 }; //$ COMMAND_DRAWER_PATH_DRAW_LINE_AND_ICON Map_Drawer_PathDrawer_drawLineAndCommandIcon REF:cmdId->Command 479 480 struct SDrawIconAtLastPosPathDrawerCommand { 481 int cmdId; 482 }; //$ COMMAND_DRAWER_PATH_DRAW_ICON_AT_LAST_POS Map_Drawer_PathDrawer_drawIcon REF:cmdId->Command 483 484 struct SBreakPathDrawerCommand { 485 float* endPos_posF3; 486 short* color_colorS3; 487 short alpha; 488 }; //$ COMMAND_DRAWER_PATH_BREAK Map_Drawer_PathDrawer_suspend 489 490 struct SRestartPathDrawerCommand { 491 bool sameColor; 492 }; //$ COMMAND_DRAWER_PATH_RESTART Map_Drawer_PathDrawer_restart 493 494 495 /** 496 * @brief Creates a cubic Bezier spline figure 497 * Creates a cubic Bezier spline figure from pos1 to pos4, 498 * with control points pos2 and pos3. 499 * 500 * - Each figure is part of a figure group 501 * - When creating figures, use 0 as \<figureGroupId\> to create 502 * a new figure group. 503 * The id of this figure group is returned in \<ret_newFigureGroupId\> 504 * - \<lifeTime\> specifies how many frames a figure should live 505 * before being auto-removed; 0 means no removal 506 * - \<arrow\> == true means that the figure will get an arrow at the end 507 */ 508 struct SCreateSplineFigureDrawerCommand { 509 float* pos1_posF3; 510 float* pos2_posF3; 511 float* pos3_posF3; 512 float* pos4_posF3; 513 float width; 514 /// true: means that the figure will get an arrow at the end 515 bool arrow; 516 /// how many frames a figure should live before being autoremoved, 0 means no removal 517 int lifeTime; 518 /// use 0 to get a new group 519 int figureGroupId; 520 /// the new group 521 int ret_newFigureGroupId; 522 }; //$ COMMAND_DRAWER_FIGURE_CREATE_SPLINE Map_Drawer_Figure_drawSpline REF:figureGroupId->FigureGroup REF:ret_newFigureGroupId->FigureGroup 523 524 /** 525 * @brief Creates a straight line 526 * Creates a straight line from pos1 to pos2. 527 * 528 * - Each figure is part of a figure group 529 * - When creating figures, use 0 as \<figureGroupId\> to create a new figure group. 530 * The id of this figure group is returned in \<ret_newFigureGroupId\> 531 * @param lifeTime specifies how many frames a figure should live before being auto-removed; 532 * 0 means no removal 533 * @param arrow true means that the figure will get an arrow at the end 534 */ 535 struct SCreateLineFigureDrawerCommand { 536 float* pos1_posF3; 537 float* pos2_posF3; 538 float width; 539 /// true: means that the figure will get an arrow at the end 540 bool arrow; 541 /// how many frames a figure should live before being autoremoved, 0 means no removal 542 int lifeTime; 543 /// use 0 to get a new group 544 int figureGroupId; 545 /// the new group 546 int ret_newFigureGroupId; 547 }; //$ COMMAND_DRAWER_FIGURE_CREATE_LINE Map_Drawer_Figure_drawLine REF:figureGroupId->FigureGroup REF:ret_newFigureGroupId->FigureGroup 548 549 /** 550 * Sets the color used to draw all lines of figures in a figure group. 551 */ 552 struct SSetColorFigureDrawerCommand { 553 int figureGroupId; 554 /// (x, y, z) -> (red, green, blue) 555 short* color_colorS3; 556 short alpha; 557 }; //$ COMMAND_DRAWER_FIGURE_SET_COLOR Map_Drawer_Figure_setColor REF:figureGroupId->FigureGroup 558 559 /** 560 * Removes a figure group, which means it will not be drawn anymore. 561 */ 562 struct SDeleteFigureDrawerCommand { 563 int figureGroupId; 564 }; //$ COMMAND_DRAWER_FIGURE_DELETE Map_Drawer_Figure_remove REF:figureGroupId->FigureGroup 565 566 /** 567 * This function allows you to draw units onto the map. 568 * - they only show up on the local player's screen 569 * - they will be drawn in the "standard pose" (as if before any COB scripts are run) 570 */ 571 struct SDrawUnitDrawerCommand { 572 int toDrawUnitDefId; 573 float* pos_posF3; 574 /// in radians 575 float rotation; 576 /// specifies how many frames a figure should live before being auto-removed; 0 means no removal 577 int lifeTime; 578 /// teamId affects the color of the unit 579 int teamId; 580 bool transparent; 581 bool drawBorder; 582 int facing; 583 }; //$ COMMAND_DRAWER_DRAW_UNIT Map_Drawer_drawUnit REF:toDrawUnitDefId->UnitDef 584 585 586 587 struct SBuildUnitCommand { 588 int unitId; 589 int groupId; 590 /// see enum UnitCommandOptions 591 short options; 592 /** 593 * At which frame the command will time-out and consequently be removed, 594 * if execution of it has not yet begun. 595 * Can only be set locally, is not sent over the network, and is used 596 * for temporary orders. 597 * default: MAX_INT (-> do not time-out) 598 * example: currentFrame + 15 599 */ 600 int timeOut; 601 602 int toBuildUnitDefId; 603 float* buildPos_posF3; 604 /// set it to UNIT_COMMAND_BUILD_NO_FACING, if you do not want to specify a certain facing 605 int facing; 606 }; //$ COMMAND_UNIT_BUILD Unit_build REF:toBuildUnitDefId->UnitDef 607 608 struct SStopUnitCommand { 609 int unitId; 610 int groupId; 611 /// see enum UnitCommandOptions 612 short options; 613 /** 614 * At which frame the command will time-out and consequently be removed, 615 * if execution of it has not yet begun. 616 * Can only be set locally, is not sent over the network, and is used 617 * for temporary orders. 618 * default: MAX_INT (-> do not time-out) 619 * example: currentFrame + 15 620 */ 621 int timeOut; 622 }; //$ COMMAND_UNIT_STOP Unit_stop 623 624 //struct SInsertUnitCommand { 625 // int unitId; 626 // int groupId; 627 // short options; // see enum UnitCommandOptions 628 // int timeOut; // command execution-time in ?seconds? 629 //}; 630 // 631 //struct SRemoveUnitCommand { 632 // int unitId; 633 // int groupId; 634 // short options; // see enum UnitCommandOptions 635 // int timeOut; // command execution-time in ?seconds? 636 //}; 637 638 struct SWaitUnitCommand { 639 int unitId; 640 int groupId; 641 /// see enum UnitCommandOptions 642 short options; 643 /** 644 * At which frame the command will time-out and consequently be removed, 645 * if execution of it has not yet begun. 646 * Can only be set locally, is not sent over the network, and is used 647 * for temporary orders. 648 * default: MAX_INT (-> do not time-out) 649 * example: currentFrame + 15 650 */ 651 int timeOut; 652 }; //$ COMMAND_UNIT_WAIT Unit_wait 653 654 struct STimeWaitUnitCommand { 655 int unitId; 656 int groupId; 657 /// see enum UnitCommandOptions 658 short options; 659 /** 660 * At which frame the command will time-out and consequently be removed, 661 * if execution of it has not yet begun. 662 * Can only be set locally, is not sent over the network, and is used 663 * for temporary orders. 664 * default: MAX_INT (-> do not time-out) 665 * example: currentFrame + 15 666 */ 667 int timeOut; 668 669 /// the time in seconds to wait 670 int time; 671 }; //$ COMMAND_UNIT_WAIT_TIME Unit_waitFor 672 673 /** 674 * Wait until another unit is dead, units will not wait on themselves. 675 * Example: 676 * A group of aircrafts waits for an enemy's anti-air defenses to die, 677 * before passing over their ruins to attack. 678 */ 679 struct SDeathWaitUnitCommand { 680 int unitId; 681 int groupId; 682 /// see enum UnitCommandOptions 683 short options; 684 /** 685 * At which frame the command will time-out and consequently be removed, 686 * if execution of it has not yet begun. 687 * Can only be set locally, is not sent over the network, and is used 688 * for temporary orders. 689 * default: MAX_INT (-> do not time-out) 690 * example: currentFrame + 15 691 */ 692 int timeOut; 693 694 /// wait until this unit is dead 695 int toDieUnitId; 696 }; //$ COMMAND_UNIT_WAIT_DEATH Unit_waitForDeathOf REF:toDieUnitId->Unit 697 698 /** 699 * Wait for a specific ammount of units. 700 * Usually used with factories, but does work on groups without a factory too. 701 * Example: 702 * Pick a factory and give it a rallypoint, then add a SquadWait command 703 * with the number of units you want in your squads. 704 * Units will wait at the initial rally point until enough of them 705 * have arrived to make up a squad, then they will continue along their queue. 706 */ 707 struct SSquadWaitUnitCommand { 708 int unitId; 709 int groupId; 710 /// see enum UnitCommandOptions 711 short options; 712 /** 713 * At which frame the command will time-out and consequently be removed, 714 * if execution of it has not yet begun. 715 * Can only be set locally, is not sent over the network, and is used 716 * for temporary orders. 717 * default: MAX_INT (-> do not time-out) 718 * example: currentFrame + 15 719 */ 720 int timeOut; 721 722 int numUnits; 723 }; //$ COMMAND_UNIT_WAIT_SQUAD Unit_waitForSquadSize 724 725 /** 726 * Wait for the arrival of all units included in the command. 727 * Only makes sense for a group of units. 728 * Use it after a movement command of some sort (move / fight). 729 * Units will wait until all members of the GatherWait command have arrived 730 * at their destinations before continuing. 731 */ 732 struct SGatherWaitUnitCommand { 733 int unitId; 734 int groupId; 735 /// see enum UnitCommandOptions 736 short options; 737 /** 738 * At which frame the command will time-out and consequently be removed, 739 * if execution of it has not yet begun. 740 * Can only be set locally, is not sent over the network, and is used 741 * for temporary orders. 742 * default: MAX_INT (-> do not time-out) 743 * example: currentFrame + 15 744 */ 745 int timeOut; 746 }; //$ COMMAND_UNIT_WAIT_GATHER Unit_waitForAll 747 748 struct SMoveUnitCommand { 749 int unitId; 750 int groupId; 751 /// see enum UnitCommandOptions 752 short options; 753 /** 754 * At which frame the command will time-out and consequently be removed, 755 * if execution of it has not yet begun. 756 * Can only be set locally, is not sent over the network, and is used 757 * for temporary orders. 758 * default: MAX_INT (-> do not time-out) 759 * example: currentFrame + 15 760 */ 761 int timeOut; 762 763 float* toPos_posF3; 764 }; //$ COMMAND_UNIT_MOVE Unit_moveTo 765 766 struct SPatrolUnitCommand { 767 int unitId; 768 int groupId; 769 /// see enum UnitCommandOptions 770 short options; 771 /** 772 * At which frame the command will time-out and consequently be removed, 773 * if execution of it has not yet begun. 774 * Can only be set locally, is not sent over the network, and is used 775 * for temporary orders. 776 * default: MAX_INT (-> do not time-out) 777 * example: currentFrame + 15 778 */ 779 int timeOut; 780 781 float* toPos_posF3; 782 }; //$ COMMAND_UNIT_PATROL Unit_patrolTo 783 784 struct SFightUnitCommand { 785 int unitId; 786 int groupId; 787 /// see enum UnitCommandOptions 788 short options; 789 /** 790 * At which frame the command will time-out and consequently be removed, 791 * if execution of it has not yet begun. 792 * Can only be set locally, is not sent over the network, and is used 793 * for temporary orders. 794 * default: MAX_INT (-> do not time-out) 795 * example: currentFrame + 15 796 */ 797 int timeOut; 798 799 float* toPos_posF3; 800 }; //$ COMMAND_UNIT_FIGHT Unit_fight 801 802 struct SAttackUnitCommand { 803 int unitId; 804 int groupId; 805 /// see enum UnitCommandOptions 806 short options; 807 /** 808 * At which frame the command will time-out and consequently be removed, 809 * if execution of it has not yet begun. 810 * Can only be set locally, is not sent over the network, and is used 811 * for temporary orders. 812 * default: MAX_INT (-> do not time-out) 813 * example: currentFrame + 15 814 */ 815 int timeOut; 816 817 int toAttackUnitId; 818 }; //$ COMMAND_UNIT_ATTACK Unit_attack REF:toAttackUnitId->Unit 819 820 // struct SAttackPosUnitCommand { 821 822 struct SAttackAreaUnitCommand { 823 int unitId; 824 int groupId; 825 /// see enum UnitCommandOptions 826 short options; 827 /** 828 * At which frame the command will time-out and consequently be removed, 829 * if execution of it has not yet begun. 830 * Can only be set locally, is not sent over the network, and is used 831 * for temporary orders. 832 * default: MAX_INT (-> do not time-out) 833 * example: currentFrame + 15 834 */ 835 int timeOut; 836 837 float* toAttackPos_posF3; 838 float radius; 839 }; //$ COMMAND_UNIT_ATTACK_AREA Unit_attackArea 840 841 //struct SAttackAreaUnitCommand { 842 // int unitId; 843 // int groupId; 844 // /// see enum UnitCommandOptions 845 // short options; 846 // int timeOut; 847 //}; 848 849 struct SGuardUnitCommand { 850 int unitId; 851 int groupId; 852 /// see enum UnitCommandOptions 853 short options; 854 /** 855 * At which frame the command will time-out and consequently be removed, 856 * if execution of it has not yet begun. 857 * Can only be set locally, is not sent over the network, and is used 858 * for temporary orders. 859 * default: MAX_INT (-> do not time-out) 860 * example: currentFrame + 15 861 */ 862 int timeOut; 863 864 int toGuardUnitId; 865 }; //$ COMMAND_UNIT_GUARD Unit_guard REF:toGuardUnitId->Unit 866 867 // TODO: docu (is it usefull at all?) 868 struct SAiSelectUnitCommand { 869 int unitId; 870 int groupId; 871 /// see enum UnitCommandOptions 872 short options; 873 /** 874 * At which frame the command will time-out and consequently be removed, 875 * if execution of it has not yet begun. 876 * Can only be set locally, is not sent over the network, and is used 877 * for temporary orders. 878 * default: MAX_INT (-> do not time-out) 879 * example: currentFrame + 15 880 */ 881 int timeOut; 882 }; //$ COMMAND_UNIT_AI_SELECT Unit_aiSelect 883 884 //struct SGroupSelectUnitCommand { 885 // int unitId; 886 // int groupId; 887 // /// see enum UnitCommandOptions 888 // short options; 889 // int timeOut; 890 //}; 891 892 struct SGroupAddUnitCommand { 893 int unitId; 894 int groupId; 895 /// see enum UnitCommandOptions 896 short options; 897 /** 898 * At which frame the command will time-out and consequently be removed, 899 * if execution of it has not yet begun. 900 * Can only be set locally, is not sent over the network, and is used 901 * for temporary orders. 902 * default: MAX_INT (-> do not time-out) 903 * example: currentFrame + 15 904 */ 905 int timeOut; 906 907 int toGroupId; 908 }; //$ COMMAND_UNIT_GROUP_ADD Unit_addToGroup REF:toGroupId->Group 909 910 struct SGroupClearUnitCommand { 911 int unitId; 912 int groupId; 913 /// see enum UnitCommandOptions 914 short options; 915 /** 916 * At which frame the command will time-out and consequently be removed, 917 * if execution of it has not yet begun. 918 * Can only be set locally, is not sent over the network, and is used 919 * for temporary orders. 920 * default: MAX_INT (-> do not time-out) 921 * example: currentFrame + 15 922 */ 923 int timeOut; 924 }; //$ COMMAND_UNIT_GROUP_CLEAR Unit_removeFromGroup 925 926 struct SRepairUnitCommand { 927 int unitId; 928 int groupId; 929 /// see enum UnitCommandOptions 930 short options; 931 /** 932 * At which frame the command will time-out and consequently be removed, 933 * if execution of it has not yet begun. 934 * Can only be set locally, is not sent over the network, and is used 935 * for temporary orders. 936 * default: MAX_INT (-> do not time-out) 937 * example: currentFrame + 15 938 */ 939 int timeOut; 940 941 int toRepairUnitId; 942 }; //$ COMMAND_UNIT_REPAIR Unit_repair REF:toRepairUnitId->Unit 943 944 struct SSetFireStateUnitCommand { 945 int unitId; 946 int groupId; 947 /// see enum UnitCommandOptions 948 short options; 949 /** 950 * At which frame the command will time-out and consequently be removed, 951 * if execution of it has not yet begun. 952 * Can only be set locally, is not sent over the network, and is used 953 * for temporary orders. 954 * default: MAX_INT (-> do not time-out) 955 * example: currentFrame + 15 956 */ 957 int timeOut; 958 959 /// can be: 0=hold fire, 1=return fire, 2=fire at will 960 int fireState; 961 }; //$ COMMAND_UNIT_SET_FIRE_STATE Unit_setFireState 962 963 struct SSetMoveStateUnitCommand { 964 int unitId; 965 int groupId; 966 /// see enum UnitCommandOptions 967 short options; 968 /** 969 * At which frame the command will time-out and consequently be removed, 970 * if execution of it has not yet begun. 971 * Can only be set locally, is not sent over the network, and is used 972 * for temporary orders. 973 * default: MAX_INT (-> do not time-out) 974 * example: currentFrame + 15 975 */ 976 int timeOut; 977 978 /// 0=hold pos, 1=maneuvre, 2=roam 979 int moveState; 980 }; //$ COMMAND_UNIT_SET_MOVE_STATE Unit_setMoveState 981 982 struct SSetBaseUnitCommand { 983 int unitId; 984 int groupId; 985 /// see enum UnitCommandOptions 986 short options; 987 /** 988 * At which frame the command will time-out and consequently be removed, 989 * if execution of it has not yet begun. 990 * Can only be set locally, is not sent over the network, and is used 991 * for temporary orders. 992 * default: MAX_INT (-> do not time-out) 993 * example: currentFrame + 15 994 */ 995 int timeOut; 996 997 float* basePos_posF3; 998 }; //$ COMMAND_UNIT_SET_BASE Unit_setBase 999 1000 //struct SInternalUnitCommand { 1001 // int unitId; 1002 // int groupId; 1003 // /// see enum UnitCommandOptions 1004 // short options; 1005 // int timeOut; 1006 //}; 1007 1008 struct SSelfDestroyUnitCommand { 1009 int unitId; 1010 int groupId; 1011 /// see enum UnitCommandOptions 1012 short options; 1013 /** 1014 * At which frame the command will time-out and consequently be removed, 1015 * if execution of it has not yet begun. 1016 * Can only be set locally, is not sent over the network, and is used 1017 * for temporary orders. 1018 * default: MAX_INT (-> do not time-out) 1019 * example: currentFrame + 15 1020 */ 1021 int timeOut; 1022 }; //$ COMMAND_UNIT_SELF_DESTROY Unit_selfDestruct 1023 1024 struct SSetWantedMaxSpeedUnitCommand { 1025 int unitId; 1026 int groupId; 1027 /// see enum UnitCommandOptions 1028 short options; 1029 /** 1030 * At which frame the command will time-out and consequently be removed, 1031 * if execution of it has not yet begun. 1032 * Can only be set locally, is not sent over the network, and is used 1033 * for temporary orders. 1034 * default: MAX_INT (-> do not time-out) 1035 * example: currentFrame + 15 1036 */ 1037 int timeOut; 1038 1039 float wantedMaxSpeed; 1040 }; //$ COMMAND_UNIT_SET_WANTED_MAX_SPEED Unit_setWantedMaxSpeed 1041 1042 struct SLoadUnitsUnitCommand { 1043 int unitId; 1044 int groupId; 1045 /// see enum UnitCommandOptions 1046 short options; 1047 int timeOut; // command execution-time in ?milli-seconds? 1048 1049 int* toLoadUnitIds; 1050 int toLoadUnitIds_size; 1051 }; //$ COMMAND_UNIT_LOAD_UNITS Unit_loadUnits REF:MULTI:toLoadUnitIds->Unit 1052 1053 struct SLoadUnitsAreaUnitCommand { 1054 int unitId; 1055 int groupId; 1056 /// see enum UnitCommandOptions 1057 short options; 1058 /** 1059 * At which frame the command will time-out and consequently be removed, 1060 * if execution of it has not yet begun. 1061 * Can only be set locally, is not sent over the network, and is used 1062 * for temporary orders. 1063 * default: MAX_INT (-> do not time-out) 1064 * example: currentFrame + 15 1065 */ 1066 int timeOut; 1067 1068 float* pos_posF3; 1069 float radius; 1070 }; //$ COMMAND_UNIT_LOAD_UNITS_AREA Unit_loadUnitsInArea 1071 1072 struct SLoadOntoUnitCommand { 1073 int unitId; 1074 int groupId; 1075 /// see enum UnitCommandOptions 1076 short options; 1077 /** 1078 * At which frame the command will time-out and consequently be removed, 1079 * if execution of it has not yet begun. 1080 * Can only be set locally, is not sent over the network, and is used 1081 * for temporary orders. 1082 * default: MAX_INT (-> do not time-out) 1083 * example: currentFrame + 15 1084 */ 1085 int timeOut; 1086 1087 int transporterUnitId; 1088 }; //$ COMMAND_UNIT_LOAD_ONTO Unit_loadOnto REF:transporterUnitId->Unit 1089 1090 struct SUnloadUnitCommand { 1091 int unitId; 1092 int groupId; 1093 /// see enum UnitCommandOptions 1094 short options; 1095 /** 1096 * At which frame the command will time-out and consequently be removed, 1097 * if execution of it has not yet begun. 1098 * Can only be set locally, is not sent over the network, and is used 1099 * for temporary orders. 1100 * default: MAX_INT (-> do not time-out) 1101 * example: currentFrame + 15 1102 */ 1103 int timeOut; 1104 1105 float* toPos_posF3; 1106 int toUnloadUnitId; 1107 }; //$ COMMAND_UNIT_UNLOAD_UNIT Unit_unload REF:toUnloadUnitId->Unit 1108 1109 struct SUnloadUnitsAreaUnitCommand { 1110 int unitId; 1111 int groupId; 1112 /// see enum UnitCommandOptions 1113 short options; 1114 /** 1115 * At which frame the command will time-out and consequently be removed, 1116 * if execution of it has not yet begun. 1117 * Can only be set locally, is not sent over the network, and is used 1118 * for temporary orders. 1119 * default: MAX_INT (-> do not time-out) 1120 * example: currentFrame + 15 1121 */ 1122 int timeOut; 1123 1124 float* toPos_posF3; 1125 float radius; 1126 }; //$ COMMAND_UNIT_UNLOAD_UNITS_AREA Unit_unloadUnitsInArea 1127 1128 struct SSetOnOffUnitCommand { 1129 int unitId; 1130 int groupId; 1131 /// see enum UnitCommandOptions 1132 short options; 1133 /** 1134 * At which frame the command will time-out and consequently be removed, 1135 * if execution of it has not yet begun. 1136 * Can only be set locally, is not sent over the network, and is used 1137 * for temporary orders. 1138 * default: MAX_INT (-> do not time-out) 1139 * example: currentFrame + 15 1140 */ 1141 int timeOut; 1142 1143 bool on; 1144 }; //$ COMMAND_UNIT_SET_ON_OFF Unit_setOn 1145 1146 struct SReclaimUnitUnitCommand { 1147 int unitId; 1148 int groupId; 1149 /// see enum UnitCommandOptions 1150 short options; 1151 /** 1152 * At which frame the command will time-out and consequently be removed, 1153 * if execution of it has not yet begun. 1154 * Can only be set locally, is not sent over the network, and is used 1155 * for temporary orders. 1156 * default: MAX_INT (-> do not time-out) 1157 * example: currentFrame + 15 1158 */ 1159 int timeOut; 1160 1161 int toReclaimUnitId; 1162 }; //$ COMMAND_UNIT_RECLAIM_UNIT Unit_reclaimUnit REF:toReclaimUnitId->Unit 1163 1164 struct SReclaimFeatureUnitCommand { 1165 int unitId; 1166 int groupId; 1167 /// see enum UnitCommandOptions 1168 short options; 1169 /** 1170 * At which frame the command will time-out and consequently be removed, 1171 * if execution of it has not yet begun. 1172 * Can only be set locally, is not sent over the network, and is used 1173 * for temporary orders. 1174 * default: MAX_INT (-> do not time-out) 1175 * example: currentFrame + 15 1176 */ 1177 int timeOut; 1178 1179 int toReclaimFeatureId; 1180 }; //$ COMMAND_UNIT_RECLAIM_FEATURE Unit_reclaimFeature REF:toReclaimFeatureId->Feature 1181 1182 struct SReclaimAreaUnitCommand { 1183 int unitId; 1184 int groupId; 1185 /// see enum UnitCommandOptions 1186 short options; 1187 /** 1188 * At which frame the command will time-out and consequently be removed, 1189 * if execution of it has not yet begun. 1190 * Can only be set locally, is not sent over the network, and is used 1191 * for temporary orders. 1192 * default: MAX_INT (-> do not time-out) 1193 * example: currentFrame + 15 1194 */ 1195 int timeOut; 1196 1197 float* pos_posF3; 1198 float radius; 1199 }; //$ COMMAND_UNIT_RECLAIM_AREA Unit_reclaimInArea 1200 1201 struct SCloakUnitCommand { 1202 int unitId; 1203 int groupId; 1204 /// see enum UnitCommandOptions 1205 short options; 1206 /** 1207 * At which frame the command will time-out and consequently be removed, 1208 * if execution of it has not yet begun. 1209 * Can only be set locally, is not sent over the network, and is used 1210 * for temporary orders. 1211 * default: MAX_INT (-> do not time-out) 1212 * example: currentFrame + 15 1213 */ 1214 int timeOut; 1215 1216 bool cloak; 1217 }; //$ COMMAND_UNIT_CLOAK Unit_cloak 1218 1219 struct SStockpileUnitCommand { 1220 int unitId; 1221 int groupId; 1222 /// see enum UnitCommandOptions 1223 short options; 1224 /** 1225 * At which frame the command will time-out and consequently be removed, 1226 * if execution of it has not yet begun. 1227 * Can only be set locally, is not sent over the network, and is used 1228 * for temporary orders. 1229 * default: MAX_INT (-> do not time-out) 1230 * example: currentFrame + 15 1231 */ 1232 int timeOut; 1233 }; //$ COMMAND_UNIT_STOCKPILE Unit_stockpile 1234 1235 struct SDGunUnitCommand { 1236 int unitId; 1237 int groupId; 1238 /// see enum UnitCommandOptions 1239 short options; 1240 /** 1241 * At which frame the command will time-out and consequently be removed, 1242 * if execution of it has not yet begun. 1243 * Can only be set locally, is not sent over the network, and is used 1244 * for temporary orders. 1245 * default: MAX_INT (-> do not time-out) 1246 * example: currentFrame + 15 1247 */ 1248 int timeOut; 1249 1250 int toAttackUnitId; 1251 }; //$ COMMAND_UNIT_D_GUN Unit_dGun REF:toAttackUnitId->Unit 1252 1253 struct SDGunPosUnitCommand { 1254 int unitId; 1255 int groupId; 1256 /// see enum UnitCommandOptions 1257 short options; 1258 /** 1259 * At which frame the command will time-out and consequently be removed, 1260 * if execution of it has not yet begun. 1261 * Can only be set locally, is not sent over the network, and is used 1262 * for temporary orders. 1263 * default: MAX_INT (-> do not time-out) 1264 * example: currentFrame + 15 1265 */ 1266 int timeOut; 1267 1268 float* pos_posF3; 1269 }; //$ COMMAND_UNIT_D_GUN_POS Unit_dGunPosition 1270 1271 struct SRestoreAreaUnitCommand { 1272 int unitId; 1273 int groupId; 1274 /// see enum UnitCommandOptions 1275 short options; 1276 /** 1277 * At which frame the command will time-out and consequently be removed, 1278 * if execution of it has not yet begun. 1279 * Can only be set locally, is not sent over the network, and is used 1280 * for temporary orders. 1281 * default: MAX_INT (-> do not time-out) 1282 * example: currentFrame + 15 1283 */ 1284 int timeOut; 1285 1286 float* pos_posF3; 1287 float radius; 1288 }; //$ COMMAND_UNIT_RESTORE_AREA Unit_restoreArea 1289 1290 struct SSetRepeatUnitCommand { 1291 int unitId; 1292 int groupId; 1293 /// see enum UnitCommandOptions 1294 short options; 1295 /** 1296 * At which frame the command will time-out and consequently be removed, 1297 * if execution of it has not yet begun. 1298 * Can only be set locally, is not sent over the network, and is used 1299 * for temporary orders. 1300 * default: MAX_INT (-> do not time-out) 1301 * example: currentFrame + 15 1302 */ 1303 int timeOut; 1304 1305 bool repeat; 1306 }; //$ COMMAND_UNIT_SET_REPEAT Unit_setRepeat 1307 1308 /// Tells weapons that support it to try to use a high trajectory 1309 struct SSetTrajectoryUnitCommand { 1310 int unitId; 1311 int groupId; 1312 /// see enum UnitCommandOptions 1313 short options; 1314 /** 1315 * At which frame the command will time-out and consequently be removed, 1316 * if execution of it has not yet begun. 1317 * Can only be set locally, is not sent over the network, and is used 1318 * for temporary orders. 1319 * default: MAX_INT (-> do not time-out) 1320 * example: currentFrame + 15 1321 */ 1322 int timeOut; 1323 1324 /// 0: low-trajectory, 1: high-trajectory 1325 int trajectory; 1326 }; //$ COMMAND_UNIT_SET_TRAJECTORY Unit_setTrajectory 1327 1328 struct SResurrectUnitCommand { 1329 int unitId; 1330 int groupId; 1331 /// see enum UnitCommandOptions 1332 short options; 1333 /** 1334 * At which frame the command will time-out and consequently be removed, 1335 * if execution of it has not yet begun. 1336 * Can only be set locally, is not sent over the network, and is used 1337 * for temporary orders. 1338 * default: MAX_INT (-> do not time-out) 1339 * example: currentFrame + 15 1340 */ 1341 int timeOut; 1342 1343 int toResurrectFeatureId; 1344 }; //$ COMMAND_UNIT_RESURRECT Unit_resurrect REF:toResurrectFeatureId->Feature 1345 1346 struct SResurrectAreaUnitCommand { 1347 int unitId; 1348 int groupId; 1349 /// see enum UnitCommandOptions 1350 short options; 1351 /** 1352 * At which frame the command will time-out and consequently be removed, 1353 * if execution of it has not yet begun. 1354 * Can only be set locally, is not sent over the network, and is used 1355 * for temporary orders. 1356 * default: MAX_INT (-> do not time-out) 1357 * example: currentFrame + 15 1358 */ 1359 int timeOut; 1360 1361 float* pos_posF3; 1362 float radius; 1363 }; //$ COMMAND_UNIT_RESURRECT_AREA Unit_resurrectInArea 1364 1365 struct SCaptureUnitCommand { 1366 int unitId; 1367 int groupId; 1368 /// see enum UnitCommandOptions 1369 short options; 1370 /** 1371 * At which frame the command will time-out and consequently be removed, 1372 * if execution of it has not yet begun. 1373 * Can only be set locally, is not sent over the network, and is used 1374 * for temporary orders. 1375 * default: MAX_INT (-> do not time-out) 1376 * example: currentFrame + 15 1377 */ 1378 int timeOut; 1379 1380 int toCaptureUnitId; 1381 }; //$ COMMAND_UNIT_CAPTURE Unit_capture REF:toCaptureUnitId->Unit 1382 1383 struct SCaptureAreaUnitCommand { 1384 int unitId; 1385 int groupId; 1386 /// see enum UnitCommandOptions 1387 short options; 1388 /** 1389 * At which frame the command will time-out and consequently be removed, 1390 * if execution of it has not yet begun. 1391 * Can only be set locally, is not sent over the network, and is used 1392 * for temporary orders. 1393 * default: MAX_INT (-> do not time-out) 1394 * example: currentFrame + 15 1395 */ 1396 int timeOut; 1397 1398 float* pos_posF3; 1399 float radius; 1400 }; //$ COMMAND_UNIT_CAPTURE_AREA Unit_captureInArea 1401 1402 /** 1403 * Set the percentage of health at which a unit will return to a save place. 1404 * This only works for a few units so far, mainly aircraft. 1405 */ 1406 struct SSetAutoRepairLevelUnitCommand { 1407 int unitId; 1408 int groupId; 1409 /// see enum UnitCommandOptions 1410 short options; 1411 /** 1412 * At which frame the command will time-out and consequently be removed, 1413 * if execution of it has not yet begun. 1414 * Can only be set locally, is not sent over the network, and is used 1415 * for temporary orders. 1416 * default: MAX_INT (-> do not time-out) 1417 * example: currentFrame + 15 1418 */ 1419 int timeOut; 1420 1421 /// 0: 0%, 1: 30%, 2: 50%, 3: 80% 1422 int autoRepairLevel; 1423 }; //$ COMMAND_UNIT_SET_AUTO_REPAIR_LEVEL Unit_setAutoRepairLevel 1424 1425 //struct SAttackLoopbackUnitCommand { 1426 // int unitId; 1427 // int groupId; 1428 // /// see enum UnitCommandOptions 1429 // short options; 1430 // int timeOut; 1431 //}; 1432 1433 /** 1434 * Set what a unit should do when it is idle. 1435 * This only works for a few units so far, mainly aircraft. 1436 */ 1437 struct SSetIdleModeUnitCommand { 1438 int unitId; 1439 int groupId; 1440 /// see enum UnitCommandOptions 1441 short options; 1442 /** 1443 * At which frame the command will time-out and consequently be removed, 1444 * if execution of it has not yet begun. 1445 * Can only be set locally, is not sent over the network, and is used 1446 * for temporary orders. 1447 * default: MAX_INT (-> do not time-out) 1448 * example: currentFrame + 15 1449 */ 1450 int timeOut; 1451 1452 /// 0: fly, 1: land 1453 int idleMode; 1454 }; //$ COMMAND_UNIT_SET_IDLE_MODE Unit_setIdleMode 1455 1456 struct SCustomUnitCommand { 1457 int unitId; 1458 int groupId; 1459 /// see enum UnitCommandOptions 1460 short options; 1461 /** 1462 * At which frame the command will time-out and consequently be removed, 1463 * if execution of it has not yet begun. 1464 * Can only be set locally, is not sent over the network, and is used 1465 * for temporary orders. 1466 * default: MAX_INT (-> do not time-out) 1467 * example: currentFrame + 15 1468 */ 1469 int timeOut; 1470 1471 int cmdId; 1472 float* params; 1473 int params_size; 1474 }; //$ COMMAND_UNIT_CUSTOM Unit_executeCustomCommand ARRAY:params 1475 1476 // TODO: add docu 1477 struct STraceRayCommand { 1478 float* rayPos_posF3; 1479 float* rayDir_posF3; 1480 float rayLen; // would also be ret, but we want only one ret per command 1481 int srcUnitId; 1482 int ret_hitUnitId; 1483 int flags; 1484 }; //$ COMMAND_TRACE_RAY Map_Drawer_traceRay REF:srcUnitId->Unit REF:ret_hitUnitId->Unit 1485 1486 struct SFeatureTraceRayCommand { 1487 float* rayPos_posF3; 1488 float* rayDir_posF3; 1489 float rayLen; // would also be ret, but we want only one ret per command 1490 int srcUnitId; 1491 int ret_hitFeatureId; 1492 int flags; 1493 }; //$ COMMAND_TRACE_RAY_FEATURE Map_Drawer_traceRayFeature REF:srcUnitId->Unit REF:ret_hitFeatureId->Feature 1494 1495 /** 1496 * Pause or unpauses the game. 1497 * This is meant for debugging purposes. 1498 * Keep in mind that pause does not happen immediately. 1499 * It can take 1-2 frames in single- and up to 10 frames in multiplayer matches. 1500 */ 1501 struct SPauseCommand { 1502 bool enable; 1503 /// reason for the (un-)pause, or NULL 1504 const char* reason; 1505 }; //$ COMMAND_PAUSE Game_setPause 1506 1507 1508 struct SSetPositionGraphDrawerDebugCommand { 1509 float x; 1510 float y; 1511 }; //$ COMMAND_DEBUG_DRAWER_GRAPH_SET_POS Debug_GraphDrawer_setPosition 1512 1513 struct SSetSizeGraphDrawerDebugCommand { 1514 float w; 1515 float h; 1516 }; //$ COMMAND_DEBUG_DRAWER_GRAPH_SET_SIZE Debug_GraphDrawer_setSize 1517 1518 struct SAddPointLineGraphDrawerDebugCommand { 1519 int lineId; 1520 float x; 1521 float y; 1522 }; //$ COMMAND_DEBUG_DRAWER_GRAPH_LINE_ADD_POINT Debug_GraphDrawer_GraphLine_addPoint 1523 1524 struct SDeletePointsLineGraphDrawerDebugCommand { 1525 int lineId; 1526 int numPoints; 1527 }; //$ COMMAND_DEBUG_DRAWER_GRAPH_LINE_DELETE_POINTS Debug_GraphDrawer_GraphLine_deletePoints 1528 1529 struct SSetColorLineGraphDrawerDebugCommand { 1530 int lineId; 1531 short* color_colorS3; 1532 }; //$ COMMAND_DEBUG_DRAWER_GRAPH_LINE_SET_COLOR Debug_GraphDrawer_GraphLine_setColor 1533 1534 struct SSetLabelLineGraphDrawerDebugCommand { 1535 int lineId; 1536 const char* label; 1537 }; //$ COMMAND_DEBUG_DRAWER_GRAPH_LINE_SET_LABEL Debug_GraphDrawer_GraphLine_setLabel 1538 1539 1540 struct SAddOverlayTextureDrawerDebugCommand { 1541 int ret_overlayTextureId; 1542 const float* texData; 1543 int w; 1544 int h; 1545 }; //$ COMMAND_DEBUG_DRAWER_OVERLAYTEXTURE_ADD Debug_addOverlayTexture REF:ret_textureId->OverlayTexture 1546 1547 struct SUpdateOverlayTextureDrawerDebugCommand { 1548 int overlayTextureId; 1549 const float* texData; 1550 int x; 1551 int y; 1552 int w; 1553 int h; 1554 }; //$ COMMAND_DEBUG_DRAWER_OVERLAYTEXTURE_UPDATE Debug_OverlayTexture_update 1555 1556 struct SDeleteOverlayTextureDrawerDebugCommand { 1557 int overlayTextureId; 1558 }; //$ COMMAND_DEBUG_DRAWER_OVERLAYTEXTURE_DELETE Debug_OverlayTexture_remove 1559 1560 struct SSetPositionOverlayTextureDrawerDebugCommand { 1561 int overlayTextureId; 1562 float x; 1563 float y; 1564 }; //$ COMMAND_DEBUG_DRAWER_OVERLAYTEXTURE_SET_POS Debug_OverlayTexture_setPosition 1565 1566 struct SSetSizeOverlayTextureDrawerDebugCommand { 1567 int overlayTextureId; 1568 float w; 1569 float h; 1570 }; //$ COMMAND_DEBUG_DRAWER_OVERLAYTEXTURE_SET_SIZE Debug_OverlayTexture_setSize 1571 1572 struct SSetLabelOverlayTextureDrawerDebugCommand { 1573 int overlayTextureId; 1574 const char* label; 1575 }; //$ COMMAND_DEBUG_DRAWER_OVERLAYTEXTURE_SET_LABEL Debug_OverlayTexture_setLabel 1576 1577 1578 1579 /** 1580 * @brief Sets default values 1581 */ 1582 void initSUnitCommand(void* sUnitCommand); 1583 1584 #ifdef __cplusplus 1585 } // extern "C" 1586 #endif 1587 1588 1589 #ifdef __cplusplus 1590 #ifdef BUILDING_AI 1591 namespace springLegacyAI { 1592 struct Command; 1593 } 1594 using namespace springLegacyAI; 1595 #else // BUILDING_AI 1596 struct Command; 1597 #endif // BUILDING_AI 1598 1599 // legacy support functions 1600 1601 /** 1602 * @brief Allocates memory for a C Command struct 1603 * @param maxUnits should be the value returned by unitHandler->MaxUnits() 1604 * -> max units per team for the current game 1605 */ 1606 void* mallocSUnitCommand(int unitId, int groupId, const Command* c, int* sCommandId, int maxUnits); 1607 1608 /** 1609 * @brief Frees memory of a C Command struct 1610 */ 1611 void freeSUnitCommand(void* sCommandData, int sCommandId); 1612 1613 /** 1614 * Returns the engine internal C++ unit command (topic) ID 1615 * that corresponds to the C AI Interface command topic ID specified by 1616 * <code>aiCmdTopic</code>. 1617 */ 1618 int toInternalUnitCommandTopic(int aiCmdTopic, void* sUnitCommandData); 1619 1620 /** 1621 * Returns the C AI Interface command topic ID that corresponds 1622 * to the engine internal C++ unit command (topic) ID specified by 1623 * <code>internalUnitCmdTopic</code>. 1624 * @param maxUnits should be the value returned by unitHandler->MaxUnits() 1625 * -> max units per team for the current game 1626 */ 1627 int extractAICommandTopic(const Command* internalUnitCmd, int maxUnits); 1628 1629 /** 1630 * @brief creates - with new - an engine C++ Command struct 1631 */ 1632 Command* newCommand(void* sUnitCommandData, int sCommandId, int maxUnits); 1633 1634 #endif // __cplusplus 1635 1636 1637 #endif // AI_S_COMMANDS_H 1638