#[repr(C)]pub struct SAIInterfaceCallback {Show 33 fields
pub Engine_AIInterface_ABIVersion_getFailPart: Option<unsafe extern "C" fn(interfaceId: c_int) -> c_int>,
pub Engine_AIInterface_ABIVersion_getWarningPart: Option<unsafe extern "C" fn(interfaceId: c_int) -> c_int>,
pub Engine_Version_getMajor: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>,
pub Engine_Version_getMinor: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>,
pub Engine_Version_getPatchset: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>,
pub Engine_Version_getCommits: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>,
pub Engine_Version_getHash: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>,
pub Engine_Version_getBranch: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>,
pub Engine_Version_getAdditional: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>,
pub Engine_Version_getBuildTime: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>,
pub Engine_Version_isRelease: Option<unsafe extern "C" fn(interfaceId: c_int) -> bool>,
pub Engine_Version_getNormal: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>,
pub Engine_Version_getSync: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>,
pub Engine_Version_getFull: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>,
pub AIInterface_Info_getSize: Option<unsafe extern "C" fn(interfaceId: c_int) -> c_int>,
pub AIInterface_Info_getKey: Option<unsafe extern "C" fn(interfaceId: c_int, infoIndex: c_int) -> *const c_char>,
pub AIInterface_Info_getValue: Option<unsafe extern "C" fn(interfaceId: c_int, infoIndex: c_int) -> *const c_char>,
pub AIInterface_Info_getDescription: Option<unsafe extern "C" fn(interfaceId: c_int, infoIndex: c_int) -> *const c_char>,
pub AIInterface_Info_getValueByKey: Option<unsafe extern "C" fn(interfaceId: c_int, key: *const c_char) -> *const c_char>,
pub getNumTeams: Option<unsafe extern "C" fn(interfaceId: c_int) -> c_int>,
pub getNumSkirmishAIs: Option<unsafe extern "C" fn(interfaceId: c_int) -> c_int>,
pub getMaxSkirmishAIs: Option<unsafe extern "C" fn(interfaceId: c_int) -> c_int>,
pub SkirmishAI_Info_getValueByKey: Option<unsafe extern "C" fn(interfaceId: c_int, shortName: *const c_char, version: *const c_char, key: *const c_char) -> *const c_char>,
pub Log_log: Option<unsafe extern "C" fn(interfaceId: c_int, msg: *const c_char)>,
pub Log_logsl: Option<unsafe extern "C" fn(interfaceId: c_int, section: *const c_char, loglevel: c_int, msg: *const c_char)>,
pub Log_exception: Option<unsafe extern "C" fn(interfaceId: c_int, msg: *const c_char, severety: c_int, die: bool)>,
pub DataDirs_getPathSeparator: Option<unsafe extern "C" fn(interfaceId: c_int) -> c_char>,
pub DataDirs_getConfigDir: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>,
pub DataDirs_getWriteableDir: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>,
pub DataDirs_locatePath: Option<unsafe extern "C" fn(interfaceId: c_int, path: *mut c_char, path_sizeMax: c_int, relPath: *const c_char, writeable: bool, create: bool, dir: bool, common: bool) -> bool>,
pub DataDirs_Roots_getSize: Option<unsafe extern "C" fn(interfaceId: c_int) -> c_int>,
pub DataDirs_Roots_getDir: Option<unsafe extern "C" fn(interfaceId: c_int, path: *mut c_char, path_sizeMax: c_int, dirIndex: c_int) -> bool>,
pub DataDirs_Roots_locatePath: Option<unsafe extern "C" fn(interfaceId: c_int, path: *mut c_char, path_sizeMax: c_int, relPath: *const c_char, writeable: bool, create: bool, dir: bool) -> bool>,
}
Expand description
AI Interface -> engine callback. Each AI Interface will receive an instance of this struct at initialization. The interfaceId passed as the first parameter to each function in this struct has to be the same as the one received by the interface, when it received the instance of this struct. @see SAIInterfaceLibrary
Fields§
§Engine_AIInterface_ABIVersion_getFailPart: Option<unsafe extern "C" fn(interfaceId: c_int) -> c_int>
Returns the Application Binary Interface version, fail part. If the engine and the AI INterface differ in this, the AI Interface will not be used. Changes here usually indicate that struct memebers were added or removed.
Engine_AIInterface_ABIVersion_getWarningPart: Option<unsafe extern "C" fn(interfaceId: c_int) -> c_int>
Returns the Application Binary Interface version, warning part. Interface and engine will try to run/work together, if they differ only in the warning part of the ABI version. Changes here could indicate that function arguments got changed, which could cause a crash, but it could be unimportant changes like added comments or code reformatting aswell.
Engine_Version_getMajor: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>
Returns the major engine revision number (e.g. 83)
Engine_Version_getMinor: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>
Minor version number (e.g. “5”) @deprecated since 4. October 2011 (pre release 83), will always return “0”
Engine_Version_getPatchset: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>
Clients that only differ in patchset can still play together. Also demos should be compatible between patchsets.
Engine_Version_getCommits: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>
SCM Commits version part (e.g. “” or “13”) Number of commits since the last version tag. This matches the regex “[0-9]*”.
Engine_Version_getHash: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>
SCM unique identifier for the current commit. This matches the regex “([0-9a-f]{6})?”.
Engine_Version_getBranch: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>
SCM branch name (e.g. “master” or “develop”)
Engine_Version_getAdditional: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>
Additional information (compiler flags, svn revision etc.)
Engine_Version_getBuildTime: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>
time of build
Engine_Version_isRelease: Option<unsafe extern "C" fn(interfaceId: c_int) -> bool>
Returns whether this is a release build of the engine
Engine_Version_getNormal: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>
The basic part of a spring version. This may only be used for sync-checking if IsRelease() returns true. @return “Major.PatchSet” or “Major.PatchSet.1”
Engine_Version_getSync: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>
The sync relevant part of a spring version. This may be used for sync-checking through a simple string-equality test. @return “Major” or “Major.PatchSet.1-Commits-gHash Branch”
Engine_Version_getFull: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>
The verbose, human readable version. @return “Major.Patchset[.1-Commits-gHash Branch] (Additional)”
AIInterface_Info_getSize: Option<unsafe extern "C" fn(interfaceId: c_int) -> c_int>
Returns the number of info key-value pairs in the info map for this interface.
AIInterface_Info_getKey: Option<unsafe extern "C" fn(interfaceId: c_int, infoIndex: c_int) -> *const c_char>
Returns the key at index infoIndex in the info map for this interface, or NULL if the infoIndex is invalid.
AIInterface_Info_getValue: Option<unsafe extern "C" fn(interfaceId: c_int, infoIndex: c_int) -> *const c_char>
Returns the value at index infoIndex in the info map for this interface, or NULL if the infoIndex is invalid.
AIInterface_Info_getDescription: Option<unsafe extern "C" fn(interfaceId: c_int, infoIndex: c_int) -> *const c_char>
Returns the description of the key at index infoIndex in the info map for this interface, or NULL if the infoIndex is invalid.
AIInterface_Info_getValueByKey: Option<unsafe extern "C" fn(interfaceId: c_int, key: *const c_char) -> *const c_char>
Returns the value associated with the given key in the info map for this interface, or NULL if not found.
getNumTeams: Option<unsafe extern "C" fn(interfaceId: c_int) -> c_int>
the number of teams in this game
getNumSkirmishAIs: Option<unsafe extern "C" fn(interfaceId: c_int) -> c_int>
the number of skirmish AIs in this game
getMaxSkirmishAIs: Option<unsafe extern "C" fn(interfaceId: c_int) -> c_int>
the maximum number of skirmish AIs in any game
SkirmishAI_Info_getValueByKey: Option<unsafe extern "C" fn(interfaceId: c_int, shortName: *const c_char, version: *const c_char, key: *const c_char) -> *const c_char>
Returns the value accosiated to the given key from the skirmish AIs info map
Log_log: Option<unsafe extern "C" fn(interfaceId: c_int, msg: *const c_char)>
This will end up in infolog
Log_logsl: Option<unsafe extern "C" fn(interfaceId: c_int, section: *const c_char, loglevel: c_int, msg: *const c_char)>
This will end up in infolog
Log_exception: Option<unsafe extern "C" fn(interfaceId: c_int, msg: *const c_char, severety: c_int, die: bool)>
Inform the engine of an error that happend in the interface. @param msg error message @param severety from 10 for minor to 0 for fatal @param die if this is set to true, the engine assumes the interface is in an irreparable state, and it will unload it immediately.
DataDirs_getPathSeparator: Option<unsafe extern "C" fn(interfaceId: c_int) -> c_char>
Basically returns ‘/’ on posix and ‘\’ on windows
DataDirs_getConfigDir: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>
This interfaces main data dir, which is where the shared library and the InterfaceInfo.lua file are located, e.g.: /usr/share/games/spring/AI/Interfaces/C/0.1/
DataDirs_getWriteableDir: Option<unsafe extern "C" fn(interfaceId: c_int) -> *const c_char>
This interfaces writable data dir, which is where eg logs, caches and learning data should be stored, e.g.: /home/userX/.spring/AI/Interfaces/C/0.1/
DataDirs_locatePath: Option<unsafe extern "C" fn(interfaceId: c_int, path: *mut c_char, path_sizeMax: c_int, relPath: *const c_char, writeable: bool, create: bool, dir: bool, common: bool) -> bool>
Returns an absolute path which consists of: data-dir + AI-Interface-path + relative-path.
example: input: “log/main.log”, writeable, create, !dir, !common output: “/home/userX/.spring/AI/Interfaces/C/0.1/log/main.log” The path “/home/userX/.spring/AI/Interfaces/C/0.1/log/” is created, if it does not yet exist.
@see DataDirs_Roots_locatePath @param path store for the resulting absolute path @param path_sizeMax storage size of the above @param writeable if true, only the writable data-dir is considered @param create if true, and realPath is not found, its dir structure is created recursively under the writable data-dir @param dir if true, realPath specifies a dir, which means if create is true, the whole path will be created, including the last part @param common if true, the version independent data-dir is formed, which uses “common” instead of the version, eg: “/home/userX/.spring/AI/Interfaces/C/common/…” @return whether the locating process was successfull -> the path exists and is stored in an absolute form in path
DataDirs_Roots_getSize: Option<unsafe extern "C" fn(interfaceId: c_int) -> c_int>
Returns the number of springs data dirs.
DataDirs_Roots_getDir: Option<unsafe extern "C" fn(interfaceId: c_int, path: *mut c_char, path_sizeMax: c_int, dirIndex: c_int) -> bool>
Returns the data dir at dirIndex, which is valid between 0 and (DataDirs_Roots_getSize() - 1).
DataDirs_Roots_locatePath: Option<unsafe extern "C" fn(interfaceId: c_int, path: *mut c_char, path_sizeMax: c_int, relPath: *const c_char, writeable: bool, create: bool, dir: bool) -> bool>
Returns an absolute path which consists of: data-dir + relative-path.
example: input: “AI/Skirmish”, writeable, create, dir output: “/home/userX/.spring/AI/Skirmish/” The path “/home/userX/.spring/AI/Skirmish/” is created, if it does not yet exist.
@see DataDirs_locatePath @param path store for the resulting absolute path @param path_sizeMax storage size of the above @param relPath the relative path to find @param writeable if true, only the writable data-dir is considered @param create if true, and realPath is not found, its dir structure is created recursively under the writable data-dir @param dir if true, realPath specifies a dir, which means if create is true, the whole path will be created, including the last part @return whether the locating process was successfull -> the path exists and is stored in an absolute form in path
Trait Implementations§
Source§impl Clone for SAIInterfaceCallback
impl Clone for SAIInterfaceCallback
Source§fn clone(&self) -> SAIInterfaceCallback
fn clone(&self) -> SAIInterfaceCallback
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more