#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) |
| void | apply_micro_ai (const config &cfg) |
| 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_aspect_from_config (const config &cfg, const std::string &id, std::back_insert_iterator< std::vector< aspect_ptr >> b) |
| virtual void | do_parse_candidate_action_from_config (rca_context &context, const config &cfg, std::back_insert_iterator< std::vector< candidate_action_ptr >> b) |
| virtual void | do_parse_goal_from_config (const config &cfg, std::back_insert_iterator< std::vector< goal_ptr >> b) |
| virtual void | do_parse_engine_from_config (const config &cfg, std::back_insert_iterator< std::vector< engine_ptr >> b) |
| virtual void | do_parse_stage_from_config (ai_context &context, const config &cfg, std::back_insert_iterator< std::vector< stage_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) const |
| virtual std::vector< component * > | get_children (const std::string &type) const |
| virtual std::vector< std::string > | get_children_types () const |
| 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_ |
| The underlying lua code. More... | |
| std::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 262 of file engine_lua.cpp.
References cfg, config::child_or_empty(), data, lua_ai_context_, and ai::engine::name_.
|
virtual |
Definition at line 289 of file engine_lua.cpp.
| void ai::engine_lua::apply_micro_ai | ( | const config & | cfg | ) |
Definition at line 380 of file engine_lua.cpp.
References cfg, and lua_ai_context_.
|
virtual |
Taka a config (with engine=lua in it) and parse several (usually, 1) aspects out of it.
Definition at line 343 of file engine_lua.cpp.
References ai::engine::ai_, b, cfg, DBG_AI_LUA, ERR_AI_LUA, f, 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.
Definition at line 306 of file engine_lua.cpp.
References b, cfg, config::has_attribute(), and lua_ai_context_.
|
virtual |
Definition at line 362 of file engine_lua.cpp.
References ai::engine::ai_, b, cfg, DBG_AI_LUA, ERR_AI_LUA, f, 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.
Definition at line 331 of file engine_lua.cpp.
References b, cfg, and lua_ai_context_.
|
private |
Definition at line 279 of file engine_lua.cpp.
References cfg, and config::has_attribute().
|
virtual |
Reimplemented from ai::engine.
Definition at line 293 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 298 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(), cfg, code_, data, ai::engine::get_id(), lua_ai_context_, and ai::engine::to_config().
Referenced by intf_debug_ai().
|
private |
|
private |
Definition at line 87 of file engine_lua.hpp.
Referenced by apply_micro_ai(), 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().