Struct SAIInterfaceLibrary

Source
#[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

Source§

fn clone(&self) -> SAIInterfaceLibrary

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SAIInterfaceLibrary

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for SAIInterfaceLibrary

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.