1 /* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */ 2 3 #ifndef S_SKIRMISH_AI_CALLBACK_H 4 #define S_SKIRMISH_AI_CALLBACK_H 5 6 #include "aidefines.h" 7 8 #if defined(__cplusplus) 9 extern "C" { 10 #endif 11 12 13 /** 14 * @brief Skirmish AI Callback function pointers. 15 * Each Skirmish AI instance will receive an instance of this struct 16 * in its init(skirmishAIId) function and with the SInitEvent. 17 * 18 * This struct contians only activities that leave the game state as it is, 19 * in spring terms: unsynced events 20 * Activities that change game state (-> synced events) are handled through 21 * AI commands, defined in AISCommands.h. 22 * 23 * The skirmishAIId passed as the first parameter to each function in this 24 * struct has to be the ID of the AI instance using the callback. 25 */ 26 struct SSkirmishAICallback { 27 28 /** 29 * Whenever an AI wants to change the engine state in any way, 30 * it has to call this method. 31 * In other words, all commands from AIs to the engine (and other AIs) 32 * go through this method. 33 * 34 * @param skirmishAIId the ID of the AI that sends the command 35 * @param toId the team number of the AI that should receive 36 * the command, or COMMAND_TO_ID_ENGINE if it is addressed 37 * to the engine 38 * @param commandId used on asynchronous commands, this allows the AI to 39 * identify a possible result event, which would come 40 * with the same id 41 * @param commandTopic unique identifier of a command 42 * (see COMMAND_* defines in AISCommands.h) 43 * @param commandData a commandTopic specific struct, which contains 44 * the data associated with the command 45 * (see *Command structs) 46 * @return 0: if command handling ok 47 * != 0: something else otherwise 48 */ 49 int (CALLING_CONV *Engine_handleCommand)(int skirmishAIId, int toId, int commandId, int commandTopic, void* commandData); 50 51 /// Returns the major engine revision number (e.g. 83) 52 const char* (CALLING_CONV *Engine_Version_getMajor)(int skirmishAIId); 53 54 /** 55 * Minor version number (e.g. "5") 56 * @deprecated since 4. October 2011 (pre release 83), will always return "0" 57 */ 58 const char* (CALLING_CONV *Engine_Version_getMinor)(int skirmishAIId); 59 60 /** 61 * Clients that only differ in patchset can still play together. 62 * Also demos should be compatible between patchsets. 63 */ 64 const char* (CALLING_CONV *Engine_Version_getPatchset)(int skirmishAIId); 65 66 /** 67 * SCM Commits version part (e.g. "" or "13") 68 * Number of commits since the last version tag. 69 * This matches the regex "[0-9]*". 70 */ 71 const char* (CALLING_CONV *Engine_Version_getCommits)(int skirmishAIId); 72 73 /** 74 * SCM unique identifier for the current commit. 75 * This matches the regex "([0-9a-f]{6})?". 76 */ 77 const char* (CALLING_CONV *Engine_Version_getHash)(int skirmishAIId); 78 79 /** 80 * SCM branch name (e.g. "master" or "develop") 81 */ 82 const char* (CALLING_CONV *Engine_Version_getBranch)(int skirmishAIId); 83 84 /// Additional information (compiler flags, svn revision etc.) 85 const char* (CALLING_CONV *Engine_Version_getAdditional)(int skirmishAIId); 86 87 /// time of build 88 const char* (CALLING_CONV *Engine_Version_getBuildTime)(int skirmishAIId); 89 90 /// Returns whether this is a release build of the engine 91 bool (CALLING_CONV *Engine_Version_isRelease)(int skirmishAIId); 92 93 /** 94 * The basic part of a spring version. 95 * This may only be used for sync-checking if IsRelease() returns true. 96 * @return "Major.PatchSet" or "Major.PatchSet.1" 97 */ 98 const char* (CALLING_CONV *Engine_Version_getNormal)(int skirmishAIId); 99 100 /** 101 * The sync relevant part of a spring version. 102 * This may be used for sync-checking through a simple string-equality test. 103 * @return "Major" or "Major.PatchSet.1-Commits-gHash Branch" 104 */ 105 const char* (CALLING_CONV *Engine_Version_getSync)(int skirmishAIId); 106 107 /** 108 * The verbose, human readable version. 109 * @return "Major.Patchset[.1-Commits-gHash Branch] (Additional)" 110 */ 111 const char* (CALLING_CONV *Engine_Version_getFull)(int skirmishAIId); 112 113 /** Returns the number of teams in this game */ 114 int (CALLING_CONV *Teams_getSize)(int skirmishAIId); 115 116 /** Returns the number of skirmish AIs in this game */ 117 int (CALLING_CONV *SkirmishAIs_getSize)(int skirmishAIId); 118 119 /** Returns the maximum number of skirmish AIs in any game */ 120 int (CALLING_CONV *SkirmishAIs_getMax)(int skirmishAIId); 121 122 /** 123 * Returns the ID of the team controled by this Skirmish AI. 124 */ 125 int (CALLING_CONV *SkirmishAI_getTeamId)(int skirmishAIId); 126 127 /** 128 * Returns the number of info key-value pairs in the info map 129 * for this Skirmish AI. 130 */ 131 int (CALLING_CONV *SkirmishAI_Info_getSize)(int skirmishAIId); 132 133 /** 134 * Returns the key at index infoIndex in the info map 135 * for this Skirmish AI, or NULL if the infoIndex is invalid. 136 */ 137 const char* (CALLING_CONV *SkirmishAI_Info_getKey)(int skirmishAIId, int infoIndex); 138 139 /** 140 * Returns the value at index infoIndex in the info map 141 * for this Skirmish AI, or NULL if the infoIndex is invalid. 142 */ 143 const char* (CALLING_CONV *SkirmishAI_Info_getValue)(int skirmishAIId, int infoIndex); 144 145 /** 146 * Returns the description of the key at index infoIndex in the info map 147 * for this Skirmish AI, or NULL if the infoIndex is invalid. 148 */ 149 const char* (CALLING_CONV *SkirmishAI_Info_getDescription)(int skirmishAIId, int infoIndex); 150 151 /** 152 * Returns the value associated with the given key in the info map 153 * for this Skirmish AI, or NULL if not found. 154 */ 155 const char* (CALLING_CONV *SkirmishAI_Info_getValueByKey)(int skirmishAIId, const char* const key); 156 157 /** 158 * Returns the number of option key-value pairs in the options map 159 * for this Skirmish AI. 160 */ 161 int (CALLING_CONV *SkirmishAI_OptionValues_getSize)(int skirmishAIId); 162 163 /** 164 * Returns the key at index optionIndex in the options map 165 * for this Skirmish AI, or NULL if the optionIndex is invalid. 166 */ 167 const char* (CALLING_CONV *SkirmishAI_OptionValues_getKey)(int skirmishAIId, int optionIndex); 168 169 /** 170 * Returns the value at index optionIndex in the options map 171 * for this Skirmish AI, or NULL if the optionIndex is invalid. 172 */ 173 const char* (CALLING_CONV *SkirmishAI_OptionValues_getValue)(int skirmishAIId, int optionIndex); 174 175 /** 176 * Returns the value associated with the given key in the options map 177 * for this Skirmish AI, or NULL if not found. 178 */ 179 const char* (CALLING_CONV *SkirmishAI_OptionValues_getValueByKey)(int skirmishAIId, const char* const key); 180 181 /** This will end up in infolog */ 182 void (CALLING_CONV *Log_log)(int skirmishAIId, const char* const msg); 183 184 /** 185 * Inform the engine of an error that happend in the interface. 186 * @param msg error message 187 * @param severety from 10 for minor to 0 for fatal 188 * @param die if this is set to true, the engine assumes 189 * the interface is in an irreparable state, and it will 190 * unload it immediately. 191 */ 192 void (CALLING_CONV *Log_exception)(int skirmishAIId, const char* const msg, int severety, bool die); 193 194 /** Returns '/' on posix and '\\' on windows */ 195 char (CALLING_CONV *DataDirs_getPathSeparator)(int skirmishAIId); 196 197 /** 198 * This interfaces main data dir, which is where the shared library 199 * and the InterfaceInfo.lua file are located, e.g.: 200 * /usr/share/games/spring/AI/Skirmish/RAI/0.601/ 201 */ 202 const char* (CALLING_CONV *DataDirs_getConfigDir)(int skirmishAIId); 203 204 /** 205 * This interfaces writable data dir, which is where eg logs, caches 206 * and learning data should be stored, e.g.: 207 * /home/userX/.spring/AI/Skirmish/RAI/0.601/ 208 */ 209 const char* (CALLING_CONV *DataDirs_getWriteableDir)(int skirmishAIId); 210 211 /** 212 * Returns an absolute path which consists of: 213 * data-dir + Skirmish-AI-path + relative-path. 214 * 215 * example: 216 * input: "log/main.log", writeable, create, !dir, !common 217 * output: "/home/userX/.spring/AI/Skirmish/RAI/0.601/log/main.log" 218 * The path "/home/userX/.spring/AI/Skirmish/RAI/0.601/log/" is created, 219 * if it does not yet exist. 220 * 221 * @see DataDirs_Roots_locatePath 222 * @param path store for the resulting absolute path 223 * @param path_sizeMax storage size of the above 224 * @param writeable if true, only the writable data-dir is considered 225 * @param create if true, and realPath is not found, its dir structure 226 * is created recursively under the writable data-dir 227 * @param dir if true, realPath specifies a dir, which means if 228 * create is true, the whole path will be created, 229 * including the last part 230 * @param common if true, the version independent data-dir is formed, 231 * which uses "common" instead of the version, eg: 232 * "/home/userX/.spring/AI/Skirmish/RAI/common/..." 233 * @return whether the locating process was successfull 234 * -> the path exists and is stored in an absolute form in path 235 */ 236 bool (CALLING_CONV *DataDirs_locatePath)(int skirmishAIId, char* path, int path_sizeMax, const char* const relPath, bool writeable, bool create, bool dir, bool common); 237 238 /** 239 * @see locatePath() 240 */ 241 char* (CALLING_CONV *DataDirs_allocatePath)(int skirmishAIId, const char* const relPath, bool writeable, bool create, bool dir, bool common); 242 243 /** Returns the number of springs data dirs. */ 244 int (CALLING_CONV *DataDirs_Roots_getSize)(int skirmishAIId); 245 246 /** Returns the data dir at dirIndex, which is valid between 0 and (DataDirs_Roots_getSize() - 1). */ 247 bool (CALLING_CONV *DataDirs_Roots_getDir)(int skirmishAIId, char* path, int path_sizeMax, int dirIndex); 248 249 /** 250 * Returns an absolute path which consists of: 251 * data-dir + relative-path. 252 * 253 * example: 254 * input: "AI/Skirmish", writeable, create, dir 255 * output: "/home/userX/.spring/AI/Skirmish/" 256 * The path "/home/userX/.spring/AI/Skirmish/" is created, 257 * if it does not yet exist. 258 * 259 * @see DataDirs_locatePath 260 * @param path store for the resulting absolute path 261 * @param path_sizeMax storage size of the above 262 * @param relPath the relative path to find 263 * @param writeable if true, only the writable data-dir is considered 264 * @param create if true, and realPath is not found, its dir structure 265 * is created recursively under the writable data-dir 266 * @param dir if true, realPath specifies a dir, which means if 267 * create is true, the whole path will be created, 268 * including the last part 269 * @return whether the locating process was successfull 270 * -> the path exists and is stored in an absolute form in path 271 */ 272 bool (CALLING_CONV *DataDirs_Roots_locatePath)(int skirmishAIId, char* path, int path_sizeMax, const char* const relPath, bool writeable, bool create, bool dir); 273 274 char* (CALLING_CONV *DataDirs_Roots_allocatePath)(int skirmishAIId, const char* const relPath, bool writeable, bool create, bool dir); 275 276 // BEGINN misc callback functions 277 /** 278 * Returns the current game time measured in frames (the 279 * simulation runs at 30 frames per second at normal speed) 280 * 281 * This should not be used, as we get the frame from the SUpdateEvent. 282 * @deprecated 283 */ 284 int (CALLING_CONV *Game_getCurrentFrame)(int skirmishAIId); 285 286 int (CALLING_CONV *Game_getAiInterfaceVersion)(int skirmishAIId); 287 288 int (CALLING_CONV *Game_getMyTeam)(int skirmishAIId); 289 290 int (CALLING_CONV *Game_getMyAllyTeam)(int skirmishAIId); 291 292 int (CALLING_CONV *Game_getPlayerTeam)(int skirmishAIId, int playerId); 293 294 /** 295 * Returns the number of active teams participating 296 * in the currently running game. 297 * A return value of 6 for example, would mean that teams 0 till 5 298 * take part in the game. 299 */ 300 int (CALLING_CONV *Game_getTeams)(int skirmishAIId); 301 302 /** 303 * Returns the name of the side of a team in the game. 304 * 305 * This should not be used, as it may be "", 306 * and as the AI should rather rely on the units it has, 307 * which will lead to a more stable and versatile AI. 308 * @deprecated 309 * 310 * @return eg. "ARM" or "CORE"; may be "", depending on how the game was setup 311 */ 312 const char* (CALLING_CONV *Game_getTeamSide)(int skirmishAIId, int otherTeamId); 313 314 /** 315 * Returns the color of a team in the game. 316 * 317 * This should only be used when drawing stuff, 318 * and not for team-identification. 319 * @return the RGB color of a team, with values in [0, 255] 320 */ 321 void (CALLING_CONV *Game_getTeamColor)(int skirmishAIId, int otherTeamId, short* return_colorS3_out); 322 323 /** 324 * Returns the income multiplier of a team in the game. 325 * All the teams resource income is multiplied by this factor. 326 * The default value is 1.0f, the valid range is [0.0, FLOAT_MAX]. 327 */ 328 float (CALLING_CONV *Game_getTeamIncomeMultiplier)(int skirmishAIId, int otherTeamId); 329 330 /// Returns the ally-team of a team 331 int (CALLING_CONV *Game_getTeamAllyTeam)(int skirmishAIId, int otherTeamId); 332 333 /** 334 * Returns the current level of a resource of another team. 335 * Allways works for allied teams. 336 * Works for all teams when cheating is enabled. 337 * @return current level of the requested resource of the other team, or -1.0 on an invalid request 338 */ 339 float (CALLING_CONV *Game_getTeamResourceCurrent)(int skirmishAIId, int otherTeamId, int resourceId); 340 341 /** 342 * Returns the current income of a resource of another team. 343 * Allways works for allied teams. 344 * Works for all teams when cheating is enabled. 345 * @return current income of the requested resource of the other team, or -1.0 on an invalid request 346 */ 347 float (CALLING_CONV *Game_getTeamResourceIncome)(int skirmishAIId, int otherTeamId, int resourceId); 348 349 /** 350 * Returns the current usage of a resource of another team. 351 * Allways works for allied teams. 352 * Works for all teams when cheating is enabled. 353 * @return current usage of the requested resource of the other team, or -1.0 on an invalid request 354 */ 355 float (CALLING_CONV *Game_getTeamResourceUsage)(int skirmishAIId, int otherTeamId, int resourceId); 356 357 /** 358 * Returns the storage capacity for a resource of another team. 359 * Allways works for allied teams. 360 * Works for all teams when cheating is enabled. 361 * @return storage capacity for the requested resource of the other team, or -1.0 on an invalid request 362 */ 363 float (CALLING_CONV *Game_getTeamResourceStorage)(int skirmishAIId, int otherTeamId, int resourceId); 364 365 /// Returns true, if the two supplied ally-teams are currently allied 366 bool (CALLING_CONV *Game_isAllied)(int skirmishAIId, int firstAllyTeamId, int secondAllyTeamId); 367 368 bool (CALLING_CONV *Game_isExceptionHandlingEnabled)(int skirmishAIId); 369 370 bool (CALLING_CONV *Game_isDebugModeEnabled)(int skirmishAIId); 371 372 int (CALLING_CONV *Game_getMode)(int skirmishAIId); 373 374 bool (CALLING_CONV *Game_isPaused)(int skirmishAIId); 375 376 float (CALLING_CONV *Game_getSpeedFactor)(int skirmishAIId); 377 378 const char* (CALLING_CONV *Game_getSetupScript)(int skirmishAIId); 379 380 /** 381 * Returns the categories bit field value. 382 * @return the categories bit field value or 0, 383 * in case of empty name or too many categories 384 * @see getCategoryName 385 */ 386 int (CALLING_CONV *Game_getCategoryFlag)(int skirmishAIId, const char* categoryName); 387 388 /** 389 * Returns the bitfield values of a list of category names. 390 * @param categoryNames space delimited list of names 391 * @see Game#getCategoryFlag 392 */ 393 int (CALLING_CONV *Game_getCategoriesFlag)(int skirmishAIId, const char* categoryNames); 394 395 /** 396 * Return the name of the category described by a category flag. 397 * @see Game#getCategoryFlag 398 */ 399 void (CALLING_CONV *Game_getCategoryName)(int skirmishAIId, int categoryFlag, char* name, int name_sizeMax); 400 401 /** 402 * This is a set of parameters that is created by SetGameRulesParam() and may change during the game. 403 * Each parameter is uniquely identified only by its id (which is the index in the vector). 404 * Parameters may or may not have a name. 405 * @return visible to skirmishAIId parameters. 406 * If cheats are enabled, this will return all parameters. 407 */ 408 int (CALLING_CONV *Game_getGameRulesParams)(int skirmishAIId, int* paramIds, int paramIds_sizeMax); //$ FETCHER:MULTI:IDs:GameRulesParam:paramIds 409 410 /** 411 * @return only visible to skirmishAIId parameter. 412 * If cheats are enabled, this will return parameter despite it's losStatus. 413 */ 414 int (CALLING_CONV *Game_getGameRulesParamByName)(int skirmishAIId, const char* rulesParamName); //$ REF:RETURN->GameRulesParam 415 416 /** 417 * @return only visible to skirmishAIId parameter. 418 * If cheats are enabled, this will return parameter despite it's losStatus. 419 */ 420 int (CALLING_CONV *Game_getGameRulesParamById)(int skirmishAIId, int rulesParamId); //$ REF:RETURN->GameRulesParam 421 422 /** 423 * Not every mod parameter has a name. 424 */ 425 const char* (CALLING_CONV *GameRulesParam_getName)(int skirmishAIId, int gameRulesParamId); 426 427 /** 428 * @return float value of parameter if it's set, 0.0 otherwise. 429 */ 430 float (CALLING_CONV *GameRulesParam_getValueFloat)(int skirmishAIId, int gameRulesParamId); 431 432 /** 433 * @return string value of parameter if it's set, empty string otherwise. 434 */ 435 const char* (CALLING_CONV *GameRulesParam_getValueString)(int skirmishAIId, int gameRulesParamId); 436 437 // END misc callback functions 438 439 440 // BEGINN Visualization related callback functions 441 float (CALLING_CONV *Gui_getViewRange)(int skirmishAIId); 442 443 float (CALLING_CONV *Gui_getScreenX)(int skirmishAIId); 444 445 float (CALLING_CONV *Gui_getScreenY)(int skirmishAIId); 446 447 void (CALLING_CONV *Gui_Camera_getDirection)(int skirmishAIId, float* return_posF3_out); 448 449 void (CALLING_CONV *Gui_Camera_getPosition)(int skirmishAIId, float* return_posF3_out); 450 451 // END Visualization related callback functions 452 453 454 // BEGINN kind of deprecated; it is recommended not to use these 455 // bool (CALLING_CONV *getProperty)(int skirmishAIId, int id, int property, void* dst); 456 457 // bool (CALLING_CONV *getValue)(int skirmishAIId, int id, void* dst); 458 459 // END kind of deprecated; it is recommended not to use these 460 461 462 // BEGINN OBJECT Cheats 463 /** 464 * Returns whether this AI may use active cheats. 465 */ 466 bool (CALLING_CONV *Cheats_isEnabled)(int skirmishAIId); 467 468 /** 469 * Set whether this AI may use active cheats. 470 */ 471 bool (CALLING_CONV *Cheats_setEnabled)(int skirmishAIId, bool enable); 472 473 /** 474 * Set whether this AI may receive cheat events. 475 * When enabled, you would for example get informed when enemy units are 476 * created, even without sensor coverage. 477 */ 478 bool (CALLING_CONV *Cheats_setEventsEnabled)(int skirmishAIId, bool enabled); 479 480 /** 481 * Returns whether cheats will desync if used by an AI. 482 * @return always true, unless we are both the host and the only client. 483 */ 484 bool (CALLING_CONV *Cheats_isOnlyPassive)(int skirmishAIId); 485 486 // END OBJECT Cheats 487 488 489 // BEGINN OBJECT Resource 490 int (CALLING_CONV *getResources)(int skirmishAIId); //$ FETCHER:MULTI:NUM:Resource 491 492 int (CALLING_CONV *getResourceByName)(int skirmishAIId, const char* resourceName); //$ REF:RETURN->Resource 493 494 const char* (CALLING_CONV *Resource_getName)(int skirmishAIId, int resourceId); 495 496 float (CALLING_CONV *Resource_getOptimum)(int skirmishAIId, int resourceId); 497 498 float (CALLING_CONV *Economy_getCurrent)(int skirmishAIId, int resourceId); //$ REF:resourceId->Resource 499 500 float (CALLING_CONV *Economy_getIncome)(int skirmishAIId, int resourceId); //$ REF:resourceId->Resource 501 502 float (CALLING_CONV *Economy_getUsage)(int skirmishAIId, int resourceId); //$ REF:resourceId->Resource 503 504 float (CALLING_CONV *Economy_getStorage)(int skirmishAIId, int resourceId); //$ REF:resourceId->Resource 505 506 // END OBJECT Resource 507 508 509 // BEGINN OBJECT File 510 /** Return -1 when the file does not exist */ 511 int (CALLING_CONV *File_getSize)(int skirmishAIId, const char* fileName); 512 513 /** Returns false when file does not exist, or the buffer is too small */ 514 bool (CALLING_CONV *File_getContent)(int skirmishAIId, const char* fileName, void* buffer, int bufferLen); 515 516 // bool (CALLING_CONV *File_locateForReading)(int skirmishAIId, char* fileName, int fileName_sizeMax); 517 518 // bool (CALLING_CONV *File_locateForWriting)(int skirmishAIId, char* fileName, int fileName_sizeMax); 519 520 // END OBJECT File 521 522 523 // BEGINN OBJECT UnitDef 524 /** 525 * A UnitDef contains all properties of a unit that are specific to its type, 526 * for example the number and type of weapons or max-speed. 527 * These properties are usually fixed, and not meant to change during a game. 528 * The unitId is a unique id for this type of unit. 529 */ 530 int (CALLING_CONV *getUnitDefs)(int skirmishAIId, int* unitDefIds, int unitDefIds_sizeMax); //$ FETCHER:MULTI:IDs:UnitDef:unitDefIds 531 532 int (CALLING_CONV *getUnitDefByName)(int skirmishAIId, const char* unitName); //$ REF:RETURN->UnitDef 533 534 // int (CALLING_CONV *UnitDef_getId)(int skirmishAIId, int unitDefId); 535 536 /** Forces loading of the unit model */ 537 float (CALLING_CONV *UnitDef_getHeight)(int skirmishAIId, int unitDefId); 538 539 /** Forces loading of the unit model */ 540 float (CALLING_CONV *UnitDef_getRadius)(int skirmishAIId, int unitDefId); 541 542 const char* (CALLING_CONV *UnitDef_getName)(int skirmishAIId, int unitDefId); 543 544 const char* (CALLING_CONV *UnitDef_getHumanName)(int skirmishAIId, int unitDefId); 545 546 const char* (CALLING_CONV *UnitDef_getFileName)(int skirmishAIId, int unitDefId); 547 548 /** @deprecated */ 549 int (CALLING_CONV *UnitDef_getAiHint)(int skirmishAIId, int unitDefId); 550 551 int (CALLING_CONV *UnitDef_getCobId)(int skirmishAIId, int unitDefId); 552 553 int (CALLING_CONV *UnitDef_getTechLevel)(int skirmishAIId, int unitDefId); 554 555 /** @deprecated */ 556 const char* (CALLING_CONV *UnitDef_getGaia)(int skirmishAIId, int unitDefId); 557 558 float (CALLING_CONV *UnitDef_getUpkeep)(int skirmishAIId, int unitDefId, int resourceId); //$ REF:resourceId->Resource 559 560 /** This amount of the resource will always be created. */ 561 float (CALLING_CONV *UnitDef_getResourceMake)(int skirmishAIId, int unitDefId, int resourceId); //$ REF:resourceId->Resource 562 563 /** 564 * This amount of the resource will be created when the unit is on and enough 565 * energy can be drained. 566 */ 567 float (CALLING_CONV *UnitDef_getMakesResource)(int skirmishAIId, int unitDefId, int resourceId); //$ REF:resourceId->Resource 568 569 float (CALLING_CONV *UnitDef_getCost)(int skirmishAIId, int unitDefId, int resourceId); //$ REF:resourceId->Resource 570 571 float (CALLING_CONV *UnitDef_getExtractsResource)(int skirmishAIId, int unitDefId, int resourceId); //$ REF:resourceId->Resource 572 573 float (CALLING_CONV *UnitDef_getResourceExtractorRange)(int skirmishAIId, int unitDefId, int resourceId); //$ REF:resourceId->Resource 574 575 float (CALLING_CONV *UnitDef_getWindResourceGenerator)(int skirmishAIId, int unitDefId, int resourceId); //$ REF:resourceId->Resource 576 577 float (CALLING_CONV *UnitDef_getTidalResourceGenerator)(int skirmishAIId, int unitDefId, int resourceId); //$ REF:resourceId->Resource 578 579 float (CALLING_CONV *UnitDef_getStorage)(int skirmishAIId, int unitDefId, int resourceId); //$ REF:resourceId->Resource 580 581 bool (CALLING_CONV *UnitDef_isSquareResourceExtractor)(int skirmishAIId, int unitDefId, int resourceId); //$ REF:resourceId->Resource 582 583 float (CALLING_CONV *UnitDef_getBuildTime)(int skirmishAIId, int unitDefId); 584 585 /** This amount of auto-heal will always be applied. */ 586 float (CALLING_CONV *UnitDef_getAutoHeal)(int skirmishAIId, int unitDefId); 587 588 /** This amount of auto-heal will only be applied while the unit is idling. */ 589 float (CALLING_CONV *UnitDef_getIdleAutoHeal)(int skirmishAIId, int unitDefId); 590 591 /** Time a unit needs to idle before it is considered idling. */ 592 int (CALLING_CONV *UnitDef_getIdleTime)(int skirmishAIId, int unitDefId); 593 594 float (CALLING_CONV *UnitDef_getPower)(int skirmishAIId, int unitDefId); 595 596 float (CALLING_CONV *UnitDef_getHealth)(int skirmishAIId, int unitDefId); 597 598 /** 599 * Returns the bit field value denoting the categories this unit is in. 600 * @see Game#getCategoryFlag 601 * @see Game#getCategoryName 602 */ 603 int (CALLING_CONV *UnitDef_getCategory)(int skirmishAIId, int unitDefId); 604 605 float (CALLING_CONV *UnitDef_getSpeed)(int skirmishAIId, int unitDefId); 606 607 float (CALLING_CONV *UnitDef_getTurnRate)(int skirmishAIId, int unitDefId); 608 609 bool (CALLING_CONV *UnitDef_isTurnInPlace)(int skirmishAIId, int unitDefId); 610 611 /** 612 * Units above this distance to goal will try to turn while keeping 613 * some of their speed. 614 * 0 to disable 615 */ 616 float (CALLING_CONV *UnitDef_getTurnInPlaceDistance)(int skirmishAIId, int unitDefId); 617 618 /** 619 * Units below this speed will turn in place regardless of their 620 * turnInPlace setting. 621 */ 622 float (CALLING_CONV *UnitDef_getTurnInPlaceSpeedLimit)(int skirmishAIId, int unitDefId); 623 624 bool (CALLING_CONV *UnitDef_isUpright)(int skirmishAIId, int unitDefId); 625 626 bool (CALLING_CONV *UnitDef_isCollide)(int skirmishAIId, int unitDefId); 627 628 float (CALLING_CONV *UnitDef_getLosRadius)(int skirmishAIId, int unitDefId); 629 630 float (CALLING_CONV *UnitDef_getAirLosRadius)(int skirmishAIId, int unitDefId); 631 632 float (CALLING_CONV *UnitDef_getLosHeight)(int skirmishAIId, int unitDefId); 633 634 int (CALLING_CONV *UnitDef_getRadarRadius)(int skirmishAIId, int unitDefId); 635 636 int (CALLING_CONV *UnitDef_getSonarRadius)(int skirmishAIId, int unitDefId); 637 638 int (CALLING_CONV *UnitDef_getJammerRadius)(int skirmishAIId, int unitDefId); 639 640 int (CALLING_CONV *UnitDef_getSonarJamRadius)(int skirmishAIId, int unitDefId); 641 642 int (CALLING_CONV *UnitDef_getSeismicRadius)(int skirmishAIId, int unitDefId); 643 644 float (CALLING_CONV *UnitDef_getSeismicSignature)(int skirmishAIId, int unitDefId); 645 646 bool (CALLING_CONV *UnitDef_isStealth)(int skirmishAIId, int unitDefId); 647 648 bool (CALLING_CONV *UnitDef_isSonarStealth)(int skirmishAIId, int unitDefId); 649 650 bool (CALLING_CONV *UnitDef_isBuildRange3D)(int skirmishAIId, int unitDefId); 651 652 float (CALLING_CONV *UnitDef_getBuildDistance)(int skirmishAIId, int unitDefId); 653 654 float (CALLING_CONV *UnitDef_getBuildSpeed)(int skirmishAIId, int unitDefId); 655 656 float (CALLING_CONV *UnitDef_getReclaimSpeed)(int skirmishAIId, int unitDefId); 657 658 float (CALLING_CONV *UnitDef_getRepairSpeed)(int skirmishAIId, int unitDefId); 659 660 float (CALLING_CONV *UnitDef_getMaxRepairSpeed)(int skirmishAIId, int unitDefId); 661 662 float (CALLING_CONV *UnitDef_getResurrectSpeed)(int skirmishAIId, int unitDefId); 663 664 float (CALLING_CONV *UnitDef_getCaptureSpeed)(int skirmishAIId, int unitDefId); 665 666 float (CALLING_CONV *UnitDef_getTerraformSpeed)(int skirmishAIId, int unitDefId); 667 668 float (CALLING_CONV *UnitDef_getMass)(int skirmishAIId, int unitDefId); 669 670 bool (CALLING_CONV *UnitDef_isPushResistant)(int skirmishAIId, int unitDefId); 671 672 /** Should the unit move sideways when it can not shoot? */ 673 bool (CALLING_CONV *UnitDef_isStrafeToAttack)(int skirmishAIId, int unitDefId); 674 675 float (CALLING_CONV *UnitDef_getMinCollisionSpeed)(int skirmishAIId, int unitDefId); 676 677 float (CALLING_CONV *UnitDef_getSlideTolerance)(int skirmishAIId, int unitDefId); 678 679 /** 680 * Build location relevant maximum steepness of the underlaying terrain. 681 * Used to calculate the maxHeightDif. 682 */ 683 float (CALLING_CONV *UnitDef_getMaxSlope)(int skirmishAIId, int unitDefId); 684 685 /** 686 * Maximum terra-form height this building allows. 687 * If this value is 0.0, you can only build this structure on 688 * totally flat terrain. 689 */ 690 float (CALLING_CONV *UnitDef_getMaxHeightDif)(int skirmishAIId, int unitDefId); 691 692 float (CALLING_CONV *UnitDef_getMinWaterDepth)(int skirmishAIId, int unitDefId); 693 694 float (CALLING_CONV *UnitDef_getWaterline)(int skirmishAIId, int unitDefId); 695 696 float (CALLING_CONV *UnitDef_getMaxWaterDepth)(int skirmishAIId, int unitDefId); 697 698 float (CALLING_CONV *UnitDef_getArmoredMultiple)(int skirmishAIId, int unitDefId); 699 700 int (CALLING_CONV *UnitDef_getArmorType)(int skirmishAIId, int unitDefId); 701 702 /** 703 * The flanking bonus indicates how much additional damage you can inflict to 704 * a unit, if it gets attacked from different directions. 705 * See the spring source code if you want to know it more precisely. 706 * 707 * @return 0: no flanking bonus 708 * 1: global coords, mobile 709 * 2: unit coords, mobile 710 * 3: unit coords, locked 711 */ 712 int (CALLING_CONV *UnitDef_FlankingBonus_getMode)(int skirmishAIId, int unitDefId); 713 714 /** 715 * The unit takes less damage when attacked from this direction. 716 * This encourage flanking fire. 717 */ 718 void (CALLING_CONV *UnitDef_FlankingBonus_getDir)(int skirmishAIId, int unitDefId, float* return_posF3_out); 719 720 /** Damage factor for the least protected direction */ 721 float (CALLING_CONV *UnitDef_FlankingBonus_getMax)(int skirmishAIId, int unitDefId); 722 723 /** Damage factor for the most protected direction */ 724 float (CALLING_CONV *UnitDef_FlankingBonus_getMin)(int skirmishAIId, int unitDefId); 725 726 /** 727 * How much the ability of the flanking bonus direction to move builds up each 728 * frame. 729 */ 730 float (CALLING_CONV *UnitDef_FlankingBonus_getMobilityAdd)(int skirmishAIId, int unitDefId); 731 732 float (CALLING_CONV *UnitDef_getMaxWeaponRange)(int skirmishAIId, int unitDefId); 733 734 /** @deprecated */ 735 const char* (CALLING_CONV *UnitDef_getType)(int skirmishAIId, int unitDefId); 736 737 const char* (CALLING_CONV *UnitDef_getTooltip)(int skirmishAIId, int unitDefId); 738 739 const char* (CALLING_CONV *UnitDef_getWreckName)(int skirmishAIId, int unitDefId); 740 741 const char* (CALLING_CONV *UnitDef_getDeathExplosion)(int skirmishAIId, int unitDefId); 742 743 const char* (CALLING_CONV *UnitDef_getSelfDExplosion)(int skirmishAIId, int unitDefId); 744 745 /** 746 * Returns the name of the category this unit is in. 747 * @see Game#getCategoryFlag 748 * @see Game#getCategoryName 749 */ 750 const char* (CALLING_CONV *UnitDef_getCategoryString)(int skirmishAIId, int unitDefId); 751 752 bool (CALLING_CONV *UnitDef_isAbleToSelfD)(int skirmishAIId, int unitDefId); 753 754 int (CALLING_CONV *UnitDef_getSelfDCountdown)(int skirmishAIId, int unitDefId); 755 756 bool (CALLING_CONV *UnitDef_isAbleToSubmerge)(int skirmishAIId, int unitDefId); 757 758 bool (CALLING_CONV *UnitDef_isAbleToFly)(int skirmishAIId, int unitDefId); 759 760 bool (CALLING_CONV *UnitDef_isAbleToMove)(int skirmishAIId, int unitDefId); 761 762 bool (CALLING_CONV *UnitDef_isAbleToHover)(int skirmishAIId, int unitDefId); 763 764 bool (CALLING_CONV *UnitDef_isFloater)(int skirmishAIId, int unitDefId); 765 766 bool (CALLING_CONV *UnitDef_isBuilder)(int skirmishAIId, int unitDefId); 767 768 bool (CALLING_CONV *UnitDef_isActivateWhenBuilt)(int skirmishAIId, int unitDefId); 769 770 bool (CALLING_CONV *UnitDef_isOnOffable)(int skirmishAIId, int unitDefId); 771 772 bool (CALLING_CONV *UnitDef_isFullHealthFactory)(int skirmishAIId, int unitDefId); 773 774 bool (CALLING_CONV *UnitDef_isFactoryHeadingTakeoff)(int skirmishAIId, int unitDefId); 775 776 bool (CALLING_CONV *UnitDef_isReclaimable)(int skirmishAIId, int unitDefId); 777 778 bool (CALLING_CONV *UnitDef_isCapturable)(int skirmishAIId, int unitDefId); 779 780 bool (CALLING_CONV *UnitDef_isAbleToRestore)(int skirmishAIId, int unitDefId); 781 782 bool (CALLING_CONV *UnitDef_isAbleToRepair)(int skirmishAIId, int unitDefId); 783 784 bool (CALLING_CONV *UnitDef_isAbleToSelfRepair)(int skirmishAIId, int unitDefId); 785 786 bool (CALLING_CONV *UnitDef_isAbleToReclaim)(int skirmishAIId, int unitDefId); 787 788 bool (CALLING_CONV *UnitDef_isAbleToAttack)(int skirmishAIId, int unitDefId); 789 790 bool (CALLING_CONV *UnitDef_isAbleToPatrol)(int skirmishAIId, int unitDefId); 791 792 bool (CALLING_CONV *UnitDef_isAbleToFight)(int skirmishAIId, int unitDefId); 793 794 bool (CALLING_CONV *UnitDef_isAbleToGuard)(int skirmishAIId, int unitDefId); 795 796 bool (CALLING_CONV *UnitDef_isAbleToAssist)(int skirmishAIId, int unitDefId); 797 798 bool (CALLING_CONV *UnitDef_isAssistable)(int skirmishAIId, int unitDefId); 799 800 bool (CALLING_CONV *UnitDef_isAbleToRepeat)(int skirmishAIId, int unitDefId); 801 802 bool (CALLING_CONV *UnitDef_isAbleToFireControl)(int skirmishAIId, int unitDefId); 803 804 int (CALLING_CONV *UnitDef_getFireState)(int skirmishAIId, int unitDefId); 805 806 int (CALLING_CONV *UnitDef_getMoveState)(int skirmishAIId, int unitDefId); 807 808 // beginn: aircraft stuff 809 float (CALLING_CONV *UnitDef_getWingDrag)(int skirmishAIId, int unitDefId); 810 811 float (CALLING_CONV *UnitDef_getWingAngle)(int skirmishAIId, int unitDefId); 812 813 float (CALLING_CONV *UnitDef_getDrag)(int skirmishAIId, int unitDefId); 814 815 float (CALLING_CONV *UnitDef_getFrontToSpeed)(int skirmishAIId, int unitDefId); 816 817 float (CALLING_CONV *UnitDef_getSpeedToFront)(int skirmishAIId, int unitDefId); 818 819 float (CALLING_CONV *UnitDef_getMyGravity)(int skirmishAIId, int unitDefId); 820 821 float (CALLING_CONV *UnitDef_getMaxBank)(int skirmishAIId, int unitDefId); 822 823 float (CALLING_CONV *UnitDef_getMaxPitch)(int skirmishAIId, int unitDefId); 824 825 float (CALLING_CONV *UnitDef_getTurnRadius)(int skirmishAIId, int unitDefId); 826 827 float (CALLING_CONV *UnitDef_getWantedHeight)(int skirmishAIId, int unitDefId); 828 829 float (CALLING_CONV *UnitDef_getVerticalSpeed)(int skirmishAIId, int unitDefId); 830 831 /** 832 * @deprecated 833 */ 834 bool (CALLING_CONV *UnitDef_isAbleToCrash)(int skirmishAIId, int unitDefId); 835 836 /** 837 * @deprecated 838 */ 839 bool (CALLING_CONV *UnitDef_isHoverAttack)(int skirmishAIId, int unitDefId); 840 841 bool (CALLING_CONV *UnitDef_isAirStrafe)(int skirmishAIId, int unitDefId); 842 843 /** 844 * @return < 0: it can land 845 * >= 0: how much the unit will move during hovering on the spot 846 */ 847 float (CALLING_CONV *UnitDef_getDlHoverFactor)(int skirmishAIId, int unitDefId); 848 849 float (CALLING_CONV *UnitDef_getMaxAcceleration)(int skirmishAIId, int unitDefId); 850 851 float (CALLING_CONV *UnitDef_getMaxDeceleration)(int skirmishAIId, int unitDefId); 852 853 float (CALLING_CONV *UnitDef_getMaxAileron)(int skirmishAIId, int unitDefId); 854 855 float (CALLING_CONV *UnitDef_getMaxElevator)(int skirmishAIId, int unitDefId); 856 857 float (CALLING_CONV *UnitDef_getMaxRudder)(int skirmishAIId, int unitDefId); 858 859 // end: aircraft stuff 860 /** 861 * The yard map defines which parts of the square a unit occupies 862 * can still be walked on by other units. 863 * Example: 864 * In the BA Arm T2 K-Bot lab, htere is a line in hte middle where units 865 * walk, otherwise they would not be able ot exit the lab once they are 866 * built. 867 * @return 0 if invalid facing or the unit has no yard-map defined, 868 * the size of the yard-map otherwise: getXSize() * getXSize() 869 */ 870 int (CALLING_CONV *UnitDef_getYardMap)(int skirmishAIId, int unitDefId, int facing, short* yardMap, int yardMap_sizeMax); //$ ARRAY:yardMap 871 872 int (CALLING_CONV *UnitDef_getXSize)(int skirmishAIId, int unitDefId); 873 874 int (CALLING_CONV *UnitDef_getZSize)(int skirmishAIId, int unitDefId); 875 876 /** @deprecated */ 877 int (CALLING_CONV *UnitDef_getBuildAngle)(int skirmishAIId, int unitDefId); 878 879 // beginn: transports stuff 880 float (CALLING_CONV *UnitDef_getLoadingRadius)(int skirmishAIId, int unitDefId); 881 882 float (CALLING_CONV *UnitDef_getUnloadSpread)(int skirmishAIId, int unitDefId); 883 884 int (CALLING_CONV *UnitDef_getTransportCapacity)(int skirmishAIId, int unitDefId); 885 886 int (CALLING_CONV *UnitDef_getTransportSize)(int skirmishAIId, int unitDefId); 887 888 int (CALLING_CONV *UnitDef_getMinTransportSize)(int skirmishAIId, int unitDefId); 889 890 bool (CALLING_CONV *UnitDef_isAirBase)(int skirmishAIId, int unitDefId); 891 892 /** */ 893 bool (CALLING_CONV *UnitDef_isFirePlatform)(int skirmishAIId, int unitDefId); 894 895 float (CALLING_CONV *UnitDef_getTransportMass)(int skirmishAIId, int unitDefId); 896 897 float (CALLING_CONV *UnitDef_getMinTransportMass)(int skirmishAIId, int unitDefId); 898 899 bool (CALLING_CONV *UnitDef_isHoldSteady)(int skirmishAIId, int unitDefId); 900 901 bool (CALLING_CONV *UnitDef_isReleaseHeld)(int skirmishAIId, int unitDefId); 902 903 bool (CALLING_CONV *UnitDef_isNotTransportable)(int skirmishAIId, int unitDefId); 904 905 bool (CALLING_CONV *UnitDef_isTransportByEnemy)(int skirmishAIId, int unitDefId); 906 907 /** 908 * @return 0: land unload 909 * 1: fly-over drop 910 * 2: land flood 911 */ 912 int (CALLING_CONV *UnitDef_getTransportUnloadMethod)(int skirmishAIId, int unitDefId); 913 914 /** 915 * Dictates fall speed of all transported units. 916 * This only makes sense for air transports, 917 * if they an drop units while in the air. 918 */ 919 float (CALLING_CONV *UnitDef_getFallSpeed)(int skirmishAIId, int unitDefId); 920 921 /** Sets the transported units FBI, overrides fallSpeed */ 922 float (CALLING_CONV *UnitDef_getUnitFallSpeed)(int skirmishAIId, int unitDefId); 923 924 // end: transports stuff 925 /** If the unit can cloak */ 926 bool (CALLING_CONV *UnitDef_isAbleToCloak)(int skirmishAIId, int unitDefId); 927 928 /** If the unit wants to start out cloaked */ 929 bool (CALLING_CONV *UnitDef_isStartCloaked)(int skirmishAIId, int unitDefId); 930 931 /** Energy cost per second to stay cloaked when stationary */ 932 float (CALLING_CONV *UnitDef_getCloakCost)(int skirmishAIId, int unitDefId); 933 934 /** Energy cost per second to stay cloaked when moving */ 935 float (CALLING_CONV *UnitDef_getCloakCostMoving)(int skirmishAIId, int unitDefId); 936 937 /** If enemy unit comes within this range, decloaking is forced */ 938 float (CALLING_CONV *UnitDef_getDecloakDistance)(int skirmishAIId, int unitDefId); 939 940 /** Use a spherical, instead of a cylindrical test? */ 941 bool (CALLING_CONV *UnitDef_isDecloakSpherical)(int skirmishAIId, int unitDefId); 942 943 /** Will the unit decloak upon firing? */ 944 bool (CALLING_CONV *UnitDef_isDecloakOnFire)(int skirmishAIId, int unitDefId); 945 946 /** Will the unit self destruct if an enemy comes to close? */ 947 bool (CALLING_CONV *UnitDef_isAbleToKamikaze)(int skirmishAIId, int unitDefId); 948 949 float (CALLING_CONV *UnitDef_getKamikazeDist)(int skirmishAIId, int unitDefId); 950 951 bool (CALLING_CONV *UnitDef_isTargetingFacility)(int skirmishAIId, int unitDefId); 952 953 bool (CALLING_CONV *UnitDef_canManualFire)(int skirmishAIId, int unitDefId); 954 955 bool (CALLING_CONV *UnitDef_isNeedGeo)(int skirmishAIId, int unitDefId); 956 957 bool (CALLING_CONV *UnitDef_isFeature)(int skirmishAIId, int unitDefId); 958 959 bool (CALLING_CONV *UnitDef_isHideDamage)(int skirmishAIId, int unitDefId); 960 961 bool (CALLING_CONV *UnitDef_isCommander)(int skirmishAIId, int unitDefId); 962 963 bool (CALLING_CONV *UnitDef_isShowPlayerName)(int skirmishAIId, int unitDefId); 964 965 bool (CALLING_CONV *UnitDef_isAbleToResurrect)(int skirmishAIId, int unitDefId); 966 967 bool (CALLING_CONV *UnitDef_isAbleToCapture)(int skirmishAIId, int unitDefId); 968 969 /** 970 * Indicates the trajectory types supported by this unit. 971 * 972 * @return 0: (default) = only low 973 * 1: only high 974 * 2: choose 975 */ 976 int (CALLING_CONV *UnitDef_getHighTrajectoryType)(int skirmishAIId, int unitDefId); 977 978 /** 979 * Returns the bit field value denoting the categories this unit shall not 980 * chase. 981 * @see Game#getCategoryFlag 982 * @see Game#getCategoryName 983 */ 984 int (CALLING_CONV *UnitDef_getNoChaseCategory)(int skirmishAIId, int unitDefId); 985 986 bool (CALLING_CONV *UnitDef_isLeaveTracks)(int skirmishAIId, int unitDefId); 987 988 float (CALLING_CONV *UnitDef_getTrackWidth)(int skirmishAIId, int unitDefId); 989 990 float (CALLING_CONV *UnitDef_getTrackOffset)(int skirmishAIId, int unitDefId); 991 992 float (CALLING_CONV *UnitDef_getTrackStrength)(int skirmishAIId, int unitDefId); 993 994 float (CALLING_CONV *UnitDef_getTrackStretch)(int skirmishAIId, int unitDefId); 995 996 int (CALLING_CONV *UnitDef_getTrackType)(int skirmishAIId, int unitDefId); 997 998 bool (CALLING_CONV *UnitDef_isAbleToDropFlare)(int skirmishAIId, int unitDefId); 999 1000 float (CALLING_CONV *UnitDef_getFlareReloadTime)(int skirmishAIId, int unitDefId); 1001 1002 float (CALLING_CONV *UnitDef_getFlareEfficiency)(int skirmishAIId, int unitDefId); 1003 1004 float (CALLING_CONV *UnitDef_getFlareDelay)(int skirmishAIId, int unitDefId); 1005 1006 void (CALLING_CONV *UnitDef_getFlareDropVector)(int skirmishAIId, int unitDefId, float* return_posF3_out); 1007 1008 int (CALLING_CONV *UnitDef_getFlareTime)(int skirmishAIId, int unitDefId); 1009 1010 int (CALLING_CONV *UnitDef_getFlareSalvoSize)(int skirmishAIId, int unitDefId); 1011 1012 int (CALLING_CONV *UnitDef_getFlareSalvoDelay)(int skirmishAIId, int unitDefId); 1013 1014 /** Only matters for fighter aircraft */ 1015 bool (CALLING_CONV *UnitDef_isAbleToLoopbackAttack)(int skirmishAIId, int unitDefId); 1016 1017 /** 1018 * Indicates whether the ground will be leveled/flattened out 1019 * after this building has been built on it. 1020 * Only matters for buildings. 1021 */ 1022 bool (CALLING_CONV *UnitDef_isLevelGround)(int skirmishAIId, int unitDefId); 1023 1024 bool (CALLING_CONV *UnitDef_isUseBuildingGroundDecal)(int skirmishAIId, int unitDefId); 1025 1026 int (CALLING_CONV *UnitDef_getBuildingDecalType)(int skirmishAIId, int unitDefId); 1027 1028 int (CALLING_CONV *UnitDef_getBuildingDecalSizeX)(int skirmishAIId, int unitDefId); 1029 1030 int (CALLING_CONV *UnitDef_getBuildingDecalSizeY)(int skirmishAIId, int unitDefId); 1031 1032 float (CALLING_CONV *UnitDef_getBuildingDecalDecaySpeed)(int skirmishAIId, int unitDefId); 1033 1034 /** 1035 * Maximum flight time in seconds before the aircraft needs 1036 * to return to an air repair bay to refuel. 1037 */ 1038 float (CALLING_CONV *UnitDef_getMaxFuel)(int skirmishAIId, int unitDefId); 1039 1040 /** Time to fully refuel the unit */ 1041 float (CALLING_CONV *UnitDef_getRefuelTime)(int skirmishAIId, int unitDefId); 1042 1043 /** Minimum build power of airbases that this aircraft can land on */ 1044 float (CALLING_CONV *UnitDef_getMinAirBasePower)(int skirmishAIId, int unitDefId); 1045 1046 /** Number of units of this type allowed simultaneously in the game */ 1047 int (CALLING_CONV *UnitDef_getMaxThisUnit)(int skirmishAIId, int unitDefId); 1048 1049 int (CALLING_CONV *UnitDef_getDecoyDef)(int skirmishAIId, int unitDefId); //$ REF:RETURN->UnitDef 1050 1051 bool (CALLING_CONV *UnitDef_isDontLand)(int skirmishAIId, int unitDefId); 1052 1053 int (CALLING_CONV *UnitDef_getShieldDef)(int skirmishAIId, int unitDefId); //$ REF:RETURN->WeaponDef 1054 1055 int (CALLING_CONV *UnitDef_getStockpileDef)(int skirmishAIId, int unitDefId); //$ REF:RETURN->WeaponDef 1056 1057 int (CALLING_CONV *UnitDef_getBuildOptions)(int skirmishAIId, int unitDefId, int* unitDefIds, int unitDefIds_sizeMax); //$ REF:MULTI:unitDefIds->UnitDef 1058 1059 int (CALLING_CONV *UnitDef_getCustomParams)(int skirmishAIId, int unitDefId, const char** keys, const char** values); //$ MAP 1060 1061 1062 1063 bool (CALLING_CONV *UnitDef_isMoveDataAvailable)(int skirmishAIId, int unitDefId); //$ AVAILABLE:MoveData 1064 1065 /// @deprecated 1066 float (CALLING_CONV *UnitDef_MoveData_getMaxAcceleration)(int skirmishAIId, int unitDefId); 1067 1068 /// @deprecated 1069 float (CALLING_CONV *UnitDef_MoveData_getMaxBreaking)(int skirmishAIId, int unitDefId); 1070 1071 /// @deprecated 1072 float (CALLING_CONV *UnitDef_MoveData_getMaxSpeed)(int skirmishAIId, int unitDefId); 1073 1074 /// @deprecated 1075 short (CALLING_CONV *UnitDef_MoveData_getMaxTurnRate)(int skirmishAIId, int unitDefId); 1076 1077 int (CALLING_CONV *UnitDef_MoveData_getXSize)(int skirmishAIId, int unitDefId); 1078 1079 int (CALLING_CONV *UnitDef_MoveData_getZSize)(int skirmishAIId, int unitDefId); 1080 1081 float (CALLING_CONV *UnitDef_MoveData_getDepth)(int skirmishAIId, int unitDefId); 1082 1083 float (CALLING_CONV *UnitDef_MoveData_getMaxSlope)(int skirmishAIId, int unitDefId); 1084 1085 float (CALLING_CONV *UnitDef_MoveData_getSlopeMod)(int skirmishAIId, int unitDefId); 1086 1087 float (CALLING_CONV *UnitDef_MoveData_getDepthMod)(int skirmishAIId, int unitDefId); 1088 1089 int (CALLING_CONV *UnitDef_MoveData_getPathType)(int skirmishAIId, int unitDefId); 1090 1091 float (CALLING_CONV *UnitDef_MoveData_getCrushStrength)(int skirmishAIId, int unitDefId); 1092 1093 /** enum MoveType { Ground_Move=0, Hover_Move=1, Ship_Move=2 }; */ 1094 int (CALLING_CONV *UnitDef_MoveData_getMoveType)(int skirmishAIId, int unitDefId); 1095 1096 /** enum SpeedModClass { Tank=0, KBot=1, Hover=2, Ship=3 }; */ 1097 int (CALLING_CONV *UnitDef_MoveData_getSpeedModClass)(int skirmishAIId, int unitDefId); 1098 1099 int (CALLING_CONV *UnitDef_MoveData_getTerrainClass)(int skirmishAIId, int unitDefId); 1100 1101 bool (CALLING_CONV *UnitDef_MoveData_getFollowGround)(int skirmishAIId, int unitDefId); 1102 1103 bool (CALLING_CONV *UnitDef_MoveData_isSubMarine)(int skirmishAIId, int unitDefId); 1104 1105 const char* (CALLING_CONV *UnitDef_MoveData_getName)(int skirmishAIId, int unitDefId); 1106 1107 1108 1109 int (CALLING_CONV *UnitDef_getWeaponMounts)(int skirmishAIId, int unitDefId); //$ FETCHER:MULTI:NUM:WeaponMount 1110 1111 const char* (CALLING_CONV *UnitDef_WeaponMount_getName)(int skirmishAIId, int unitDefId, int weaponMountId); 1112 1113 int (CALLING_CONV *UnitDef_WeaponMount_getWeaponDef)(int skirmishAIId, int unitDefId, int weaponMountId); //$ REF:RETURN->WeaponDef 1114 1115 int (CALLING_CONV *UnitDef_WeaponMount_getSlavedTo)(int skirmishAIId, int unitDefId, int weaponMountId); 1116 1117 void (CALLING_CONV *UnitDef_WeaponMount_getMainDir)(int skirmishAIId, int unitDefId, int weaponMountId, float* return_posF3_out); 1118 1119 float (CALLING_CONV *UnitDef_WeaponMount_getMaxAngleDif)(int skirmishAIId, int unitDefId, int weaponMountId); 1120 1121 /** 1122 * How many seconds of fuel it costs for the owning unit to fire this weapon. 1123 */ 1124 float (CALLING_CONV *UnitDef_WeaponMount_getFuelUsage)(int skirmishAIId, int unitDefId, int weaponMountId); 1125 1126 /** 1127 * Returns the bit field value denoting the categories this weapon should 1128 * not target. 1129 * @see Game#getCategoryFlag 1130 * @see Game#getCategoryName 1131 */ 1132 int (CALLING_CONV *UnitDef_WeaponMount_getBadTargetCategory)(int skirmishAIId, int unitDefId, int weaponMountId); 1133 1134 /** 1135 * Returns the bit field value denoting the categories this weapon should 1136 * target, excluding all others. 1137 * @see Game#getCategoryFlag 1138 * @see Game#getCategoryName 1139 */ 1140 int (CALLING_CONV *UnitDef_WeaponMount_getOnlyTargetCategory)(int skirmishAIId, int unitDefId, int weaponMountId); 1141 1142 // END OBJECT UnitDef 1143 1144 1145 1146 // BEGINN OBJECT Unit 1147 /** 1148 * Returns the number of units a team can have, after which it can not build 1149 * any more. It is possible that a team has more units then this value at 1150 * some point in the game. This is possible for example with taking, 1151 * reclaiming or capturing units. 1152 * This value is usefull for controlling game performance, and will 1153 * therefore often be set on games with old hardware to prevent lagging 1154 * because of too many units. 1155 */ 1156 int (CALLING_CONV *Unit_getLimit)(int skirmishAIId); //$ STATIC 1157 1158 /** 1159 * Returns the maximum total number of units that may exist at any one point 1160 * in time induring the current game. 1161 */ 1162 int (CALLING_CONV *Unit_getMax)(int skirmishAIId); //$ STATIC 1163 1164 /** 1165 * Returns all units that are not in this teams ally-team nor neutral 1166 * and are in LOS. 1167 * If cheats are enabled, this will return all enemies on the map. 1168 */ 1169 int (CALLING_CONV *getEnemyUnits)(int skirmishAIId, int* unitIds, int unitIds_sizeMax); //$ FETCHER:MULTI:IDs:Unit:unitIds 1170 1171 /** 1172 * Returns all units that are not in this teams ally-team nor neutral 1173 * and are in LOS plus they have to be located in the specified area 1174 * of the map. 1175 * If cheats are enabled, this will return all enemies 1176 * in the specified area. 1177 */ 1178 int (CALLING_CONV *getEnemyUnitsIn)(int skirmishAIId, float* pos_posF3, float radius, int* unitIds, int unitIds_sizeMax); //$ FETCHER:MULTI:IDs:Unit:unitIds 1179 1180 /** 1181 * Returns all units that are not in this teams ally-team nor neutral 1182 * and are in under sensor coverage (sight or radar). 1183 * If cheats are enabled, this will return all enemies on the map. 1184 */ 1185 int (CALLING_CONV *getEnemyUnitsInRadarAndLos)(int skirmishAIId, int* unitIds, int unitIds_sizeMax); //$ FETCHER:MULTI:IDs:Unit:unitIds 1186 1187 /** 1188 * Returns all units that are in this teams ally-team, including this teams 1189 * units. 1190 */ 1191 int (CALLING_CONV *getFriendlyUnits)(int skirmishAIId, int* unitIds, int unitIds_sizeMax); //$ FETCHER:MULTI:IDs:Unit:unitIds 1192 1193 /** 1194 * Returns all units that are in this teams ally-team, including this teams 1195 * units plus they have to be located in the specified area of the map. 1196 */ 1197 int (CALLING_CONV *getFriendlyUnitsIn)(int skirmishAIId, float* pos_posF3, float radius, int* unitIds, int unitIds_sizeMax); //$ FETCHER:MULTI:IDs:Unit:unitIds 1198 1199 /** 1200 * Returns all units that are neutral and are in LOS. 1201 */ 1202 int (CALLING_CONV *getNeutralUnits)(int skirmishAIId, int* unitIds, int unitIds_sizeMax); //$ FETCHER:MULTI:IDs:Unit:unitIds 1203 1204 /** 1205 * Returns all units that are neutral and are in LOS plus they have to be 1206 * located in the specified area of the map. 1207 */ 1208 int (CALLING_CONV *getNeutralUnitsIn)(int skirmishAIId, float* pos_posF3, float radius, int* unitIds, int unitIds_sizeMax); //$ FETCHER:MULTI:IDs:Unit:unitIds 1209 1210 /** 1211 * Returns all units that are of the team controlled by this AI instance. This 1212 * list can also be created dynamically by the AI, through updating a list on 1213 * each unit-created and unit-destroyed event. 1214 */ 1215 int (CALLING_CONV *getTeamUnits)(int skirmishAIId, int* unitIds, int unitIds_sizeMax); //$ FETCHER:MULTI:IDs:Unit:unitIds 1216 1217 /** 1218 * Returns all units that are currently selected 1219 * (usually only contains units if a human player 1220 * is controlling this team as well). 1221 */ 1222 int (CALLING_CONV *getSelectedUnits)(int skirmishAIId, int* unitIds, int unitIds_sizeMax); //$ FETCHER:MULTI:IDs:Unit:unitIds 1223 1224 /** 1225 * Returns the unit's unitdef struct from which you can read all 1226 * the statistics of the unit, do NOT try to change any values in it. 1227 */ 1228 int (CALLING_CONV *Unit_getDef)(int skirmishAIId, int unitId); //$ REF:RETURN->UnitDef 1229 1230 /** 1231 * This is a set of parameters that is created by SetUnitRulesParam() and may change during the game. 1232 * Each parameter is uniquely identified only by its id (which is the index in the vector). 1233 * Parameters may or may not have a name. 1234 * @return visible to skirmishAIId parameters. 1235 * If cheats are enabled, this will return all parameters. 1236 */ 1237 int (CALLING_CONV *Unit_getUnitRulesParams)(int skirmishAIId, int unitId, int* paramIds, int paramIds_sizeMax); //$ FETCHER:MULTI:IDs:UnitRulesParam:paramIds 1238 1239 /** 1240 * @return only visible to skirmishAIId parameter. 1241 * If cheats are enabled, this will return parameter despite it's losStatus. 1242 */ 1243 int (CALLING_CONV *Unit_getUnitRulesParamByName)(int skirmishAIId, int unitId, const char* rulesParamName); //$ REF:RETURN->UnitRulesParam 1244 1245 /** 1246 * @return only visible to skirmishAIId parameter. 1247 * If cheats are enabled, this will return parameter despite it's losStatus. 1248 */ 1249 int (CALLING_CONV *Unit_getUnitRulesParamById)(int skirmishAIId, int unitId, int rulesParamId); //$ REF:RETURN->UnitRulesParam 1250 1251 /** 1252 * Not every mod parameter has a name. 1253 */ 1254 const char* (CALLING_CONV *Unit_UnitRulesParam_getName)(int skirmishAIId, int unitId, int unitRulesParamId); 1255 1256 /** 1257 * @return float value of parameter if it's set, 0.0 otherwise. 1258 */ 1259 float (CALLING_CONV *Unit_UnitRulesParam_getValueFloat)(int skirmishAIId, int unitId, int unitRulesParamId); 1260 1261 /** 1262 * @return string value of parameter if it's set, empty string otherwise. 1263 */ 1264 const char* (CALLING_CONV *Unit_UnitRulesParam_getValueString)(int skirmishAIId, int unitId, int unitRulesParamId); 1265 1266 int (CALLING_CONV *Unit_getTeam)(int skirmishAIId, int unitId); 1267 1268 int (CALLING_CONV *Unit_getAllyTeam)(int skirmishAIId, int unitId); 1269 1270 /** 1271 * Indicates the units main function. 1272 * This can be used as help for (skirmish) AIs. 1273 * 1274 * example: 1275 * A unit can shoot, build and transport other units. 1276 * To human players, it is obvious that transportation is the units 1277 * main function, as it can transport a lot of units, 1278 * but has only weak build- and fire-power. 1279 * Instead of letting the AI developers write complex 1280 * algorithms to find out the same, mod developers can set this value. 1281 * 1282 * @return 0: ??? 1283 * 1: ??? 1284 * 2: ??? 1285 * ... 1286 * @deprecated 1287 */ 1288 int (CALLING_CONV *Unit_getAiHint)(int skirmishAIId, int unitId); 1289 1290 int (CALLING_CONV *Unit_getStockpile)(int skirmishAIId, int unitId); 1291 1292 int (CALLING_CONV *Unit_getStockpileQueued)(int skirmishAIId, int unitId); 1293 1294 float (CALLING_CONV *Unit_getCurrentFuel)(int skirmishAIId, int unitId); 1295 1296 /** The unit's max speed */ 1297 float (CALLING_CONV *Unit_getMaxSpeed)(int skirmishAIId, int unitId); 1298 1299 /** The furthest any weapon of the unit can fire */ 1300 float (CALLING_CONV *Unit_getMaxRange)(int skirmishAIId, int unitId); 1301 1302 /** The unit's max health */ 1303 float (CALLING_CONV *Unit_getMaxHealth)(int skirmishAIId, int unitId); 1304 1305 /** How experienced the unit is (0.0f - 1.0f) */ 1306 float (CALLING_CONV *Unit_getExperience)(int skirmishAIId, int unitId); 1307 1308 /** Returns the group a unit belongs to, -1 if none */ 1309 int (CALLING_CONV *Unit_getGroup)(int skirmishAIId, int unitId); 1310 1311 int (CALLING_CONV *Unit_getCurrentCommands)(int skirmishAIId, int unitId); //$ FETCHER:MULTI:NUM:CurrentCommand-Command 1312 1313 /** 1314 * For the type of the command queue, see CCommandQueue::CommandQueueType 1315 * in Sim/Unit/CommandAI/CommandQueue.h 1316 */ 1317 int (CALLING_CONV *Unit_CurrentCommand_getType)(int skirmishAIId, int unitId); //$ STATIC 1318 1319 /** 1320 * For the id, see CMD_xxx codes in Sim/Unit/CommandAI/Command.h 1321 * (custom codes can also be used) 1322 */ 1323 int (CALLING_CONV *Unit_CurrentCommand_getId)(int skirmishAIId, int unitId, int commandId); 1324 1325 short (CALLING_CONV *Unit_CurrentCommand_getOptions)(int skirmishAIId, int unitId, int commandId); 1326 1327 int (CALLING_CONV *Unit_CurrentCommand_getTag)(int skirmishAIId, int unitId, int commandId); 1328 1329 int (CALLING_CONV *Unit_CurrentCommand_getTimeOut)(int skirmishAIId, int unitId, int commandId); 1330 1331 int (CALLING_CONV *Unit_CurrentCommand_getParams)(int skirmishAIId, int unitId, int commandId, float* params, int params_sizeMax); //$ ARRAY:params 1332 1333 /** The commands that this unit can understand, other commands will be ignored */ 1334 int (CALLING_CONV *Unit_getSupportedCommands)(int skirmishAIId, int unitId); //$ FETCHER:MULTI:NUM:SupportedCommand-CommandDescription 1335 1336 /** 1337 * For the id, see CMD_xxx codes in Sim/Unit/CommandAI/Command.h 1338 * (custom codes can also be used) 1339 */ 1340 int (CALLING_CONV *Unit_SupportedCommand_getId)(int skirmishAIId, int unitId, int supportedCommandId); 1341 1342 const char* (CALLING_CONV *Unit_SupportedCommand_getName)(int skirmishAIId, int unitId, int supportedCommandId); 1343 1344 const char* (CALLING_CONV *Unit_SupportedCommand_getToolTip)(int skirmishAIId, int unitId, int supportedCommandId); 1345 1346 bool (CALLING_CONV *Unit_SupportedCommand_isShowUnique)(int skirmishAIId, int unitId, int supportedCommandId); 1347 1348 bool (CALLING_CONV *Unit_SupportedCommand_isDisabled)(int skirmishAIId, int unitId, int supportedCommandId); 1349 1350 int (CALLING_CONV *Unit_SupportedCommand_getParams)(int skirmishAIId, int unitId, int supportedCommandId, const char** params, int params_sizeMax); //$ ARRAY:params 1351 1352 /** The unit's current health */ 1353 float (CALLING_CONV *Unit_getHealth)(int skirmishAIId, int unitId); 1354 1355 float (CALLING_CONV *Unit_getSpeed)(int skirmishAIId, int unitId); 1356 1357 /** 1358 * Indicate the relative power of the unit, 1359 * used for experience calulations etc. 1360 * This is sort of the measure of the units overall power. 1361 */ 1362 float (CALLING_CONV *Unit_getPower)(int skirmishAIId, int unitId); 1363 1364 // int (CALLING_CONV *Unit_getResourceInfos)(int skirmishAIId, int unitId); //$ FETCHER:MULTI:NUM:ResourceInfo 1365 1366 float (CALLING_CONV *Unit_getResourceUse)(int skirmishAIId, int unitId, int resourceId); //$ REF:resourceId->Resource 1367 1368 float (CALLING_CONV *Unit_getResourceMake)(int skirmishAIId, int unitId, int resourceId); //$ REF:resourceId->Resource 1369 1370 void (CALLING_CONV *Unit_getPos)(int skirmishAIId, int unitId, float* return_posF3_out); 1371 1372 void (CALLING_CONV *Unit_getVel)(int skirmishAIId, int unitId, float* return_posF3_out); 1373 1374 bool (CALLING_CONV *Unit_isActivated)(int skirmishAIId, int unitId); 1375 1376 /** Returns true if the unit is currently being built */ 1377 bool (CALLING_CONV *Unit_isBeingBuilt)(int skirmishAIId, int unitId); 1378 1379 bool (CALLING_CONV *Unit_isCloaked)(int skirmishAIId, int unitId); 1380 1381 bool (CALLING_CONV *Unit_isParalyzed)(int skirmishAIId, int unitId); 1382 1383 bool (CALLING_CONV *Unit_isNeutral)(int skirmishAIId, int unitId); 1384 1385 /** Returns the unit's build facing (0-3) */ 1386 int (CALLING_CONV *Unit_getBuildingFacing)(int skirmishAIId, int unitId); 1387 1388 /** Number of the last frame this unit received an order from a player. */ 1389 int (CALLING_CONV *Unit_getLastUserOrderFrame)(int skirmishAIId, int unitId); 1390 1391 // END OBJECT Unit 1392 1393 1394 // BEGINN OBJECT Team 1395 bool (CALLING_CONV *Team_hasAIController)(int skirmishAIId, int teamId); 1396 1397 int (CALLING_CONV *getEnemyTeams)(int skirmishAIId, int* teamIds, int teamIds_sizeMax); //$ FETCHER:MULTI:IDs:Team:teamIds 1398 1399 int (CALLING_CONV *getAllyTeams)(int skirmishAIId, int* teamIds, int teamIds_sizeMax); //$ FETCHER:MULTI:IDs:Team:teamIds 1400 1401 /** 1402 * This is a set of parameters that is created by SetTeamRulesParam() and may change during the game. 1403 * Each parameter is uniquely identified only by its id (which is the index in the vector). 1404 * Parameters may or may not have a name. 1405 * @return visible to skirmishAIId parameters. 1406 * If cheats are enabled, this will return all parameters. 1407 */ 1408 int (CALLING_CONV *Team_getTeamRulesParams)(int skirmishAIId, int teamId, int* paramIds, int paramIds_sizeMax); //$ FETCHER:MULTI:IDs:TeamRulesParam:paramIds 1409 1410 /** 1411 * @return only visible to skirmishAIId parameter. 1412 * If cheats are enabled, this will return parameter despite it's losStatus. 1413 */ 1414 int (CALLING_CONV *Team_getTeamRulesParamByName)(int skirmishAIId, int teamId, const char* rulesParamName); //$ REF:RETURN->TeamRulesParam 1415 1416 /** 1417 * @return only visible to skirmishAIId parameter. 1418 * If cheats are enabled, this will return parameter despite it's losStatus. 1419 */ 1420 int (CALLING_CONV *Team_getTeamRulesParamById)(int skirmishAIId, int teamId, int rulesParamId); //$ REF:RETURN->TeamRulesParam 1421 1422 /** 1423 * Not every mod parameter has a name. 1424 */ 1425 const char* (CALLING_CONV *Team_TeamRulesParam_getName)(int skirmishAIId, int teamId, int teamRulesParamId); 1426 1427 /** 1428 * @return float value of parameter if it's set, 0.0 otherwise. 1429 */ 1430 float (CALLING_CONV *Team_TeamRulesParam_getValueFloat)(int skirmishAIId, int teamId, int teamRulesParamId); 1431 1432 /** 1433 * @return string value of parameter if it's set, empty string otherwise. 1434 */ 1435 const char* (CALLING_CONV *Team_TeamRulesParam_getValueString)(int skirmishAIId, int teamId, int teamRulesParamId); 1436 1437 // END OBJECT Team 1438 1439 1440 // BEGINN OBJECT Group 1441 int (CALLING_CONV *getGroups)(int skirmishAIId, int* groupIds, int groupIds_sizeMax); //$ FETCHER:MULTI:IDs:Group:groupIds 1442 1443 int (CALLING_CONV *Group_getSupportedCommands)(int skirmishAIId, int groupId); //$ FETCHER:MULTI:NUM:SupportedCommand-CommandDescription 1444 1445 /** 1446 * For the id, see CMD_xxx codes in Sim/Unit/CommandAI/Command.h 1447 * (custom codes can also be used) 1448 */ 1449 int (CALLING_CONV *Group_SupportedCommand_getId)(int skirmishAIId, int groupId, int supportedCommandId); 1450 1451 const char* (CALLING_CONV *Group_SupportedCommand_getName)(int skirmishAIId, int groupId, int supportedCommandId); 1452 1453 const char* (CALLING_CONV *Group_SupportedCommand_getToolTip)(int skirmishAIId, int groupId, int supportedCommandId); 1454 1455 bool (CALLING_CONV *Group_SupportedCommand_isShowUnique)(int skirmishAIId, int groupId, int supportedCommandId); 1456 1457 bool (CALLING_CONV *Group_SupportedCommand_isDisabled)(int skirmishAIId, int groupId, int supportedCommandId); 1458 1459 int (CALLING_CONV *Group_SupportedCommand_getParams)(int skirmishAIId, int groupId, int supportedCommandId, const char** params, int params_sizeMax); //$ ARRAY:params 1460 1461 /** 1462 * For the id, see CMD_xxx codes in Sim/Unit/CommandAI/Command.h 1463 * (custom codes can also be used) 1464 */ 1465 int (CALLING_CONV *Group_OrderPreview_getId)(int skirmishAIId, int groupId); 1466 1467 short (CALLING_CONV *Group_OrderPreview_getOptions)(int skirmishAIId, int groupId); 1468 1469 int (CALLING_CONV *Group_OrderPreview_getTag)(int skirmishAIId, int groupId); 1470 1471 int (CALLING_CONV *Group_OrderPreview_getTimeOut)(int skirmishAIId, int groupId); 1472 1473 int (CALLING_CONV *Group_OrderPreview_getParams)(int skirmishAIId, int groupId, float* params, int params_sizeMax); //$ ARRAY:params 1474 1475 bool (CALLING_CONV *Group_isSelected)(int skirmishAIId, int groupId); 1476 1477 // END OBJECT Group 1478 1479 1480 1481 // BEGINN OBJECT Mod 1482 1483 /** 1484 * Returns the mod archive file name. 1485 * CAUTION: 1486 * Never use this as reference in eg. cache- or config-file names, 1487 * as one and the same mod can be packaged in different ways. 1488 * Use the human name instead. 1489 * @see getHumanName() 1490 * @deprecated 1491 */ 1492 const char* (CALLING_CONV *Mod_getFileName)(int skirmishAIId); 1493 1494 /** 1495 * Returns the archive hash of the mod. 1496 * Use this for reference to the mod, eg. in a cache-file, wherever human 1497 * readability does not matter. 1498 * This value will never be the same for two mods not having equal content. 1499 * Tip: convert to 64 Hex chars for use in file names. 1500 * @see getHumanName() 1501 */ 1502 int (CALLING_CONV *Mod_getHash)(int skirmishAIId); 1503 1504 /** 1505 * Returns the human readable name of the mod, which includes the version. 1506 * Use this for reference to the mod (including version), eg. in cache- or 1507 * config-file names which are mod related, and wherever humans may come 1508 * in contact with the reference. 1509 * Be aware though, that this may contain special characters and spaces, 1510 * and may not be used as a file name without checks and replaces. 1511 * Alternatively, you may use the short name only, or the short name plus 1512 * version. You should generally never use the file name. 1513 * Tip: replace every char matching [^0-9a-zA-Z_-.] with '_' 1514 * @see getHash() 1515 * @see getShortName() 1516 * @see getFileName() 1517 * @see getVersion() 1518 */ 1519 const char* (CALLING_CONV *Mod_getHumanName)(int skirmishAIId); 1520 1521 /** 1522 * Returns the short name of the mod, which does not include the version. 1523 * Use this for reference to the mod in general, eg. as version independent 1524 * reference. 1525 * Be aware though, that this still contain special characters and spaces, 1526 * and may not be used as a file name without checks and replaces. 1527 * Tip: replace every char matching [^0-9a-zA-Z_-.] with '_' 1528 * @see getVersion() 1529 * @see getHumanName() 1530 */ 1531 const char* (CALLING_CONV *Mod_getShortName)(int skirmishAIId); 1532 1533 const char* (CALLING_CONV *Mod_getVersion)(int skirmishAIId); 1534 1535 const char* (CALLING_CONV *Mod_getMutator)(int skirmishAIId); 1536 1537 const char* (CALLING_CONV *Mod_getDescription)(int skirmishAIId); 1538 1539 bool (CALLING_CONV *Mod_getAllowTeamColors)(int skirmishAIId); 1540 1541 /** 1542 * Should constructions without builders decay? 1543 */ 1544 bool (CALLING_CONV *Mod_getConstructionDecay)(int skirmishAIId); 1545 1546 /** 1547 * How long until they start decaying? 1548 */ 1549 int (CALLING_CONV *Mod_getConstructionDecayTime)(int skirmishAIId); 1550 1551 /** 1552 * How fast do they decay? 1553 */ 1554 float (CALLING_CONV *Mod_getConstructionDecaySpeed)(int skirmishAIId); 1555 1556 /** 1557 * 0 = 1 reclaimer per feature max, otherwise unlimited 1558 */ 1559 int (CALLING_CONV *Mod_getMultiReclaim)(int skirmishAIId); 1560 1561 /** 1562 * 0 = gradual reclaim, 1 = all reclaimed at end, otherwise reclaim in reclaimMethod chunks 1563 */ 1564 int (CALLING_CONV *Mod_getReclaimMethod)(int skirmishAIId); 1565 1566 /** 1567 * 0 = Revert to wireframe, gradual reclaim, 1 = Subtract HP, give full metal at end, default 1 1568 */ 1569 int (CALLING_CONV *Mod_getReclaimUnitMethod)(int skirmishAIId); 1570 1571 /** 1572 * How much energy should reclaiming a unit cost, default 0.0 1573 */ 1574 float (CALLING_CONV *Mod_getReclaimUnitEnergyCostFactor)(int skirmishAIId); 1575 1576 /** 1577 * How much metal should reclaim return, default 1.0 1578 */ 1579 float (CALLING_CONV *Mod_getReclaimUnitEfficiency)(int skirmishAIId); 1580 1581 /** 1582 * How much should energy should reclaiming a feature cost, default 0.0 1583 */ 1584 float (CALLING_CONV *Mod_getReclaimFeatureEnergyCostFactor)(int skirmishAIId); 1585 1586 /** 1587 * Allow reclaiming enemies? default true 1588 */ 1589 bool (CALLING_CONV *Mod_getReclaimAllowEnemies)(int skirmishAIId); 1590 1591 /** 1592 * Allow reclaiming allies? default true 1593 */ 1594 bool (CALLING_CONV *Mod_getReclaimAllowAllies)(int skirmishAIId); 1595 1596 /** 1597 * How much should energy should repair cost, default 0.0 1598 */ 1599 float (CALLING_CONV *Mod_getRepairEnergyCostFactor)(int skirmishAIId); 1600 1601 /** 1602 * How much should energy should resurrect cost, default 0.5 1603 */ 1604 float (CALLING_CONV *Mod_getResurrectEnergyCostFactor)(int skirmishAIId); 1605 1606 /** 1607 * How much should energy should capture cost, default 0.0 1608 */ 1609 float (CALLING_CONV *Mod_getCaptureEnergyCostFactor)(int skirmishAIId); 1610 1611 /** 1612 * 0 = all ground units cannot be transported, 1613 * 1 = all ground units can be transported 1614 * (mass and size restrictions still apply). 1615 * Defaults to 1. 1616 */ 1617 int (CALLING_CONV *Mod_getTransportGround)(int skirmishAIId); 1618 1619 /** 1620 * 0 = all hover units cannot be transported, 1621 * 1 = all hover units can be transported 1622 * (mass and size restrictions still apply). 1623 * Defaults to 0. 1624 */ 1625 int (CALLING_CONV *Mod_getTransportHover)(int skirmishAIId); 1626 1627 /** 1628 * 0 = all naval units cannot be transported, 1629 * 1 = all naval units can be transported 1630 * (mass and size restrictions still apply). 1631 * Defaults to 0. 1632 */ 1633 int (CALLING_CONV *Mod_getTransportShip)(int skirmishAIId); 1634 1635 /** 1636 * 0 = all air units cannot be transported, 1637 * 1 = all air units can be transported 1638 * (mass and size restrictions still apply). 1639 * Defaults to 0. 1640 */ 1641 int (CALLING_CONV *Mod_getTransportAir)(int skirmishAIId); 1642 1643 /** 1644 * 1 = units fire at enemies running Killed() script, 0 = units ignore such enemies 1645 */ 1646 int (CALLING_CONV *Mod_getFireAtKilled)(int skirmishAIId); 1647 1648 /** 1649 * 1 = units fire at crashing aircrafts, 0 = units ignore crashing aircrafts 1650 */ 1651 int (CALLING_CONV *Mod_getFireAtCrashing)(int skirmishAIId); 1652 1653 /** 1654 * 0=no flanking bonus; 1=global coords, mobile; 2=unit coords, mobile; 3=unit coords, locked 1655 */ 1656 int (CALLING_CONV *Mod_getFlankingBonusModeDefault)(int skirmishAIId); 1657 1658 /** 1659 * miplevel for los 1660 */ 1661 int (CALLING_CONV *Mod_getLosMipLevel)(int skirmishAIId); 1662 1663 /** 1664 * miplevel to use for airlos 1665 */ 1666 int (CALLING_CONV *Mod_getAirMipLevel)(int skirmishAIId); 1667 1668 /** 1669 * units sightdistance will be multiplied with this, for testing purposes 1670 */ 1671 float (CALLING_CONV *Mod_getLosMul)(int skirmishAIId); 1672 1673 /** 1674 * units airsightdistance will be multiplied with this, for testing purposes 1675 */ 1676 float (CALLING_CONV *Mod_getAirLosMul)(int skirmishAIId); 1677 1678 /** 1679 * when underwater, units are not in LOS unless also in sonar 1680 */ 1681 bool (CALLING_CONV *Mod_getRequireSonarUnderWater)(int skirmishAIId); 1682 1683 // END OBJECT Mod 1684 1685 1686 1687 // BEGINN OBJECT Map 1688 int (CALLING_CONV *Map_getChecksum)(int skirmishAIId); 1689 1690 void (CALLING_CONV *Map_getStartPos)(int skirmishAIId, float* return_posF3_out); 1691 1692 void (CALLING_CONV *Map_getMousePos)(int skirmishAIId, float* return_posF3_out); 1693 1694 bool (CALLING_CONV *Map_isPosInCamera)(int skirmishAIId, float* pos_posF3, float radius); 1695 1696 /** 1697 * Returns the maps center heightmap width. 1698 * @see getHeightMap() 1699 */ 1700 int (CALLING_CONV *Map_getWidth)(int skirmishAIId); 1701 1702 /** 1703 * Returns the maps center heightmap height. 1704 * @see getHeightMap() 1705 */ 1706 int (CALLING_CONV *Map_getHeight)(int skirmishAIId); 1707 1708 /** 1709 * Returns the height for the center of the squares. 1710 * This differs slightly from the drawn map, since 1711 * that one uses the height at the corners. 1712 * Note that the actual map is 8 times larger (in each dimension) and 1713 * all other maps (slope, los, resources, etc.) are relative to the 1714 * size of the heightmap. 1715 * 1716 * - do NOT modify or delete the height-map (native code relevant only) 1717 * - index 0 is top left 1718 * - each data position is 8*8 in size 1719 * - the value for the full resolution position (x, z) is at index (z * width + x) 1720 * - the last value, bottom right, is at index (width * height - 1) 1721 * 1722 * @see getCornersHeightMap() 1723 */ 1724 int (CALLING_CONV *Map_getHeightMap)(int skirmishAIId, float* heights, int heights_sizeMax); //$ ARRAY:heights 1725 1726 /** 1727 * Returns the height for the corners of the squares. 1728 * This is the same like the drawn map. 1729 * It is one unit wider and one higher then the centers height map. 1730 * 1731 * - do NOT modify or delete the height-map (native code relevant only) 1732 * - index 0 is top left 1733 * - 4 points mark the edges of an area of 8*8 in size 1734 * - the value for upper left corner of the full resolution position (x, z) is at index (z * width + x) 1735 * - the last value, bottom right, is at index ((width+1) * (height+1) - 1) 1736 * 1737 * @see getHeightMap() 1738 */ 1739 int (CALLING_CONV *Map_getCornersHeightMap)(int skirmishAIId, float* cornerHeights, int cornerHeights_sizeMax); //$ ARRAY:cornerHeights 1740 1741 float (CALLING_CONV *Map_getMinHeight)(int skirmishAIId); 1742 1743 float (CALLING_CONV *Map_getMaxHeight)(int skirmishAIId); 1744 1745 /** 1746 * @brief the slope map 1747 * The values are 1 minus the y-component of the (average) facenormal of the square. 1748 * 1749 * - do NOT modify or delete the height-map (native code relevant only) 1750 * - index 0 is top left 1751 * - each data position is 2*2 in size 1752 * - the value for the full resolution position (x, z) is at index ((z * width + x) / 2) 1753 * - the last value, bottom right, is at index (width/2 * height/2 - 1) 1754 */ 1755 int (CALLING_CONV *Map_getSlopeMap)(int skirmishAIId, float* slopes, int slopes_sizeMax); //$ ARRAY:slopes 1756 1757 /** 1758 * @brief the level of sight map 1759 * gs->mapx >> losMipLevel 1760 * A square with value zero means you do not have LOS coverage on it. 1761 *Mod_getLosMipLevel 1762 * - do NOT modify or delete the height-map (native code relevant only) 1763 * - index 0 is top left 1764 * - resolution factor (res) is min(1, 1 << Mod_getLosMipLevel()) 1765 * examples: 1766 * + losMipLevel(0) -> res(1) 1767 * + losMipLevel(1) -> res(2) 1768 * + losMipLevel(2) -> res(4) 1769 * + losMipLevel(3) -> res(8) 1770 * - each data position is res*res in size 1771 * - the value for the full resolution position (x, z) is at index ((z * width + x) / res) 1772 * - the last value, bottom right, is at index (width/res * height/res - 1) 1773 */ 1774 int (CALLING_CONV *Map_getLosMap)(int skirmishAIId, int* losValues, int losValues_sizeMax); //$ ARRAY:losValues 1775 1776 /** 1777 * @brief the radar map 1778 * A square with value 0 means you do not have radar coverage on it. 1779 * 1780 * - do NOT modify or delete the height-map (native code relevant only) 1781 * - index 0 is top left 1782 * - each data position is 8*8 in size 1783 * - the value for the full resolution position (x, z) is at index ((z * width + x) / 8) 1784 * - the last value, bottom right, is at index (width/8 * height/8 - 1) 1785 */ 1786 int (CALLING_CONV *Map_getRadarMap)(int skirmishAIId, int* radarValues, int radarValues_sizeMax); //$ ARRAY:radarValues 1787 1788 /** 1789 * @brief the radar jammer map 1790 * A square with value 0 means you do not have radar jamming coverage. 1791 * 1792 * - do NOT modify or delete the height-map (native code relevant only) 1793 * - index 0 is top left 1794 * - each data position is 8*8 in size 1795 * - the value for the full resolution position (x, z) is at index ((z * width + x) / 8) 1796 * - the last value, bottom right, is at index (width/8 * height/8 - 1) 1797 */ 1798 int (CALLING_CONV *Map_getJammerMap)(int skirmishAIId, int* jammerValues, int jammerValues_sizeMax); //$ ARRAY:jammerValues 1799 1800 /** 1801 * @brief resource maps 1802 * This map shows the resource density on the map. 1803 * 1804 * - do NOT modify or delete the height-map (native code relevant only) 1805 * - index 0 is top left 1806 * - each data position is 2*2 in size 1807 * - the value for the full resolution position (x, z) is at index ((z * width + x) / 2) 1808 * - the last value, bottom right, is at index (width/2 * height/2 - 1) 1809 */ 1810 int (CALLING_CONV *Map_getResourceMapRaw)(int skirmishAIId, int resourceId, short* resources, int resources_sizeMax); //$ REF:resourceId->Resource ARRAY:resources 1811 1812 /** 1813 * Returns positions indicating where to place resource extractors on the map. 1814 * Only the x and z values give the location of the spots, while the y values 1815 * represents the actual amount of resource an extractor placed there can make. 1816 * You should only compare the y values to each other, and not try to estimate 1817 * effective output from spots. 1818 */ 1819 int (CALLING_CONV *Map_getResourceMapSpotsPositions)(int skirmishAIId, int resourceId, float* spots_AposF3, int spots_AposF3_sizeMax); //$ REF:resourceId->Resource ARRAY:spots_AposF3 1820 1821 /** 1822 * Returns the average resource income for an extractor on one of the evaluated positions. 1823 */ 1824 float (CALLING_CONV *Map_getResourceMapSpotsAverageIncome)(int skirmishAIId, int resourceId); //$ REF:resourceId->Resource 1825 1826 /** 1827 * Returns the nearest resource extractor spot to a specified position out of the evaluated list. 1828 */ 1829 void (CALLING_CONV *Map_getResourceMapSpotsNearest)(int skirmishAIId, int resourceId, float* pos_posF3, float* return_posF3_out); //$ REF:resourceId->Resource 1830 1831 /** 1832 * Returns the archive hash of the map. 1833 * Use this for reference to the map, eg. in a cache-file, wherever human 1834 * readability does not matter. 1835 * This value will never be the same for two maps not having equal content. 1836 * Tip: convert to 64 Hex chars for use in file names. 1837 * @see getName() 1838 */ 1839 int (CALLING_CONV *Map_getHash)(int skirmishAIId); 1840 1841 /** 1842 * Returns the name of the map. 1843 * Use this for reference to the map, eg. in cache- or config-file names 1844 * which are map related, wherever humans may come in contact with the reference. 1845 * Be aware though, that this may contain special characters and spaces, 1846 * and may not be used as a file name without checks and replaces. 1847 * Tip: replace every char matching [^0-9a-zA-Z_-.] with '_' 1848 * @see getHash() 1849 * @see getHumanName() 1850 */ 1851 const char* (CALLING_CONV *Map_getName)(int skirmishAIId); 1852 1853 /** 1854 * Returns the human readbale name of the map. 1855 * @see getName() 1856 */ 1857 const char* (CALLING_CONV *Map_getHumanName)(int skirmishAIId); 1858 1859 /** Gets the elevation of the map at position (x, z) */ 1860 float (CALLING_CONV *Map_getElevationAt)(int skirmishAIId, float x, float z); 1861 1862 1863 /** Returns what value 255 in the resource map is worth */ 1864 float (CALLING_CONV *Map_getMaxResource)(int skirmishAIId, int resourceId); //$ REF:resourceId->Resource 1865 1866 /** Returns extraction radius for resource extractors */ 1867 float (CALLING_CONV *Map_getExtractorRadius)(int skirmishAIId, int resourceId); //$ REF:resourceId->Resource 1868 1869 float (CALLING_CONV *Map_getMinWind)(int skirmishAIId); 1870 1871 float (CALLING_CONV *Map_getMaxWind)(int skirmishAIId); 1872 1873 float (CALLING_CONV *Map_getCurWind)(int skirmishAIId); 1874 1875 float (CALLING_CONV *Map_getTidalStrength)(int skirmishAIId); 1876 1877 float (CALLING_CONV *Map_getGravity)(int skirmishAIId); 1878 1879 1880 /** 1881 * Returns all points drawn with this AIs team color, 1882 * and additionally the ones drawn with allied team colors, 1883 * if <code>includeAllies</code> is true. 1884 */ 1885 int (CALLING_CONV *Map_getPoints)(int skirmishAIId, bool includeAllies); //$ FETCHER:MULTI:NUM:Point 1886 1887 void (CALLING_CONV *Map_Point_getPosition)(int skirmishAIId, int pointId, float* return_posF3_out); 1888 1889 void (CALLING_CONV *Map_Point_getColor)(int skirmishAIId, int pointId, short* return_colorS3_out); 1890 1891 const char* (CALLING_CONV *Map_Point_getLabel)(int skirmishAIId, int pointId); 1892 1893 /** 1894 * Returns all lines drawn with this AIs team color, 1895 * and additionally the ones drawn with allied team colors, 1896 * if <code>includeAllies</code> is true. 1897 */ 1898 int (CALLING_CONV *Map_getLines)(int skirmishAIId, bool includeAllies); //$ FETCHER:MULTI:NUM:Line 1899 1900 void (CALLING_CONV *Map_Line_getFirstPosition)(int skirmishAIId, int lineId, float* return_posF3_out); 1901 1902 void (CALLING_CONV *Map_Line_getSecondPosition)(int skirmishAIId, int lineId, float* return_posF3_out); 1903 1904 void (CALLING_CONV *Map_Line_getColor)(int skirmishAIId, int lineId, short* return_colorS3_out); 1905 1906 bool (CALLING_CONV *Map_isPossibleToBuildAt)(int skirmishAIId, int unitDefId, float* pos_posF3, int facing); //$ REF:unitDefId->UnitDef 1907 1908 /** 1909 * Returns the closest position from a given position that a building can be 1910 * built at. 1911 * @param minDist the distance in 1/(SQUARE_SIZE * 2) = 1/16 of full map 1912 * resolution, that the building must keep to other 1913 * buildings; this makes it easier to keep free paths through 1914 * a base 1915 * @return actual map position with x, y and z all beeing positive, 1916 * or float[3]{-1, 0, 0} if no suitable position is found. 1917 */ 1918 void (CALLING_CONV *Map_findClosestBuildSite)(int skirmishAIId, int unitDefId, float* pos_posF3, float searchRadius, int minDist, int facing, float* return_posF3_out); //$ REF:unitDefId->UnitDef 1919 1920 // BEGINN OBJECT Map 1921 1922 1923 1924 // BEGINN OBJECT FeatureDef 1925 int (CALLING_CONV *getFeatureDefs)(int skirmishAIId, int* featureDefIds, int featureDefIds_sizeMax); //$ FETCHER:MULTI:IDs:FeatureDef:featureDefIds 1926 1927 // int (CALLING_CONV *FeatureDef_getId)(int skirmishAIId, int featureDefId); 1928 1929 const char* (CALLING_CONV *FeatureDef_getName)(int skirmishAIId, int featureDefId); 1930 1931 const char* (CALLING_CONV *FeatureDef_getDescription)(int skirmishAIId, int featureDefId); 1932 1933 const char* (CALLING_CONV *FeatureDef_getFileName)(int skirmishAIId, int featureDefId); 1934 1935 float (CALLING_CONV *FeatureDef_getContainedResource)(int skirmishAIId, int featureDefId, int resourceId); //$ REF:resourceId->Resource 1936 1937 float (CALLING_CONV *FeatureDef_getMaxHealth)(int skirmishAIId, int featureDefId); 1938 1939 float (CALLING_CONV *FeatureDef_getReclaimTime)(int skirmishAIId, int featureDefId); 1940 1941 /** Used to see if the object can be overrun by units of a certain heavyness */ 1942 float (CALLING_CONV *FeatureDef_getMass)(int skirmishAIId, int featureDefId); 1943 1944 bool (CALLING_CONV *FeatureDef_isUpright)(int skirmishAIId, int featureDefId); 1945 1946 int (CALLING_CONV *FeatureDef_getDrawType)(int skirmishAIId, int featureDefId); 1947 1948 const char* (CALLING_CONV *FeatureDef_getModelName)(int skirmishAIId, int featureDefId); 1949 1950 /** 1951 * Used to determine whether the feature is resurrectable. 1952 * 1953 * @return -1: (default) only if it is the 1st wreckage of 1954 * the UnitDef it originates from 1955 * 0: no, never 1956 * 1: yes, always 1957 */ 1958 int (CALLING_CONV *FeatureDef_getResurrectable)(int skirmishAIId, int featureDefId); 1959 1960 int (CALLING_CONV *FeatureDef_getSmokeTime)(int skirmishAIId, int featureDefId); 1961 1962 bool (CALLING_CONV *FeatureDef_isDestructable)(int skirmishAIId, int featureDefId); 1963 1964 bool (CALLING_CONV *FeatureDef_isReclaimable)(int skirmishAIId, int featureDefId); 1965 1966 bool (CALLING_CONV *FeatureDef_isBlocking)(int skirmishAIId, int featureDefId); 1967 1968 bool (CALLING_CONV *FeatureDef_isBurnable)(int skirmishAIId, int featureDefId); 1969 1970 bool (CALLING_CONV *FeatureDef_isFloating)(int skirmishAIId, int featureDefId); 1971 1972 bool (CALLING_CONV *FeatureDef_isNoSelect)(int skirmishAIId, int featureDefId); 1973 1974 bool (CALLING_CONV *FeatureDef_isGeoThermal)(int skirmishAIId, int featureDefId); 1975 1976 /** Name of the FeatureDef that this turns into when killed (not reclaimed). */ 1977 const char* (CALLING_CONV *FeatureDef_getDeathFeature)(int skirmishAIId, int featureDefId); 1978 1979 /** 1980 * Size of the feature along the X axis - in other words: height. 1981 * each size is 8 units 1982 */ 1983 int (CALLING_CONV *FeatureDef_getXSize)(int skirmishAIId, int featureDefId); 1984 1985 /** 1986 * Size of the feature along the Z axis - in other words: width. 1987 * each size is 8 units 1988 */ 1989 int (CALLING_CONV *FeatureDef_getZSize)(int skirmishAIId, int featureDefId); 1990 1991 int (CALLING_CONV *FeatureDef_getCustomParams)(int skirmishAIId, int featureDefId, const char** keys, const char** values); //$ MAP 1992 1993 // END OBJECT FeatureDef 1994 1995 1996 // BEGINN OBJECT Feature 1997 /** 1998 * Returns all features currently in LOS, or all features on the map 1999 * if cheating is enabled. 2000 */ 2001 int (CALLING_CONV *getFeatures)(int skirmishAIId, int* featureIds, int featureIds_sizeMax); //$ REF:MULTI:featureIds->Feature 2002 2003 /** 2004 * Returns all features in a specified area that are currently in LOS, 2005 * or all features in this area if cheating is enabled. 2006 */ 2007 int (CALLING_CONV *getFeaturesIn)(int skirmishAIId, float* pos_posF3, float radius, int* featureIds, int featureIds_sizeMax); //$ REF:MULTI:featureIds->Feature 2008 2009 int (CALLING_CONV *Feature_getDef)(int skirmishAIId, int featureId); //$ REF:RETURN->FeatureDef 2010 2011 float (CALLING_CONV *Feature_getHealth)(int skirmishAIId, int featureId); 2012 2013 float (CALLING_CONV *Feature_getReclaimLeft)(int skirmishAIId, int featureId); 2014 2015 void (CALLING_CONV *Feature_getPosition)(int skirmishAIId, int featureId, float* return_posF3_out); 2016 2017 // END OBJECT Feature 2018 2019 2020 2021 // BEGINN OBJECT WeaponDef 2022 int (CALLING_CONV *getWeaponDefs)(int skirmishAIId); //$ FETCHER:MULTI:NUM:WeaponDef 2023 2024 int (CALLING_CONV *getWeaponDefByName)(int skirmishAIId, const char* weaponDefName); //$ REF:RETURN->WeaponDef 2025 2026 const char* (CALLING_CONV *WeaponDef_getName)(int skirmishAIId, int weaponDefId); 2027 2028 const char* (CALLING_CONV *WeaponDef_getType)(int skirmishAIId, int weaponDefId); 2029 2030 const char* (CALLING_CONV *WeaponDef_getDescription)(int skirmishAIId, int weaponDefId); 2031 2032 const char* (CALLING_CONV *WeaponDef_getFileName)(int skirmishAIId, int weaponDefId); 2033 2034 const char* (CALLING_CONV *WeaponDef_getCegTag)(int skirmishAIId, int weaponDefId); 2035 2036 float (CALLING_CONV *WeaponDef_getRange)(int skirmishAIId, int weaponDefId); 2037 2038 float (CALLING_CONV *WeaponDef_getHeightMod)(int skirmishAIId, int weaponDefId); 2039 2040 /** Inaccuracy of whole burst */ 2041 float (CALLING_CONV *WeaponDef_getAccuracy)(int skirmishAIId, int weaponDefId); 2042 2043 /** Inaccuracy of individual shots inside burst */ 2044 float (CALLING_CONV *WeaponDef_getSprayAngle)(int skirmishAIId, int weaponDefId); 2045 2046 /** Inaccuracy while owner moving */ 2047 float (CALLING_CONV *WeaponDef_getMovingAccuracy)(int skirmishAIId, int weaponDefId); 2048 2049 /** Fraction of targets move speed that is used as error offset */ 2050 float (CALLING_CONV *WeaponDef_getTargetMoveError)(int skirmishAIId, int weaponDefId); 2051 2052 /** Maximum distance the weapon will lead the target */ 2053 float (CALLING_CONV *WeaponDef_getLeadLimit)(int skirmishAIId, int weaponDefId); 2054 2055 /** Factor for increasing the leadLimit with experience */ 2056 float (CALLING_CONV *WeaponDef_getLeadBonus)(int skirmishAIId, int weaponDefId); 2057 2058 /** Replaces hardcoded behaviour for burnblow cannons */ 2059 float (CALLING_CONV *WeaponDef_getPredictBoost)(int skirmishAIId, int weaponDefId); 2060 2061 // TODO: Deprecate the following function, if no longer needed by legacy Cpp AIs 2062 int (CALLING_CONV *WeaponDef_getNumDamageTypes)(int skirmishAIId); //$ STATIC 2063 2064 // DamageArray (CALLING_CONV *WeaponDef_getDamages)(int skirmishAIId, int weaponDefId); 2065 2066 int (CALLING_CONV *WeaponDef_Damage_getParalyzeDamageTime)(int skirmishAIId, int weaponDefId); 2067 2068 float (CALLING_CONV *WeaponDef_Damage_getImpulseFactor)(int skirmishAIId, int weaponDefId); 2069 2070 float (CALLING_CONV *WeaponDef_Damage_getImpulseBoost)(int skirmishAIId, int weaponDefId); 2071 2072 float (CALLING_CONV *WeaponDef_Damage_getCraterMult)(int skirmishAIId, int weaponDefId); 2073 2074 float (CALLING_CONV *WeaponDef_Damage_getCraterBoost)(int skirmishAIId, int weaponDefId); 2075 2076 // float (CALLING_CONV *WeaponDef_Damage_getType)(int skirmishAIId, int weaponDefId, int typeId); 2077 2078 int (CALLING_CONV *WeaponDef_Damage_getTypes)(int skirmishAIId, int weaponDefId, float* types, int types_sizeMax); //$ ARRAY:types 2079 2080 // int (CALLING_CONV *WeaponDef_getId)(int skirmishAIId, int weaponDefId); 2081 2082 float (CALLING_CONV *WeaponDef_getAreaOfEffect)(int skirmishAIId, int weaponDefId); 2083 2084 bool (CALLING_CONV *WeaponDef_isNoSelfDamage)(int skirmishAIId, int weaponDefId); 2085 2086 float (CALLING_CONV *WeaponDef_getFireStarter)(int skirmishAIId, int weaponDefId); 2087 2088 float (CALLING_CONV *WeaponDef_getEdgeEffectiveness)(int skirmishAIId, int weaponDefId); 2089 2090 float (CALLING_CONV *WeaponDef_getSize)(int skirmishAIId, int weaponDefId); 2091 2092 float (CALLING_CONV *WeaponDef_getSizeGrowth)(int skirmishAIId, int weaponDefId); 2093 2094 float (CALLING_CONV *WeaponDef_getCollisionSize)(int skirmishAIId, int weaponDefId); 2095 2096 int (CALLING_CONV *WeaponDef_getSalvoSize)(int skirmishAIId, int weaponDefId); 2097 2098 float (CALLING_CONV *WeaponDef_getSalvoDelay)(int skirmishAIId, int weaponDefId); 2099 2100 float (CALLING_CONV *WeaponDef_getReload)(int skirmishAIId, int weaponDefId); 2101 2102 float (CALLING_CONV *WeaponDef_getBeamTime)(int skirmishAIId, int weaponDefId); 2103 2104 bool (CALLING_CONV *WeaponDef_isBeamBurst)(int skirmishAIId, int weaponDefId); 2105 2106 bool (CALLING_CONV *WeaponDef_isWaterBounce)(int skirmishAIId, int weaponDefId); 2107 2108 bool (CALLING_CONV *WeaponDef_isGroundBounce)(int skirmishAIId, int weaponDefId); 2109 2110 float (CALLING_CONV *WeaponDef_getBounceRebound)(int skirmishAIId, int weaponDefId); 2111 2112 float (CALLING_CONV *WeaponDef_getBounceSlip)(int skirmishAIId, int weaponDefId); 2113 2114 int (CALLING_CONV *WeaponDef_getNumBounce)(int skirmishAIId, int weaponDefId); 2115 2116 float (CALLING_CONV *WeaponDef_getMaxAngle)(int skirmishAIId, int weaponDefId); 2117 2118 float (CALLING_CONV *WeaponDef_getUpTime)(int skirmishAIId, int weaponDefId); 2119 2120 int (CALLING_CONV *WeaponDef_getFlightTime)(int skirmishAIId, int weaponDefId); 2121 2122 float (CALLING_CONV *WeaponDef_getCost)(int skirmishAIId, int weaponDefId, int resourceId); //$ REF:resourceId->Resource 2123 2124 int (CALLING_CONV *WeaponDef_getProjectilesPerShot)(int skirmishAIId, int weaponDefId); 2125 2126 // /** The "id=" tag in the TDF */ 2127 // int (CALLING_CONV *WeaponDef_getTdfId)(int skirmishAIId, int weaponDefId); 2128 2129 bool (CALLING_CONV *WeaponDef_isTurret)(int skirmishAIId, int weaponDefId); 2130 2131 bool (CALLING_CONV *WeaponDef_isOnlyForward)(int skirmishAIId, int weaponDefId); 2132 2133 bool (CALLING_CONV *WeaponDef_isFixedLauncher)(int skirmishAIId, int weaponDefId); 2134 2135 bool (CALLING_CONV *WeaponDef_isWaterWeapon)(int skirmishAIId, int weaponDefId); 2136 2137 bool (CALLING_CONV *WeaponDef_isFireSubmersed)(int skirmishAIId, int weaponDefId); 2138 2139 /** Lets a torpedo travel above water like it does below water */ 2140 bool (CALLING_CONV *WeaponDef_isSubMissile)(int skirmishAIId, int weaponDefId); 2141 2142 bool (CALLING_CONV *WeaponDef_isTracks)(int skirmishAIId, int weaponDefId); 2143 2144 bool (CALLING_CONV *WeaponDef_isDropped)(int skirmishAIId, int weaponDefId); 2145 2146 /** The weapon will only paralyze, not do real damage. */ 2147 bool (CALLING_CONV *WeaponDef_isParalyzer)(int skirmishAIId, int weaponDefId); 2148 2149 /** The weapon damages by impacting, not by exploding. */ 2150 bool (CALLING_CONV *WeaponDef_isImpactOnly)(int skirmishAIId, int weaponDefId); 2151 2152 /** Can not target anything (for example: anti-nuke, D-Gun) */ 2153 bool (CALLING_CONV *WeaponDef_isNoAutoTarget)(int skirmishAIId, int weaponDefId); 2154 2155 /** Has to be fired manually (by the player or an AI, example: D-Gun) */ 2156 bool (CALLING_CONV *WeaponDef_isManualFire)(int skirmishAIId, int weaponDefId); 2157 2158 /** 2159 * Can intercept targetable weapons shots. 2160 * 2161 * example: anti-nuke 2162 * 2163 * @see getTargetable() 2164 */ 2165 int (CALLING_CONV *WeaponDef_getInterceptor)(int skirmishAIId, int weaponDefId); 2166 2167 /** 2168 * Shoots interceptable projectiles. 2169 * Shots can be intercepted by interceptors. 2170 * 2171 * example: nuke 2172 * 2173 * @see getInterceptor() 2174 */ 2175 int (CALLING_CONV *WeaponDef_getTargetable)(int skirmishAIId, int weaponDefId); 2176 2177 bool (CALLING_CONV *WeaponDef_isStockpileable)(int skirmishAIId, int weaponDefId); 2178 2179 /** 2180 * Range of interceptors. 2181 * 2182 * example: anti-nuke 2183 * 2184 * @see getInterceptor() 2185 */ 2186 float (CALLING_CONV *WeaponDef_getCoverageRange)(int skirmishAIId, int weaponDefId); 2187 2188 /** Build time of a missile */ 2189 float (CALLING_CONV *WeaponDef_getStockpileTime)(int skirmishAIId, int weaponDefId); 2190 2191 float (CALLING_CONV *WeaponDef_getIntensity)(int skirmishAIId, int weaponDefId); 2192 2193 /** @deprecated only relevant for visualization */ 2194 float (CALLING_CONV *WeaponDef_getThickness)(int skirmishAIId, int weaponDefId); 2195 2196 /** @deprecated only relevant for visualization */ 2197 float (CALLING_CONV *WeaponDef_getLaserFlareSize)(int skirmishAIId, int weaponDefId); 2198 2199 /** @deprecated only relevant for visualization */ 2200 float (CALLING_CONV *WeaponDef_getCoreThickness)(int skirmishAIId, int weaponDefId); 2201 2202 float (CALLING_CONV *WeaponDef_getDuration)(int skirmishAIId, int weaponDefId); 2203 2204 /** @deprecated only relevant for visualization */ 2205 int (CALLING_CONV *WeaponDef_getLodDistance)(int skirmishAIId, int weaponDefId); 2206 2207 float (CALLING_CONV *WeaponDef_getFalloffRate)(int skirmishAIId, int weaponDefId); 2208 2209 /** @deprecated only relevant for visualization */ 2210 int (CALLING_CONV *WeaponDef_getGraphicsType)(int skirmishAIId, int weaponDefId); 2211 2212 bool (CALLING_CONV *WeaponDef_isSoundTrigger)(int skirmishAIId, int weaponDefId); 2213 2214 bool (CALLING_CONV *WeaponDef_isSelfExplode)(int skirmishAIId, int weaponDefId); 2215 2216 bool (CALLING_CONV *WeaponDef_isGravityAffected)(int skirmishAIId, int weaponDefId); 2217 2218 /** 2219 * Per weapon high trajectory setting. 2220 * UnitDef also has this property. 2221 * 2222 * @return 0: low 2223 * 1: high 2224 * 2: unit 2225 */ 2226 int (CALLING_CONV *WeaponDef_getHighTrajectory)(int skirmishAIId, int weaponDefId); 2227 2228 float (CALLING_CONV *WeaponDef_getMyGravity)(int skirmishAIId, int weaponDefId); 2229 2230 bool (CALLING_CONV *WeaponDef_isNoExplode)(int skirmishAIId, int weaponDefId); 2231 2232 float (CALLING_CONV *WeaponDef_getStartVelocity)(int skirmishAIId, int weaponDefId); 2233 2234 float (CALLING_CONV *WeaponDef_getWeaponAcceleration)(int skirmishAIId, int weaponDefId); 2235 2236 float (CALLING_CONV *WeaponDef_getTurnRate)(int skirmishAIId, int weaponDefId); 2237 2238 float (CALLING_CONV *WeaponDef_getMaxVelocity)(int skirmishAIId, int weaponDefId); 2239 2240 float (CALLING_CONV *WeaponDef_getProjectileSpeed)(int skirmishAIId, int weaponDefId); 2241 2242 float (CALLING_CONV *WeaponDef_getExplosionSpeed)(int skirmishAIId, int weaponDefId); 2243 2244 /** 2245 * Returns the bit field value denoting the categories this weapon should 2246 * target, excluding all others. 2247 * @see Game#getCategoryFlag 2248 * @see Game#getCategoryName 2249 */ 2250 int (CALLING_CONV *WeaponDef_getOnlyTargetCategory)(int skirmishAIId, int weaponDefId); 2251 2252 /** How much the missile will wobble around its course. */ 2253 float (CALLING_CONV *WeaponDef_getWobble)(int skirmishAIId, int weaponDefId); 2254 2255 /** How much the missile will dance. */ 2256 float (CALLING_CONV *WeaponDef_getDance)(int skirmishAIId, int weaponDefId); 2257 2258 /** How high trajectory missiles will try to fly in. */ 2259 float (CALLING_CONV *WeaponDef_getTrajectoryHeight)(int skirmishAIId, int weaponDefId); 2260 2261 bool (CALLING_CONV *WeaponDef_isLargeBeamLaser)(int skirmishAIId, int weaponDefId); 2262 2263 /** If the weapon is a shield rather than a weapon. */ 2264 bool (CALLING_CONV *WeaponDef_isShield)(int skirmishAIId, int weaponDefId); 2265 2266 /** If the weapon should be repulsed or absorbed. */ 2267 bool (CALLING_CONV *WeaponDef_isShieldRepulser)(int skirmishAIId, int weaponDefId); 2268 2269 /** If the shield only affects enemy projectiles. */ 2270 bool (CALLING_CONV *WeaponDef_isSmartShield)(int skirmishAIId, int weaponDefId); 2271 2272 /** If the shield only affects stuff coming from outside shield radius. */ 2273 bool (CALLING_CONV *WeaponDef_isExteriorShield)(int skirmishAIId, int weaponDefId); 2274 2275 /** If the shield should be graphically shown. */ 2276 bool (CALLING_CONV *WeaponDef_isVisibleShield)(int skirmishAIId, int weaponDefId); 2277 2278 /** If a small graphic should be shown at each repulse. */ 2279 bool (CALLING_CONV *WeaponDef_isVisibleShieldRepulse)(int skirmishAIId, int weaponDefId); 2280 2281 /** The number of frames to draw the shield after it has been hit. */ 2282 int (CALLING_CONV *WeaponDef_getVisibleShieldHitFrames)(int skirmishAIId, int weaponDefId); 2283 2284 /** 2285 * Amount of the resource used per shot or per second, 2286 * depending on the type of projectile. 2287 */ 2288 float (CALLING_CONV *WeaponDef_Shield_getResourceUse)(int skirmishAIId, int weaponDefId, int resourceId); //$ REF:resourceId->Resource 2289 2290 /** Size of shield covered area */ 2291 float (CALLING_CONV *WeaponDef_Shield_getRadius)(int skirmishAIId, int weaponDefId); 2292 2293 /** 2294 * Shield acceleration on plasma stuff. 2295 * How much will plasma be accelerated into the other direction 2296 * when it hits the shield. 2297 */ 2298 float (CALLING_CONV *WeaponDef_Shield_getForce)(int skirmishAIId, int weaponDefId); 2299 2300 /** Maximum speed to which the shield can repulse plasma. */ 2301 float (CALLING_CONV *WeaponDef_Shield_getMaxSpeed)(int skirmishAIId, int weaponDefId); 2302 2303 /** Amount of damage the shield can reflect. (0=infinite) */ 2304 float (CALLING_CONV *WeaponDef_Shield_getPower)(int skirmishAIId, int weaponDefId); 2305 2306 /** Amount of power that is regenerated per second. */ 2307 float (CALLING_CONV *WeaponDef_Shield_getPowerRegen)(int skirmishAIId, int weaponDefId); 2308 2309 /** 2310 * How much of a given resource is needed to regenerate power 2311 * with max speed per second. 2312 */ 2313 float (CALLING_CONV *WeaponDef_Shield_getPowerRegenResource)(int skirmishAIId, int weaponDefId, int resourceId); //$ REF:resourceId->Resource 2314 2315 /** How much power the shield has when it is created. */ 2316 float (CALLING_CONV *WeaponDef_Shield_getStartingPower)(int skirmishAIId, int weaponDefId); 2317 2318 /** Number of frames to delay recharging by after each hit. */ 2319 int (CALLING_CONV *WeaponDef_Shield_getRechargeDelay)(int skirmishAIId, int weaponDefId); 2320 2321 /** The color of the shield when it is at full power. */ 2322 void (CALLING_CONV *WeaponDef_Shield_getGoodColor)(int skirmishAIId, int weaponDefId, short* return_colorS3_out); 2323 2324 /** The color of the shield when it is empty. */ 2325 void (CALLING_CONV *WeaponDef_Shield_getBadColor)(int skirmishAIId, int weaponDefId, short* return_colorS3_out); 2326 2327 /** The shields alpha value. */ 2328 short (CALLING_CONV *WeaponDef_Shield_getAlpha)(int skirmishAIId, int weaponDefId); 2329 2330 /** 2331 * The type of the shield (bitfield). 2332 * Defines what weapons can be intercepted by the shield. 2333 * 2334 * @see getInterceptedByShieldType() 2335 */ 2336 int (CALLING_CONV *WeaponDef_Shield_getInterceptType)(int skirmishAIId, int weaponDefId); 2337 2338 /** 2339 * The type of shields that can intercept this weapon (bitfield). 2340 * The weapon can be affected by shields if: 2341 * (shield.getInterceptType() & weapon.getInterceptedByShieldType()) != 0 2342 * 2343 * @see getInterceptType() 2344 */ 2345 int (CALLING_CONV *WeaponDef_getInterceptedByShieldType)(int skirmishAIId, int weaponDefId); 2346 2347 /** Tries to avoid friendly units while aiming? */ 2348 bool (CALLING_CONV *WeaponDef_isAvoidFriendly)(int skirmishAIId, int weaponDefId); 2349 2350 /** Tries to avoid features while aiming? */ 2351 bool (CALLING_CONV *WeaponDef_isAvoidFeature)(int skirmishAIId, int weaponDefId); 2352 2353 /** Tries to avoid neutral units while aiming? */ 2354 bool (CALLING_CONV *WeaponDef_isAvoidNeutral)(int skirmishAIId, int weaponDefId); 2355 2356 /** 2357 * If nonzero, targetting units will TryTarget at the edge of collision sphere 2358 * (radius*tag value, [-1;1]) instead of its centre. 2359 */ 2360 float (CALLING_CONV *WeaponDef_getTargetBorder)(int skirmishAIId, int weaponDefId); 2361 2362 /** 2363 * If greater than 0, the range will be checked in a cylinder 2364 * (height=range*cylinderTargetting) instead of a sphere. 2365 */ 2366 float (CALLING_CONV *WeaponDef_getCylinderTargetting)(int skirmishAIId, int weaponDefId); 2367 2368 /** 2369 * For beam-lasers only - always hit with some minimum intensity 2370 * (a damage coeffcient normally dependent on distance). 2371 * Do not confuse this with the intensity tag, it i completely unrelated. 2372 */ 2373 float (CALLING_CONV *WeaponDef_getMinIntensity)(int skirmishAIId, int weaponDefId); 2374 2375 /** 2376 * Controls cannon range height boost. 2377 * 2378 * default: -1: automatically calculate a more or less sane value 2379 */ 2380 float (CALLING_CONV *WeaponDef_getHeightBoostFactor)(int skirmishAIId, int weaponDefId); 2381 2382 /** Multiplier for the distance to the target for priority calculations. */ 2383 float (CALLING_CONV *WeaponDef_getProximityPriority)(int skirmishAIId, int weaponDefId); 2384 2385 int (CALLING_CONV *WeaponDef_getCollisionFlags)(int skirmishAIId, int weaponDefId); 2386 2387 bool (CALLING_CONV *WeaponDef_isSweepFire)(int skirmishAIId, int weaponDefId); 2388 2389 bool (CALLING_CONV *WeaponDef_isAbleToAttackGround)(int skirmishAIId, int weaponDefId); 2390 2391 float (CALLING_CONV *WeaponDef_getCameraShake)(int skirmishAIId, int weaponDefId); 2392 2393 float (CALLING_CONV *WeaponDef_getDynDamageExp)(int skirmishAIId, int weaponDefId); 2394 2395 float (CALLING_CONV *WeaponDef_getDynDamageMin)(int skirmishAIId, int weaponDefId); 2396 2397 float (CALLING_CONV *WeaponDef_getDynDamageRange)(int skirmishAIId, int weaponDefId); 2398 2399 bool (CALLING_CONV *WeaponDef_isDynDamageInverted)(int skirmishAIId, int weaponDefId); 2400 2401 int (CALLING_CONV *WeaponDef_getCustomParams)(int skirmishAIId, int weaponDefId, const char** keys, const char** values); //$ MAP 2402 2403 // END OBJECT WeaponDef 2404 2405 bool (CALLING_CONV *Debug_GraphDrawer_isEnabled)(int skirmishAIId); 2406 2407 }; 2408 2409 #if defined(__cplusplus) 2410 } // extern "C" 2411 #endif 2412 2413 #endif // S_SKIRMISH_AI_CALLBACK_H 2414