#[repr(C)]pub struct SAIInterfaceLibrary {
pub initStatic: Option<unsafe extern "C" fn(interfaceId: c_int, arg1: *const SAIInterfaceCallback) -> c_int>,
pub releaseStatic: Option<unsafe extern "C" fn() -> c_int>,
pub loadSkirmishAILibrary: Option<unsafe extern "C" fn(shortName: *const c_char, version: *const c_char) -> *const SSkirmishAILibrary>,
pub unloadSkirmishAILibrary: Option<unsafe extern "C" fn(shortName: *const c_char, version: *const c_char) -> c_int>,
pub unloadAllSkirmishAILibraries: Option<unsafe extern "C" fn() -> c_int>,
pub listSkirmishAILibraries: Option<unsafe extern "C" fn(interfaceId: c_int) -> c_int>,
pub listSkirmishAILibraryInfos: Option<unsafe extern "C" fn(interfaceId: c_int, aiIndex: c_int) -> c_int>,
pub listSkirmishAILibraryInfoKey: Option<unsafe extern "C" fn(interfaceId: c_int, aiIndex: c_int, infoIndex: c_int) -> *const c_char>,
pub listSkirmishAILibraryInfoValue: Option<unsafe extern "C" fn(interfaceId: c_int, aiIndex: c_int, infoIndex: c_int) -> *const c_char>,
pub listSkirmishAILibraryOptions: Option<unsafe extern "C" fn(interfaceId: c_int, aiIndex: c_int) -> *const c_char>,
}
Expand description
@brief Artificial Intelligence Interface library interface
This is the interface between the engine and an implementation of an AI Interface. The engine will address AI Interfaces through this interface, but AI Interfaces will not actually implement it. It is the job of the engine, to make sure it can address AI Interface implementations through instances of this struct.
An example of loading the C AI Interface: The C AI Interface library exports functions fitting the function pointers in this struct. When the engine needs therefore C AI Interface, it loads the shared library, eg C-AI-Interface.dll, creates a new instance of this struct, and sets the member function pointers to the addresses of the fitting functions exported by the shared library. The functions of the AI Interface are then allways called through this struct.
Fields§
§initStatic: Option<unsafe extern "C" fn(interfaceId: c_int, arg1: *const SAIInterfaceCallback) -> c_int>
This function is called right after the library is dynamically loaded. It can be used to initialize variables and to check or prepare the environment (os, engine, filesystem, …). @see releaseStatic()
[optional] An AI Interface not exporting this function is still valid.
@param staticGlobalData contains global data about the engine and the environment; is guaranteed to be valid till releaseStatic() is called. @return 0: ok != 0: error
releaseStatic: Option<unsafe extern "C" fn() -> c_int>
This function is called right right before the library is unloaded. It can be used to deinitialize variables and to cleanup the environment, for example the filesystem.
See also initStatic().
[optional] An AI Interface not exporting this function is still valid.
@return 0: ok != 0: error
loadSkirmishAILibrary: Option<unsafe extern "C" fn(shortName: *const c_char, version: *const c_char) -> *const SSkirmishAILibrary>
Loads the specified Skirmish AI.
@return 0: ok != 0: error
unloadSkirmishAILibrary: Option<unsafe extern "C" fn(shortName: *const c_char, version: *const c_char) -> c_int>
Unloads the specified Skirmish AI.
@return 0: ok != 0: error
unloadAllSkirmishAILibraries: Option<unsafe extern "C" fn() -> c_int>
Unloads all Skirmish AI libraries currently loaded by this interface.
@return 0: ok != 0: error
listSkirmishAILibraries: Option<unsafe extern "C" fn(interfaceId: c_int) -> c_int>
Dynamic Skirmish AI library lookup system entry method. This system works as an alternative/addition to AIInfo.lua and AIOptions.lua files.
[optional] An AI Interface not exporting this function is still valid.
@see AI_INTERFACE_PROPERTY_SUPPORTS_LOOKUP @see listSkirmishAILibraryInfos @see listSkirmishAILibraryOptions @return the number of Skirmish AI libraries available through this interface through the dynamic lookup system
listSkirmishAILibraryInfos: Option<unsafe extern "C" fn(interfaceId: c_int, aiIndex: c_int) -> c_int>
Returns the number of info key-value pairs for a certain Skirmish AI library.
[optional] An AI Interface not exporting this function is still valid.
@see listSkirmishAILibraries @see listSkirmishAILibraryInfoKey @see listSkirmishAILibraryInfoValue @return the number of info key-value pairs for a certain Skirmish AI library.
listSkirmishAILibraryInfoKey: Option<unsafe extern "C" fn(interfaceId: c_int, aiIndex: c_int, infoIndex: c_int) -> *const c_char>
Returns the key of an info item for a certain Skirmish AI library.
[optional] An AI Interface not exporting this function is still valid.
@see listSkirmishAILibraryInfos @see listSkirmishAILibraryInfoValue @return the key of an info item for a certain Skirmish AI library.
listSkirmishAILibraryInfoValue: Option<unsafe extern "C" fn(interfaceId: c_int, aiIndex: c_int, infoIndex: c_int) -> *const c_char>
Returns the value of an info item for a certain Skirmish AI library.
[optional] An AI Interface not exporting this function is still valid.
@see listSkirmishAILibraryInfos @see listSkirmishAILibraryInfoKey @return the value of an info item for a certain Skirmish AI library.
listSkirmishAILibraryOptions: Option<unsafe extern "C" fn(interfaceId: c_int, aiIndex: c_int) -> *const c_char>
Returns a string consisting of Lua code, that returns an options table.
[optional] An AI Interface not exporting this function is still valid.
@see listSkirmishAILibraries @return NULL for no options, otherwise a string consisting of Lua code that returns an options table
Trait Implementations§
Source§impl Clone for SAIInterfaceLibrary
impl Clone for SAIInterfaceLibrary
Source§fn clone(&self) -> SAIInterfaceLibrary
fn clone(&self) -> SAIInterfaceLibrary
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more