The Battle for Wesnoth  1.19.5+dev
Namespaces | Macros | Functions | Variables
core.cpp File Reference

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

#include <cstring>
#include "ai/lua/core.hpp"
#include "ai/composite/aspect.hpp"
#include "scripting/lua_unit.hpp"
#include "scripting/push_check.hpp"
#include "ai/lua/lua_object.hpp"
#include "log.hpp"
#include "pathfind/pathfind.hpp"
#include "play_controller.hpp"
#include "resources.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 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)
 

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_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_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_list (lua_State *L)
 
static int ai::impl_ai_aspect_set (lua_State *L)
 
static int ai::impl_ai_get (lua_State *L)
 
static int ai::impl_ai_list (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"
 
static luaL_Reg const ai::mutating_callbacks []
 

Detailed Description

Provides core classes for the Lua AI.

Definition in file core.cpp.

Macro Definition Documentation

◆ ERR_LUA

#define ERR_LUA   LOG_STREAM(err, log_ai_engine_lua)

Definition at line 45 of file core.cpp.

◆ LOG_LUA

#define LOG_LUA   LOG_STREAM(info, log_ai_engine_lua)

Definition at line 43 of file core.cpp.

◆ WRN_LUA

#define WRN_LUA   LOG_STREAM(warn, log_ai_engine_lua)

Definition at line 44 of file core.cpp.

Variable Documentation

◆ aisKey

char const aisKey[] = "ai contexts"
static

◆ log_ai_engine_lua

lg::log_domain log_ai_engine_lua("ai/engine/lua") ( "ai/engine/lua"  )
static