Public Member Functions | Private Attributes

ai::engine_lua Class Reference

#include <engine_lua.hpp>

Inheritance diagram for ai::engine_lua:
Inheritance graph
[legend]
Collaboration diagram for ai::engine_lua:
Collaboration graph
[legend]

List of all members.

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.
virtual ~engine_lua ()
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.
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.
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.
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 config to_config () const
 Serialize to config.

Private Attributes

std::string code_
 Method to inject AI context into the engine.
boost::shared_ptr< lua_ai_contextlua_ai_context_

Detailed Description

Definition at line 31 of file engine_lua.hpp.


Constructor & Destructor Documentation

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 173 of file engine_lua.cpp.

ai::engine_lua::~engine_lua (  )  [virtual]

Definition at line 186 of file engine_lua.cpp.


Member Function Documentation

void ai::engine_lua::do_parse_aspect_from_config ( const config cfg,
const std::string &  id,
std::back_insert_iterator< std::vector< aspect_ptr > >  b 
) [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 232 of file engine_lua.cpp.

void ai::engine_lua::do_parse_candidate_action_from_config ( rca_context context,
const config cfg,
std::back_insert_iterator< std::vector< candidate_action_ptr > >  b 
) [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 191 of file engine_lua.cpp.

void ai::engine_lua::do_parse_goal_from_config ( const config cfg,
std::back_insert_iterator< std::vector< goal_ptr > >  b 
) [virtual]

Reimplemented from ai::engine.

Definition at line 251 of file engine_lua.cpp.

void ai::engine_lua::do_parse_stage_from_config ( ai_context context,
const config cfg,
std::back_insert_iterator< std::vector< stage_ptr > >  b 
) [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 215 of file engine_lua.cpp.

std::string ai::engine_lua::evaluate ( const std::string &  str  )  [virtual]

Todo:
this is not mandatory, but if we want to allow lua to evaluate

Reimplemented from ai::engine.

Definition at line 270 of file engine_lua.cpp.

References ai::engine::ai_, DBG_AI_LUA, ERR_AI_LUA, and ai::side_context::get_side().

Here is the call graph for this function:

config ai::engine_lua::to_config (  )  const [virtual]

Serialize to config.

Reimplemented from ai::engine.

Definition at line 277 of file engine_lua.cpp.


Member Data Documentation

std::string ai::engine_lua::code_ [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 76 of file engine_lua.hpp.

boost::shared_ptr<lua_ai_context> ai::engine_lua::lua_ai_context_ [private]

Definition at line 79 of file engine_lua.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:18:26 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs