#include <engine_lua.hpp>
Public Member Functions | |
engine_lua (readonly_context &context, const config &cfg) | |
Note that initially we get access only to readonly context (engine is created rather early, when there's no way to move/attack. More... | |
virtual | ~engine_lua () |
bool | is_ok () const |
virtual void | do_parse_candidate_action_from_config (rca_context &context, const config &cfg, std::back_insert_iterator< std::vector< candidate_action_ptr > > b) |
Taka a config (with engine=lua in it) and parse several (usually, 1) candidate actions out of it. More... | |
virtual void | do_parse_stage_from_config (ai_context &context, const config &cfg, std::back_insert_iterator< std::vector< stage_ptr > > b) |
Taka a config (with engine=lua in it) and parse several (usually, 1) stages out of it. More... | |
virtual void | do_parse_aspect_from_config (const config &cfg, const std::string &id, std::back_insert_iterator< std::vector< aspect_ptr > > b) |
Taka a config (with engine=lua in it) and parse several (usually, 1) aspects out of it. More... | |
virtual void | do_parse_goal_from_config (const config &cfg, std::back_insert_iterator< std::vector< goal_ptr > > b) |
virtual std::string | evaluate (const std::string &str) |
virtual void | push_ai_table () |
Method that pushes the AI table of the lua_context on the stack for debugging purposes. More... | |
virtual config | to_config () const |
Serialize to config. More... | |
Public Member Functions inherited from ai::engine | |
engine (readonly_context &context, const config &cfg) | |
virtual | ~engine () |
virtual void | do_parse_engine_from_config (const config &cfg, std::back_insert_iterator< std::vector< engine_ptr > > b) |
readonly_context & | get_readonly_context () |
virtual void | set_ai_context (ai_context_ptr context) |
set ai context (which is not available during early initialization) More... | |
virtual ai_context_ptr | get_ai_context () |
virtual std::string | get_id () const |
virtual std::string | get_engine () const |
virtual std::string | get_name () const |
Public Member Functions inherited from ai::component | |
component () | |
virtual | ~component () |
virtual component * | get_child (const path_element &child) |
virtual std::vector< component * > | get_children (const std::string &type) |
virtual std::vector< std::string > | get_children_types () |
virtual bool | change_child (const path_element &child, const config &cfg) |
virtual bool | add_child (const path_element &child, const config &cfg) |
virtual bool | delete_child (const path_element &child) |
property_handler_map & | property_handlers () |
Private Member Functions | |
std::string | get_engine_code (const config &) const |
Private Attributes | |
std::string | code_ |
Method to inject AI context into the engine. More... | |
boost::shared_ptr< lua_ai_context > | lua_ai_context_ |
Additional Inherited Members | |
Static Public Member Functions inherited from ai::engine | |
static void | parse_aspect_from_config (readonly_context &context, const config &cfg, const std::string &id, std::back_insert_iterator< std::vector< aspect_ptr > > b) |
static void | parse_goal_from_config (readonly_context &context, const config &cfg, std::back_insert_iterator< std::vector< goal_ptr > > b) |
static void | parse_candidate_action_from_config (rca_context &context, const config &cfg, std::back_insert_iterator< std::vector< candidate_action_ptr > > b) |
static void | parse_engine_from_config (readonly_context &context, const config &cfg, std::back_insert_iterator< std::vector< engine_ptr > > b) |
static void | parse_stage_from_config (ai_context &context, const config &cfg, std::back_insert_iterator< std::vector< stage_ptr > > b) |
Protected Attributes inherited from ai::engine | |
readonly_context & | ai_ |
ai_context_ptr | ai_context_ |
std::string | engine_ |
name of the engine which has created this engine More... | |
std::string | id_ |
std::string | name_ |
Definition at line 30 of file engine_lua.hpp.
ai::engine_lua::engine_lua | ( | readonly_context & | context, |
const config & | cfg | ||
) |
Note that initially we get access only to readonly context (engine is created rather early, when there's no way to move/attack.
We inject full ai_context later.
Definition at line 251 of file engine_lua.cpp.
References config::child_or_empty(), lua_ai_context_, and ai::engine::name_.
|
virtual |
Definition at line 278 of file engine_lua.cpp.
|
virtual |
Taka a config (with engine=lua in it) and parse several (usually, 1) aspects out of it.
Reimplemented from ai::engine.
Definition at line 340 of file engine_lua.cpp.
References ai::engine::ai_, DBG_AI_LUA, ERR_AI_LUA, ai::lua_aspect_factory::get_list(), ai::side_context::get_side(), and lua_ai_context_.
|
virtual |
Taka a config (with engine=lua in it) and parse several (usually, 1) candidate actions out of it.
Reimplemented from ai::engine.
Definition at line 295 of file engine_lua.cpp.
References config::has_attribute(), and lua_ai_context_.
|
virtual |
Reimplemented from ai::engine.
Definition at line 359 of file engine_lua.cpp.
References ai::engine::ai_, DBG_AI_LUA, ERR_AI_LUA, ai::goal_factory::get_list(), ai::side_context::get_side(), and lua_ai_context_.
|
virtual |
Taka a config (with engine=lua in it) and parse several (usually, 1) stages out of it.
Reimplemented from ai::engine.
Definition at line 323 of file engine_lua.cpp.
References lua_ai_context_.
|
virtual |
Reimplemented from ai::engine.
Definition at line 378 of file engine_lua.cpp.
|
private |
Definition at line 268 of file engine_lua.cpp.
References config::has_attribute().
|
virtual |
Reimplemented from ai::engine.
Definition at line 282 of file engine_lua.cpp.
References lua_ai_context_.
|
virtual |
Method that pushes the AI table of the lua_context on the stack for debugging purposes.
Definition at line 287 of file engine_lua.cpp.
References game_config::debug, and lua_ai_context_.
Referenced by intf_debug_ai().
|
virtual |
Serialize to config.
Reimplemented from ai::engine.
Definition at line 385 of file engine_lua.cpp.
References config::add_child(), code_, ai::engine::get_id(), lua_ai_context_, and ai::engine::to_config().
Referenced by intf_debug_ai().
|
private |
Method to inject AI context into the engine.
The context includes all that in necessary for the AI - , like access to game state and movement/attack routines. The underlying lua code
Definition at line 84 of file engine_lua.hpp.
Referenced by to_config().
|
private |
Definition at line 87 of file engine_lua.hpp.
Referenced by do_parse_aspect_from_config(), do_parse_candidate_action_from_config(), do_parse_goal_from_config(), do_parse_stage_from_config(), engine_lua(), is_ok(), push_ai_table(), and to_config().