The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Namespaces | Macros | Functions | Variables
core.cpp File Reference

Provides core classes for the Lua AI. More...

#include <cassert>
#include <cstring>
#include "ai/lua/core.hpp"
#include "ai/composite/aspect.hpp"
#include "scripting/game_lua_kernel.hpp"
#include "scripting/lua_unit.hpp"
#include "scripting/push_check.hpp"
#include "ai/lua/lua_object.hpp"
#include "attack_prediction.hpp"
#include "game_display.hpp"
#include "log.hpp"
#include "map/map.hpp"
#include "pathfind/pathfind.hpp"
#include "play_controller.hpp"
#include "resources.hpp"
#include "terrain/translation.hpp"
#include "terrain/filter.hpp"
#include "units/unit.hpp"
#include "ai/actions.hpp"
#include "ai/lua/engine_lua.hpp"
#include "ai/composite/contexts.hpp"
#include "ai/default/aspect_attacks.hpp"
#include "lua/lualib.h"
#include "lua/lauxlib.h"
#include "lua/llimits.h"
Include dependency graph for core.cpp:

Go to the source code of this file.

Namespaces

 ai
 A small explanation about what's going on here: Each action has access to two game_info objects First is 'info' - real information Second is 'subjective info' - AIs perception of what's going on So, when we check_before action, we use 'subjective info' and don't touch real 'info' at all.
 

Macros

#define LOG_LUA   LOG_STREAM(info, log_ai_engine_lua)
 
#define WRN_LUA   LOG_STREAM(warn, log_ai_engine_lua)
 
#define ERR_LUA   LOG_STREAM(err, log_ai_engine_lua)
 
#define DEPRECATED_ASPECT_MESSAGE(name)   WRN_LUA << "ai.get_" name "() is deprecated, use ai.aspects." name " instead\n"
 

Functions

static void ai::push_attack_analysis (lua_State *L, const attack_analysis &)
 
static ai::engine_luaai::get_engine (lua_State *L)
 
static ai::readonly_contextai::get_readonly_context (lua_State *L)
 
static int ai::transform_ai_action (lua_State *L, ai::action_result_ptr action_result)
 
static int ai::cfun_ai_get_suitable_keep (lua_State *L)
 
static int ai::ai_move (lua_State *L, bool exec, bool remove_movement)
 
static int ai::cfun_ai_execute_move_full (lua_State *L)
 
static int ai::cfun_ai_execute_move_partial (lua_State *L)
 
static int ai::cfun_ai_check_move (lua_State *L)
 
static int ai::ai_attack (lua_State *L, bool exec)
 
static int ai::cfun_ai_execute_attack (lua_State *L)
 
static int ai::cfun_ai_check_attack (lua_State *L)
 
static int ai::ai_stopunit_select (lua_State *L, bool exec, bool remove_movement, bool remove_attacks)
 
static int ai::cfun_ai_execute_stopunit_moves (lua_State *L)
 
static int ai::cfun_ai_execute_stopunit_attacks (lua_State *L)
 
static int ai::cfun_ai_execute_stopunit_all (lua_State *L)
 
static int ai::cfun_ai_check_stopunit (lua_State *L)
 
static int ai::ai_synced_command (lua_State *L, bool exec)
 
static int ai::cfun_ai_execute_synced_command (lua_State *L)
 
static int ai::cfun_ai_check_synced_command (lua_State *L)
 
static int ai::ai_recruit (lua_State *L, bool exec)
 
static int ai::cfun_ai_execute_recruit (lua_State *L)
 
static int ai::cfun_ai_check_recruit (lua_State *L)
 
static int ai::ai_recall (lua_State *L, bool exec)
 
static int ai::cfun_ai_execute_recall (lua_State *L)
 
static int ai::cfun_ai_check_recall (lua_State *L)
 
static int ai::cfun_ai_fallback_human (lua_State *)
 
static int ai::cfun_ai_get_targets (lua_State *L)
 
