Public Member Functions | Private Member Functions

# AIInstance Class Reference

Runtime information about an AI like a pointer to the squirrel vm and the current state. More...

`#include <ai_instance.hpp>`

Inheritance diagram for AIInstance:

## Public Member Functions
void | Initialize (class AIInfo *info)
| Initialize the AI and prepare it for its first run.
int | GetSetting (const char *name)
| Get the value of a setting of the current instance.
ScriptInfo * | FindLibrary (const char *library, int version)
| Find a library.
## Private Member Functions
void | RegisterAPI ()
| Register all API functions to the VM.
void | Died ()
| Tell the script it died.
CommandCallback * | GetDoCommandCallback ()
| Get the callback handling DoCommands in case of networking.
void | LoadDummyScript ()
| Load the dummy script.

## Detailed Description

Runtime information about an AI like a pointer to the squirrel vm and the current state.

Definition at line 18 of file ai_instance.hpp.

## Member Function Documentation

ScriptInfo * AIInstance::FindLibrary | ( | const char * | library,
|  | int | version |
| ) |  |  | `[virtual]`

Find a library.

Parameters:

  | library | The library name to find.
  | version | The version the library should have.

Returns:
  The library if found, NULL otherwise.

Implements ScriptInstance.

Definition at line 227 of file ai_instance.cpp.

int AIInstance::GetSetting | ( | const char * | name | ) | `[virtual]`

Get the value of a setting of the current instance.

Parameters:

  | name | The name of the setting.

Returns:
  the value for the setting, or -1 if the setting is not known.

Implements ScriptInstance.

Definition at line 222 of file ai_instance.cpp.

References _current_company, AIConfig::GetConfig(), and AIConfig::GetSetting().

void AIInstance::Initialize | ( | class AIInfo * | info | ) |

Initialize the AI and prepare it for its first run.

Parameters:

  | info | The AI to create the instance of.

Definition at line 89 of file ai_instance.cpp.

References _current_company, ScriptInstance::engine, AIInfo::GetAPIVersion(), ScriptInfo::GetInstanceName(), ScriptInfo::GetMainScript(), and ScriptInstance::versionAPI.

Referenced by AI::StartNew().

The documentation for this class was generated from the following files:

- src/ai/ai_instance.hpp
- src/ai/ai_instance.cpp