static int ai::cfun_ai_get_aggression (lua_State *L)
 
static int ai::cfun_ai_get_attack_depth (lua_State *L)
 
static int ai::cfun_ai_get_attacks (lua_State *L)
 
static int ai::cfun_ai_get_avoid (lua_State *L)
 
static int ai::cfun_ai_get_caution (lua_State *L)
 
static int ai::cfun_ai_get_grouping (lua_State *L)
 
static int ai::cfun_ai_get_leader_aggression (lua_State *L)
 
static int ai::cfun_ai_get_leader_goal (lua_State *L)
 
static int ai::cfun_ai_get_leader_ignores_keep (lua_State *L)
 
static int ai::cfun_ai_get_leader_value (lua_State *L)
 
static int ai::cfun_ai_get_passive_leader (lua_State *L)
 
static int ai::cfun_ai_get_passive_leader_shares_keep (lua_State *L)
 
static int ai::cfun_ai_get_recruitment_pattern (lua_State *L)
 
static int ai::cfun_ai_get_scout_village_targeting (lua_State *L)
 
static int ai::cfun_ai_get_simple_targeting (lua_State *L)
 
static int ai::cfun_ai_get_support_villages (lua_State *L)
 
static int ai::cfun_ai_get_village_value (lua_State *L)
 
static int ai::cfun_ai_get_villages_per_scout (lua_State *L)
 
static int ai::cfun_attack_rating (lua_State *L)
 
static void ai::push_movements (lua_State *L, const std::vector< std::pair< map_location, map_location > > &moves)
 
static void ai::push_move_map (lua_State *L, const move_map &m)
 
static int ai::cfun_ai_get_dstsrc (lua_State *L)
 
static int ai::cfun_ai_get_srcdst (lua_State *L)
 
static int ai::cfun_ai_get_enemy_dstsrc (lua_State *L)
 
static int ai::cfun_ai_get_enemy_srcdst (lua_State *L)
 
static int ai::cfun_ai_is_dst_src_valid (lua_State *L)
 
static int ai::cfun_ai_is_dst_src_enemy_valid (lua_State *L)
 
static int ai::cfun_ai_is_src_dst_valid (lua_State *L)
 
static int ai::cfun_ai_is_src_dst_enemy_valid (lua_State *L)
 
static int ai::cfun_ai_recalculate_move_maps (lua_State *L)
 
static int ai::cfun_ai_recalculate_move_maps_enemy (lua_State *L)
 
template<typename T >
typesafe_aspect< T > * ai::try_aspect_as (aspect_ptr p)
 
static int ai::impl_ai_aspect_get (lua_State *L)
 
static int ai::impl_ai_aspect_set (lua_State *L)
 
static int ai::impl_ai_get (lua_State *L)
 
static void ai::generate_and_push_ai_table (lua_State *L, ai::engine_lua *engine)
 
static size_t ai::generate_and_push_ai_state (lua_State *L, ai::engine_lua *engine)
 

Variables

static lg::log_domain log_ai_engine_lua ("ai/engine/lua")
 
static char const aisKey [] = "ai contexts"
 

Detailed Description

Provides core classes for the Lua AI.

Definition in file core.cpp.

Macro Definition Documentation

#define DEPRECATED_ASPECT_MESSAGE (   name)    WRN_LUA << "ai.get_" name "() is deprecated, use ai.aspects." name " instead\n"
#define ERR_LUA   LOG_STREAM(err, log_ai_engine_lua)

Definition at line 53 of file core.cpp.

Referenced by ai::lua_ai_context::create(), and ai::lua_ai_action_handler::create().

#define LOG_LUA   LOG_STREAM(info, log_ai_engine_lua)

Definition at line 51 of file core.cpp.

#define WRN_LUA   LOG_STREAM(warn, log_ai_engine_lua)

Definition at line 52 of file core.cpp.

Variable Documentation

char const aisKey[] = "ai contexts"
static
lg::log_domain log_ai_engine_lua("ai/engine/lua")
static