#include <game_lua_kernel.hpp>
Public Member Functions | |
game_board & | board () |
std::vector< team > & | teams () |
const gamemap & | map () const |
game_display * | get_display () const |
game_lua_kernel (game_state &, play_controller &, reports &) | |
void | set_game_display (game_display *gd) |
virtual std::string | my_name () override |
User-visible name of the lua kernel that they are talking to. More... | |
std::string | apply_effect (const std::string &name, unit &u, const config &cfg, bool need_apply) |
void | initialize (const config &level) |
void | save_game (config &level) |
Executes the game_events.on_save function and adds to cfg the returned tags. More... | |
void | load_game (const config &level) |
Executes the game_events.on_load function and passes to it all the scenario tags not yet handled. More... | |
bool | run_event (const game_events::queued_event &) |
Executes the game_events.on_event function. More... | |
void | custom_command (const std::string &, const config &) |
void | push_builtin_effect () |
Registers a function for use as an effect handler. More... | |
void | set_wml_action (const std::string &, game_events::wml_action::handler) |
Registers a function for use as an action handler. More... | |
void | set_wml_condition (const std::string &, bool(*)(const vconfig &)) |
Registers a function for use as a conditional handler. More... | |
bool | run_wml_action (const std::string &, const vconfig &, const game_events::queued_event &) |
Runs a command from an event handler. More... | |
bool | run_filter (char const *name, const unit &u) |
Runs a script from a unit filter. More... | |
bool | run_filter (char const *name, const map_location &l) |
Runs a script from a location filter. More... | |
bool | run_filter (char const *name, const team &t) |
Runs a script from a location filter. More... | |
bool | run_filter (char const *name, int nArgs) |
Runs a script from a filter. More... | |
bool | run_wml_conditional (const std::string &, const vconfig &) |
Evaluates a WML conidition. More... | |
int | save_wml_event () |
Store a WML event in the Lua registry, as a function. More... | |
int | save_wml_event (const std::string &name, const std::string &id, const std::string &code) |
Store a WML event in the Lua registry, as a function. More... | |
int | save_wml_event (int idx) |
Store a WML event in the Lua registry, as a function. More... | |
void | clear_wml_event (int ref) |
Clear a WML event store in the Lua registry. More... | |
bool | run_wml_event (int ref, const vconfig &args, const game_events::queued_event &ev, bool *out=nullptr) |
Run a WML stored in the Lua registry. More... | |
virtual void | log_error (char const *msg, char const *context="Lua error") override |
Error reporting mechanisms, used by virtual methods protected_call and load_string. More... | |
ai::lua_ai_context * | create_lua_ai_context (char const *code, ai::engine_lua *engine) |
ai::lua_ai_action_handler * | create_lua_ai_action_handler (char const *code, ai::lua_ai_context &context) |
void | mouse_over_hex_callback (const map_location &loc) |
bool | mouse_button_callback (const map_location &loc, const std::string &button, const std::string &event) |
void | select_hex_callback (const map_location &loc) |
void | preload_finished () |
![]() | |
lua_kernel_base () | |
virtual | ~lua_kernel_base () |
void | run_lua_tag (const config &cfg) |
Runs a [lua] tag. More... | |
void | run (char const *prog, const std::string &name, int nArgs=0) |
Runs a plain script. More... | |
void | throwing_run (char const *prog, const std::string &name, int nArgs, bool in_interpreter=false) |
Runs a plain script, but reports errors by throwing lua_error. More... | |
void | interactive_run (char const *prog) |
Tests if a program resolves to an expression, and pretty prints it if it is, otherwise it runs it normally. More... | |
void | load_package () |
Loads the package library into lua environment. More... | |
void | load_core () |
Loads the "core" library into the Lua environment. More... | |
std::vector< std::string > | get_global_var_names () |
Get tab completion strings. More... | |
std::vector< std::string > | get_attribute_names (const std::string &var_path) |
Gets all attribute names of an extended variable name. More... | |
const std::stringstream & | get_log () |
Access / manipulate logging of lua kernel activities. More... | |
void | add_log (const char *str) |
void | clear_log () |
void | set_external_log (external_log_type lg) |
virtual void | throw_exception (char const *msg, char const *context="Lua error") |
virtual uint32_t | get_random_seed () |
lua_State * | get_state () |
void | add_widget_definition (const std::string &type, const std::string &id) |
void | add_log_to_console (const std::string &msg) |
int | intf_show_lua_console (lua_State *L) |
Public Attributes | |
int | map_locked_ |
A value != 0 means that the shouldn't remove any units from the map, usually because we are currently operating on a unit& and removing it might cause memory corruptions note that we don't check for the dtor of lua owned units because we assume that we operate on such a unit that the lua function that invoked the operation on that unit (like wesnoth.units.add_modification, wesnoth.units.matches ..) have a local copy of that lua_unit* userdata in its stack that prevents it from being collected. More... | |
Private Member Functions | |
unit_map & | units () |
game_data & | gamedata () |
tod_manager & | tod_man () |
const game_events::queued_event & | get_event_info () |
int | intf_allow_end_turn (lua_State *) |
Allow undo sets the flag saying whether the event has mutated the game to false. More... | |
int | intf_allow_undo (lua_State *) |
Allow undo sets the flag saying whether the event has mutated the game to false. More... | |
int | intf_cancel_action (lua_State *) |
int | intf_add_time_area (lua_State *) |
Adding new time_areas dynamically with Standard Location Filters. More... | |
int | intf_remove_time_area (lua_State *) |
Removing new time_areas dynamically with Standard Location Filters. More... | |
int | intf_get_time_area (lua_State *) |
int | intf_animate_unit (lua_State *) |
int | intf_gamestate_inspector (lua_State *) |
int | impl_run_animation (lua_State *) |
int | intf_create_animator (lua_State *) |
int | intf_get_unit (lua_State *) |
Gets the unit at the given location or with the given id. More... | |
int | intf_get_units (lua_State *) |
Gets all the units matching a given filter. More... | |
int | intf_get_displayed_unit (lua_State *) |
Gets the unit displayed in the sidebar. More... | |
int | intf_match_unit (lua_State *L) |
Matches a unit against the given filter. More... | |
int | intf_get_recall_units (lua_State *L) |
Gets the numeric ids of all the units matching a given filter on the recall lists. More... | |
int | intf_get_variable (lua_State *L) |
Gets a WML variable. More... | |
int | intf_set_variable (lua_State *L) |
Sets a WML variable. More... | |
int | intf_highlight_hex (lua_State *L) |
Highlights the given location on the map. More... | |
int | intf_is_enemy (lua_State *L) |
Returns whether the first side is an enemy of the second one. More... | |
int | intf_unit_ability (lua_State *L) |
Returns true if the unit has the given ability enabled. More... | |
int | intf_view_locked (lua_State *L) |
Gets whether gamemap scrolling is disabled for the user. More... | |
int | intf_lock_view (lua_State *L) |
Sets whether gamemap scrolling is disabled for the user. More... | |
int | impl_get_terrain_info (lua_State *L) |
Gets details about a terrain. More... | |
template<bool consider_illuminates> | |
int | intf_get_time_of_day (lua_State *L) |
Gets time of day information. More... | |
int | impl_schedule_get (lua_State *L) |
int | impl_schedule_len (lua_State *L) |
void | luaW_push_schedule (lua_State *L, int area_index) |
int | intf_get_village_owner (lua_State *L) |
Gets the side of a village owner. More... | |
int | intf_set_village_owner (lua_State *L) |
Sets the owner of a village. More... | |
int | intf_get_mouseover_tile (lua_State *L) |
Returns the currently overed tile. More... | |
int | intf_get_selected_tile (lua_State *L) |
Returns the currently selected tile. More... | |
int | impl_game_config_get (lua_State *L) override |
Gets some game_config data (__index metamethod). More... | |
int | impl_game_config_set (lua_State *L) override |
Sets some game_config data (__newindex metamethod). More... | |
int | impl_scenario_get (lua_State *L) |
Gets some scenario data (__index metamethod). More... | |
int | impl_scenario_set (lua_State *L) |
Sets some scenario data (__newindex metamethod). More... | |
int | impl_current_get (lua_State *L) |
Gets some data about current point of game (__index metamethod). More... | |
int | intf_clear_messages (lua_State *) |
Removes all messages from the chat window. More... | |
int | impl_end_level_data_set (lua_State *) |
int | intf_end_turn (lua_State *) |
int | intf_find_cost_map (lua_State *L) |
Is called with one or more units and builds a cost map. More... | |
int | intf_find_path (lua_State *L) |
Finds a path between two locations. More... | |
int | intf_find_reach (lua_State *L) |
Finds all the locations reachable by a unit. More... | |
int | intf_find_vision_range (lua_State *L) |
Finds all the locations for which a given unit would remove the fog (if there was fog on the map). More... | |
int | intf_heal_unit (lua_State *L) |
int | intf_message (lua_State *L) |
Displays a message in the chat window and in the logs. More... | |
int | intf_play_sound (lua_State *L) |
Plays a sound, possibly repeated. More... | |
int | intf_set_achievement (lua_State *L) |
Sets an achievement as being completed. More... | |
int | intf_has_achievement (lua_State *L) |
Returns whether an achievement has been completed. More... | |
int | intf_has_sub_achievement (lua_State *L) |
Returns whether an achievement has been completed. More... | |
int | intf_get_achievement (lua_State *L) |
Returns information on a single achievement, or no data if the achievement is not found. More... | |
int | intf_progress_achievement (lua_State *L) |
Progresses the provided achievement. More... | |
int | intf_set_sub_achievement (lua_State *L) |
Marks a single sub-achievement as completed. More... | |
int | intf_set_floating_label (lua_State *L, bool spawn) |
Arg 1: text - string Arg 2: options table. More... | |
int | intf_remove_floating_label (lua_State *L) |
int | intf_move_floating_label (lua_State *L) |
void | put_unit_helper (const map_location &loc) |
int | intf_put_unit (lua_State *L) |
Places a unit on the map. More... | |
int | intf_erase_unit (lua_State *L) |
Erases a unit from the map. More... | |
int | intf_put_recall_unit (lua_State *L) |
Puts a unit on a recall list. More... | |
int | intf_extract_unit (lua_State *L) |
Extracts a unit from the map or a recall list and gives it to Lua. More... | |
int | intf_find_vacant_tile (lua_State *L) |
Finds a vacant tile. More... | |
int | intf_float_label (lua_State *L) |
Floats some text on the map. More... | |
int | intf_set_end_campaign_credits (lua_State *L) |
int | intf_set_end_campaign_text (lua_State *L) |
int | intf_clear_menu_item (lua_State *L) |
int | intf_create_side (lua_State *L) |
int | intf_set_menu_item (lua_State *L) |
int | intf_toggle_shroud (lua_State *L, bool place_shroud) |
Toggle shroud on some locations Arg 1: Side number Arg 2: List of locations on which to place/remove shroud. More... | |
int | intf_override_shroud (lua_State *L) |
Overrides the shroud entirely. More... | |
int | intf_simulate_combat (lua_State *L) |
Simulates a combat between two units. More... | |
int | intf_scroll_to_tile (lua_State *L) |
Scrolls to given tile. More... | |
int | intf_select_unit (lua_State *L) |
Selects and highlights the given location on the map. More... | |
int | intf_deselect_hex (lua_State *L) |
Deselects any highlighted hex on the map. More... | |
int | intf_is_skipping_messages (lua_State *L) |
Return true if a replay is in progress but the player has chosen to skip it. More... | |
int | intf_skip_messages (lua_State *L) |
Set whether to skip messages Arg 1 (optional) - boolean. More... | |
int | intf_get_locations (lua_State *L) |
Gets all the locations matching a given filter. More... | |
int | intf_match_location (lua_State *L) |
Matches a location against the given filter. More... | |
int | intf_match_side (lua_State *L) |
Matches a side against the given filter. More... | |
int | intf_set_side_id (lua_State *L) |
int | intf_modify_ai_wml (lua_State *L) |
int | intf_get_sides (lua_State *L) |
Returns a proxy table array for all sides matching the given SSF. More... | |
int | intf_get_side (lua_State *L) |
int | intf_add_tile_overlay (lua_State *L) |
Adds an overlay on a tile. More... | |
int | intf_remove_tile_overlay (lua_State *L) |
Removes an overlay from a tile. More... | |
template<bool is_menu_item> | |
int | intf_add_event_simple (lua_State *L) |
Add a new event handler Arg 1: Event to handle, as a string or list of strings; or menu item ID if this is a menu item Arg 2: The function to call when the event triggers Arg 3: (optional) Event priority Arg 4: (optional, non-menu-items only) The function to call when the event is undone. More... | |
int | intf_add_event_wml (lua_State *L) |
Add a new event handler Arg: A full event specification as a WML config. More... | |
int | intf_add_event (lua_State *L) |
Add a new event handler Arg 1: Table of options. More... | |
int | intf_add_undo_actions (lua_State *L) |
Add undo actions for the current active event Arg 1: Either a table of ActionWML or a function to call Arg 2: (optional) If Arg 1 is a function, this is a WML table that will be passed to it. More... | |
int | cfun_undoable_event (lua_State *L) |
Upvalue 1: The event function Upvalue 2: The undo function Arg 1: The event content. More... | |
int | intf_remove_event (lua_State *L) |
int | intf_color_adjust (lua_State *L) |
int | intf_get_color_adjust (lua_State *L) |
int | intf_screen_fade (lua_State *L) |
int | intf_delay (lua_State *L) |
Delays engine for a while. More... | |
int | intf_add_label (lua_State *L) |
int | intf_remove_label (lua_State *L) |
int | intf_get_label (lua_State *L) |
int | intf_redraw (lua_State *L) |
int | intf_replace_schedule (lua_State *l) |
Replacing the current time of day schedule. More... | |
int | impl_schedule_set (lua_State *L) |
int | intf_scroll (lua_State *L) |
int | intf_get_all_vars (lua_State *L) |
Gets all the WML variables currently set. More... | |
int | impl_theme_item (lua_State *L, std::string name) |
Executes its upvalue as a theme item generator. More... | |
int | impl_theme_items_get (lua_State *L) |
Creates a field of the theme_items table and returns it (__index metamethod). More... | |
int | impl_theme_items_set (lua_State *L) |
Sets a field of the theme_items table (__newindex metamethod). More... | |
int | cfun_builtin_effect (lua_State *L) |
Applies its upvalue as an effect Arg 1: The unit to apply to Arg 3: The [effect] tag contents Arg 3: If false, only build description Return: The description of the effect. More... | |
int | cfun_wml_action (lua_State *L) |
Executes its upvalue as a wml action. More... | |
int | intf_fire_event (lua_State *L, const bool by_id) |
Fires an event. More... | |
int | intf_fire_wml_menu_item (lua_State *L) |
Fires a wml menu item. More... | |
int | intf_teleport (lua_State *L) |
Teeleports a unit to a location. More... | |
int | intf_log (lua_State *L) |
Logs a message Arg 1: (optional) Logger; "wml" for WML errors or deprecations Arg 2: Message Arg 3: Whether to print to chat (always true if arg 1 is "wml") More... | |
int | intf_toggle_fog (lua_State *L, const bool clear) |
Implements the lifting and resetting of fog via WML. More... | |
int | intf_get_fog_or_shroud (lua_State *L, bool fog) |
int | intf_log_replay (lua_State *L) |
int | intf_zoom (lua_State *L) |
std::string | synced_state () |
converts synced_context::get_synced_state() to a string. More... | |
void | lua_chat (const std::string &caption, const std::string &msg) |
std::vector< int > | get_sides_vector (const vconfig &cfg) |
Gets a vector of sides from side= attribute in a given config node. More... | |
Static Private Member Functions | |
static void | extract_preload_scripts (const game_config_view &game_config) |
Private Attributes | |
game_display * | game_display_ |
game_state & | game_state_ |
play_controller & | play_controller_ |
reports & | reports_ |
config | level_lua_ |
int | EVENT_TABLE |
bool | has_preloaded_ = false |
std::stack< game_events::queued_event const * > | queued_events_ |
Static Private Attributes | |
static std::vector< config > | preload_scripts |
static config | preload_config |
Friends | |
class | game_config_manager |
Additional Inherited Members | |
![]() | |
using | external_log_type = std::function< void(const std::string &)> |
typedef std::function< void(char const *, char const *)> | error_handler |
![]() | |
template<typename T > | |
static T & | get_lua_kernel (lua_State *L) |
![]() | |
int | intf_print (lua_State *L) |
Replacement print function – instead of printing to std::cout, print to the command log. More... | |
bool | protected_call (int nArgs, int nRets, error_handler) |
bool | load_string (char const *prog, const std::string &name, error_handler) |
virtual bool | protected_call (int nArgs, int nRets) |
virtual bool | load_string (char const *prog, const std::string &name) |
int | intf_dofile (lua_State *L) |
Loads and executes a Lua file. More... | |
int | intf_require (lua_State *L) |
Loads and executes a Lua file, if there is no corresponding entry in wesnoth.package. More... | |
int | intf_kernel_type (lua_State *L) |
![]() | |
static bool | protected_call (lua_State *L, int nArgs, int nRets, error_handler) |
![]() | |
lua_State * | mState |
command_log | cmd_log_ |
Definition at line 48 of file game_lua_kernel.hpp.
game_lua_kernel::game_lua_kernel | ( | game_state & | gs, |
play_controller & | pc, | ||
reports & | reports_object | ||
) |
Definition at line 4929 of file game_lua_kernel.cpp.
References unit::builtin_effects, lua_kernel_base::cmd_log_, EVENT_TABLE, play_controller::get_classification(), game_events::builtin_conditions::have_location(), game_events::builtin_conditions::have_unit(), ai::lua_ai_context::init(), intf_add_known_unit(), intf_add_modification(), intf_advance_unit(), intf_append_ai(), intf_copy_unit(), intf_create_attack(), intf_create_unit(), intf_debug_ai(), intf_do_unsynced(), intf_eval_conditional(), intf_get_era(), intf_get_resource(), intf_get_viewing_side(), intf_handle_user_interact(), intf_invoke_synced_command(), intf_modify_ai(), intf_modify_ai_old(), intf_on_board(), intf_on_border(), intf_remove_modifications(), intf_replace_if_failed(), intf_switch_ai(), intf_synchronize_choice(), intf_synchronize_choices(), intf_terrain_mask(), intf_terrainmap_iter(), lua_common::intf_tovconfig(), intf_transform_unit(), intf_unit_defense(), intf_unit_jamming_cost(), intf_unit_movement_cost(), intf_unit_resistance(), intf_unit_vision_cost(), game_classification::is_test(), luaW_getglobal(), lua_kernel_base::mState, play_controller_, push_builtin_effect(), queued_events_, lua_units::register_attacks_metatables(), lua_race::register_metatable(), lua_team::register_metatable(), lua_unit_type::register_metatable(), lua_terrainmap::register_metatables(), lua_units::register_metatables(), lua_audio::register_table(), lua_unit_type::register_table(), lua_common::register_vconfig_metatable(), game_events::wml_action::registry(), lua_cpp::set_functions(), set_wml_action(), set_wml_condition(), and game_events::builtin_conditions::variable_matches().
std::string game_lua_kernel::apply_effect | ( | const std::string & | name, |
unit & | u, | ||
const config & | cfg, | ||
bool | need_apply | ||
) |
Definition at line 5866 of file game_lua_kernel.cpp.
References ERR_LUA, luaW_getglobal(), luaW_pcall(), luaW_pushconfig(), luaW_pushlocalunit(), and lua_kernel_base::mState.
Referenced by unit::add_modification().
game_board & game_lua_kernel::board | ( | ) |
Definition at line 4900 of file game_lua_kernel.cpp.
References game_state::board_, and game_state_.
Referenced by impl_get_terrain_info(), impl_theme_item(), intf_erase_unit(), intf_extract_unit(), intf_find_cost_map(), intf_find_path(), intf_find_reach(), intf_get_displayed_unit(), intf_get_fog_or_shroud(), intf_get_mouseover_tile(), intf_get_selected_tile(), intf_get_side(), intf_get_sides(), intf_get_time_of_day(), intf_get_village_owner(), intf_is_enemy(), intf_match_unit(), intf_override_shroud(), intf_put_recall_unit(), intf_set_side_id(), intf_set_village_owner(), intf_toggle_fog(), and intf_toggle_shroud().
|
private |
Applies its upvalue as an effect Arg 1: The unit to apply to Arg 3: The [effect] tag contents Arg 3: If false, only build description Return: The description of the effect.
Definition at line 5547 of file game_lua_kernel.cpp.
References unit::apply_builtin_effect(), unit::describe_builtin_effect(), luaW_checkconfig(), luaW_checkunit(), and luaW_toboolean().
|
private |
Upvalue 1: The event function Upvalue 2: The undo function Arg 1: The event content.
Definition at line 4098 of file game_lua_kernel.cpp.
References synced_context::add_undo_commands(), get_event_info(), lua_push(), and luaW_pcall().
|
private |
Executes its upvalue as a wml action.
Definition at line 5597 of file game_lua_kernel.cpp.
References get_event_info(), h, and luaW_checkvconfig().
void game_lua_kernel::clear_wml_event | ( | int | ref | ) |
Clear a WML event store in the Lua registry.
ref | The unique index into the EVENT_TABLE within the Lua registry |
Definition at line 5770 of file game_lua_kernel.cpp.
References EVENT_TABLE, and lua_kernel_base::mState.
Referenced by lua_event_filter::~lua_event_filter().
ai::lua_ai_action_handler * game_lua_kernel::create_lua_ai_action_handler | ( | char const * | code, |
ai::lua_ai_context & | context | ||
) |
Definition at line 5937 of file game_lua_kernel.cpp.
References ai::lua_ai_action_handler::create(), and lua_kernel_base::mState.
ai::lua_ai_context * game_lua_kernel::create_lua_ai_context | ( | char const * | code, |
ai::engine_lua * | engine | ||
) |
Definition at line 5932 of file game_lua_kernel.cpp.
References ai::lua_ai_context::create(), and lua_kernel_base::mState.
void game_lua_kernel::custom_command | ( | const std::string & | name, |
const config & | cfg | ||
) |
Definition at line 5529 of file game_lua_kernel.cpp.
References luaW_getglobal(), luaW_pcall(), luaW_pushconfig(), and lua_kernel_base::mState.
Referenced by SYNCED_COMMAND_HANDLER_FUNCTION().
|
staticprivate |
Definition at line 176 of file game_lua_kernel.cpp.
References preload_config, and preload_scripts.
Referenced by game_config_manager::load_game_config().
|
private |
Definition at line 4916 of file game_lua_kernel.cpp.
References game_state_, and game_state::gamedata_.
Referenced by impl_current_get(), impl_game_config_get(), impl_game_config_set(), impl_scenario_get(), impl_scenario_set(), intf_allow_end_turn(), intf_delay(), intf_fire_wml_menu_item(), intf_gamestate_inspector(), intf_get_all_vars(), intf_get_variable(), intf_set_variable(), intf_set_village_owner(), and synced_state().
|
inline |
Definition at line 202 of file game_lua_kernel.hpp.
References game_display_.
|
private |
Definition at line 4924 of file game_lua_kernel.cpp.
References queued_events_.
Referenced by cfun_undoable_event(), cfun_wml_action(), impl_current_get(), and intf_add_undo_actions().
|
private |
Gets a vector of sides from side= attribute in a given config node.
Promotes consistent behavior.
Definition at line 203 of file game_lua_kernel.cpp.
References vconfig::child(), config_attribute_value::empty(), game_state_, side_filter::get_teams(), vconfig::null(), config_attribute_value::str(), and WRN_LUA.
|
private |
Gets some data about current point of game (__index metamethod).
Definition at line 1698 of file game_lua_kernel.cpp.
References config::add_child(), events::commands_disabled, play_controller::current_side(), game_events::queued_event::data, config_attribute_value::empty(), game_events::entity_location::filter_loc(), gamedata(), get_event_info(), game_events::queued_event::id, intf_terrainmap_get(), game_events::queued_event::loc1, game_events::queued_event::loc2, luaW_push_schedule(), luaW_pushconfig(), game_events::queued_event::name, config::optional_child(), play_controller_, return_bool_attrib, return_int_attrib, return_string_attrib, synced_state(), play_controller::turn(), game_data::TURN_PLAYING, map_location::valid(), map_location::wml_x(), and map_location::wml_y().
|
private |
Definition at line 1392 of file game_lua_kernel.cpp.
References data, modify_bool_attrib, modify_string_attrib, and play_controller_.
|
overrideprivatevirtual |
Gets some game_config data (__index metamethod).
Reimplemented from lua_kernel_base.
Definition at line 1275 of file game_lua_kernel.cpp.
References resources::classification, game_state::do_healing_, game_classification::era_id, gamedata(), play_controller::gamestate(), game_config_manager::get(), play_controller::get_classification(), play_controller::get_loaded_resources(), play_controller::get_mp_settings(), string_enums::enum_base< Definition >::get_string(), lua_kernel_base::impl_game_config_get(), INDEFINITE, LOG_LUA, luaW_pushconfig(), next_scenario, play_controller_, return_bool_attrib, return_cfgref_attrib_deprecated, return_int_attrib_deprecated, return_string_attrib, return_string_attrib_deprecated, return_vector_string_attrib_deprecated, utils::split(), mp_game_settings::to_config(), tod_man(), unit_type_data::traits(), game_classification::type, and unit_types.
|
overrideprivatevirtual |
Sets some game_config data (__newindex metamethod).
Reimplemented from lua_kernel_base.
Definition at line 1327 of file game_lua_kernel.cpp.
References game_config::base_income, game_config::combat_experience, game_state::do_healing_, game_display_, gamedata(), play_controller::gamestate(), lua_kernel_base::impl_game_config_set(), INDEFINITE, game_config::kill_experience, LOG_LUA, modify_bool_attrib, modify_int_attrib, modify_int_attrib_deprecated, modify_string_attrib, modify_string_attrib_deprecated, modify_vector_string_attrib_deprecated, play_controller_, game_config::poison_amount, game_config::recall_cost, game_config::rest_heal_amount, display::set_theme(), preferences::set_theme(), tod_man(), game_config::village_income, and game_config::village_support.
|
private |
Gets details about a terrain.
Definition at line 1037 of file game_lua_kernel.cpp.
References board(), lg::info(), lua_push(), luaW_pushtstring(), game_board::map(), t_translation::NONE_TERRAIN, t_translation::read_terrain_code(), t, and gamemap::tdata().
|
private |
Definition at line 372 of file game_lua_kernel.cpp.
References animatorKey, unit_animator::clear(), video::headless(), play_controller_, controller_base::play_slice(), unit_animator::set_all_standing(), unit_animator::start_animations(), and unit_animator::wait_for_end().
|
private |
Gets some scenario data (__index metamethod).
Definition at line 1549 of file game_lua_kernel.cpp.
References game_classification::active_mods, game_classification::campaign, resources::classification, data, game_classification::difficulty, game_classification::end_credits, game_classification::end_text, game_classification::end_text_duration, game_classification::era_id, gamedata(), play_controller::get_classification(), play_controller::get_end_level_data(), play_controller::get_loaded_resources(), play_controller::get_scenario_name(), string_enums::enum_base< Definition >::get_string(), impl_end_level_data_collect(), impl_end_level_data_get(), impl_mp_settings_get(), impl_mp_settings_len(), game_classification::is_multiplayer(), play_controller::is_regular_game_end(), LOG_LUA, lua_push(), next_scenario, play_controller_, return_bool_attrib, return_cfgref_attrib, return_int_attrib, return_string_attrib, return_tstring_attrib, return_vector_string_attrib, utils::split(), tod_man(), and game_classification::type.
|
private |
Sets some scenario data (__newindex metamethod).
Definition at line 1634 of file game_lua_kernel.cpp.
References resources::classification, data, game_classification::end_credits, game_classification::end_text, game_classification::end_text_duration, gamedata(), play_controller::get_classification(), LOG_LUA, luaW_checkvconfig(), modify_bool_attrib, modify_int_attrib, modify_string_attrib, modify_tstring_attrib, modify_vector_string_attrib, play_controller_, play_controller::set_end_level_data(), teams(), and tod_man().
|
private |
Definition at line 920 of file game_lua_kernel.cpp.
References tod_manager::get_area_by_index(), i, luaW_check_schedule(), luaW_getglobal(), luaW_push_locationset(), luaW_push_tod(), return_int_attrib, return_string_attrib, tod_manager::times(), and tod_man().
|
private |
Definition at line 953 of file game_lua_kernel.cpp.
References luaW_check_schedule(), tod_manager::times(), and tod_man().
|
private |
Definition at line 961 of file game_lua_kernel.cpp.
References lg::err(), tod_manager::get_area_by_index(), tod_manager::get_area_id(), i, id, lua_push(), luaW_check_locationset(), luaW_check_schedule(), luaW_checkconfig(), modify_int_attrib, modify_string_attrib, n, tod_manager::replace_area_locations(), tod_manager::replace_local_schedule(), tod_manager::replace_schedule(), tod_manager::reset_max_liminal_bonus(), tod_manager::set_current_time(), tod_manager::times(), and tod_man().
|
private |
Executes its upvalue as a theme item generator.
Definition at line 4679 of file game_lua_kernel.cpp.
References board(), game_display_, reports::generate_report(), play_controller::get_mouse_handler_base(), play_controller::get_whiteboard(), luaW_pushconfig(), play_controller_, reports_, and tod_man().
Referenced by impl_theme_items_get().
|
private |
Creates a field of the theme_items table and returns it (__index metamethod).
Definition at line 4689 of file game_lua_kernel.cpp.
References impl_theme_item(), lua_cpp::push_closure(), reports::register_generator(), and reports_.
|
private |
Sets a field of the theme_items table (__newindex metamethod).
Definition at line 4703 of file game_lua_kernel.cpp.
References reports::register_generator(), and reports_.
void game_lua_kernel::initialize | ( | const config & | level | ) |
Definition at line 5377 of file game_lua_kernel.cpp.
References config::append_children(), config::child_range(), lua_kernel_base::cmd_log_, config::empty(), game_config::images::level, level_lua_, game_config::load_config(), luaW_pushracetable(), lua_kernel_base::mState, preload_config, preload_scripts, and lua_kernel_base::run_lua_tag().
|
private |
Add a new event handler Arg 1: Table of options.
name: Event to handle, as a string or list of strings id: Event ID menu_item: True if this is a menu item (an ID is required); this means removing the menu item will automatically remove this event. Default false. first_time_only: Whether this event should fire again after the first time; default true. priority: Number that determines execution order. Events execute in order of decreasing priority, and secondarily in order of addition. filter: Event filters as a config with filter tags, a table of the form {filter_type = filter_contents}, or a function filter_args: Arbitrary data that will be passed to the filter, if it is a function. Ignored if the filter is specified as WML or a table. content: The content of the event. This is a WML table passed verbatim into the event when it fires. If no function is specified, it will be interpreted as ActionWML. action: The function to call when the event triggers. Defaults to wesnoth.wml_actions.command.
Lua API: wesnoth.game_events.add
Definition at line 4019 of file game_lua_kernel.cpp.
References game_events::manager::add_event_handler_from_lua(), game_state::events_manager_, game_state_, has_preloaded_, id, luaW_table_get_def(), luaW_tableget(), luaW_toconfig(), read_event_name(), READ_ONE_FILTER, s, save_wml_event(), and game_events::event_handler::set_arguments().
|
private |
Add a new event handler Arg 1: Event to handle, as a string or list of strings; or menu item ID if this is a menu item Arg 2: The function to call when the event triggers Arg 3: (optional) Event priority Arg 4: (optional, non-menu-items only) The function to call when the event is undone.
Lua API:
Definition at line 4118 of file game_lua_kernel.cpp.
References game_events::manager::add_event_handler_from_lua(), game_state::events_manager_, game_state_, has_preloaded_, id, read_event_name(), save_wml_event(), and game_events::event_handler::set_arguments().
|
private |
Add a new event handler Arg: A full event specification as a WML config.
WML API: [event]
Definition at line 4149 of file game_lua_kernel.cpp.
References game_events::manager::add_event_handler_from_wml(), game_state::events_manager_, game_state_, vconfig::get_config(), vconfig::get_parsed_config(), and luaW_checkvconfig().
|
private |
Definition at line 4230 of file game_lua_kernel.cpp.
References game_display_, vconfig::get_config(), label, display::labels(), luaW_checkvconfig(), and map_labels::set_label().
|
private |
Adds an overlay on a tile.
Definition at line 3887 of file game_lua_kernel.cpp.
References display::add_overlay(), vconfig::child(), game_display_, game_state_, side_filter::get_teams(), utils::join(), luaW_checklocation(), luaW_checkvconfig(), vconfig::null(), and teams().
|
private |
Adding new time_areas dynamically with Standard Location Filters.
Arg 1: Area ID Arg 2: Area locations (either a filter or a list of locations) Arg 3: (optional) Area schedule - WML table with [time] tags and optional current_time=
Definition at line 4545 of file game_lua_kernel.cpp.
References tod_manager::add_time_area(), deprecated_message(), game_state_, vconfig::get_parsed_config(), id, INDEFINITE, LOG_LUA, log_scope, luaW_check_locationset(), luaW_checkconfig(), luaW_checkvconfig(), luaW_tovconfig(), and tod_man().
|
private |
Add undo actions for the current active event Arg 1: Either a table of ActionWML or a function to call Arg 2: (optional) If Arg 1 is a function, this is a WML table that will be passed to it.
Definition at line 3993 of file game_lua_kernel.cpp.
References synced_context::add_undo_commands(), get_event_info(), luaW_toconfig(), and save_wml_event().
|
private |
Allow undo sets the flag saying whether the event has mutated the game to false.
Definition at line 4507 of file game_lua_kernel.cpp.
References gamedata(), luaW_iststring(), luaW_toboolean(), luaW_totstring(), and game_data::set_allow_end_turn().
|
private |
Allow undo sets the flag saying whether the event has mutated the game to false.
Definition at line 4523 of file game_lua_kernel.cpp.
References luaW_toboolean(), play_controller_, play_controller::pump(), and game_events::wml_event_pump::set_undo_disabled().
|
private |
|
private |
Definition at line 4534 of file game_lua_kernel.cpp.
References play_controller_, play_controller::pump(), and game_events::wml_event_pump::set_action_canceled().
|
private |
Definition at line 727 of file game_lua_kernel.cpp.
References game_events::wmi_manager::erase(), game_state_, game_state::get_wml_menu_items(), utils::split(), utils::STRIP_SPACES, and WRN_LUA.
|
private |
Removes all messages from the chat window.
Definition at line 1792 of file game_lua_kernel.cpp.
References display_chat_manager::clear_chat_messages(), game_display_, and game_display::get_chat_manager().
|
private |
Definition at line 4168 of file game_lua_kernel.cpp.
References display::adjust_color_overlay(), game_display_, and display::invalidate_all().
|
private |
Definition at line 400 of file game_lua_kernel.cpp.
References animatorKey, impl_add_animation(), impl_animator_collect(), impl_animator_get(), and impl_clear_animation().
|
private |
Definition at line 711 of file game_lua_kernel.cpp.
References game_state::add_side_wml(), game_state_, luaW_checkconfig(), utf8::size(), and teams().
|
private |
Delays engine for a while.
Definition at line 4207 of file game_lua_kernel.cpp.
References game_display_, gamedata(), game_data::INITIAL, luaW_toboolean(), play_controller_, controller_base::play_slice(), game_data::PRELOAD, game_data::PRESTART, and display::turbo_speed().
|
private |
Deselects any highlighted hex on the map.
No arguments or return values
Definition at line 3379 of file game_lua_kernel.cpp.
References game_display_, game_display::highlight_hex(), and map_location::null_location().
|
private |
Definition at line 1800 of file game_lua_kernel.cpp.
References resources::controller, play_controller::force_end_turn(), play_controller::gamestate(), game_state::next_player_number_, play_controller_, and teams().
|
private |
Erases a unit from the map.
Definition at line 2601 of file game_lua_kernel.cpp.
References board(), unit_map::erase(), unit::get_location(), game_board::get_team(), unit::id(), luaW_checkunit_ref(), luaW_isunit(), luaW_tolocation(), map(), map_locked_, lua_unit::on_map(), lua_unit::on_recall_list(), t, units(), and resources::whiteboard.
|
private |
Extracts a unit from the map or a recall list and gives it to Lua.
Definition at line 2689 of file game_lua_kernel.cpp.
References board(), unit_map::extract(), game_board::get_team(), luaW_checkunit_ref(), map_locked_, t, and units().
|
private |
Is called with one or more units and builds a cost map.
Definition at line 2133 of file game_lua_kernel.cpp.
References pathfind::full_cost_map::add_unit(), board(), map_labels::clear_all(), debug, fake_unit_manager::empty(), resources::fake_units, unit_type_data::find(), unit_map::find(), game_display_, game_state_, pathfind::full_cost_map::get_pair_at(), game_board::get_team(), i, display::labels(), load_fake_units(), luaW_checklocation(), luaW_push_namedtuple(), luaW_toboolean(), luaW_tounit(), luaW_tovconfig(), vconfig::null(), s, map_labels::set_label(), utf8::size(), teams(), game_board::teams(), vconfig::unconstructed_vconfig(), unit_types, units(), and unit_map::iterator_base< iter_types >::valid().
|
private |
Finds a path between two locations.
Definition at line 1839 of file game_lua_kernel.cpp.
References pathfind::a_star_search(), board(), deprecated_message(), unit_map::find(), FOR_REMOVAL, unit::get_location(), unit_map::iterator_base< iter_types >::get_shared_ptr(), pathfind::get_teleport_locations(), gamemap_base::h(), i, luaW_checklocation(), luaW_checkunit(), luaW_pushlocation(), map(), game_board::map(), pathfind::plain_route::move_cost, unit::side(), utf8::size(), pathfind::plain_route::steps, teams(), units(), unit_map::iterator_base< iter_types >::valid(), and gamemap_base::w().
|
private |
Finds all the locations reachable by a unit.
Definition at line 1954 of file game_lua_kernel.cpp.
References board(), deprecated_message(), pathfind::paths::destinations, unit_map::find(), FOR_REMOVAL, unit_map::iterator_base< iter_types >::get_shared_ptr(), game_board::get_team(), i, luaW_checklocation(), luaW_checkunit(), luaW_push_namedtuple(), s, unit::side(), utf8::size(), teams(), units(), and unit_map::iterator_base< iter_types >::valid().
|
private |
Finds a vacant tile.
Definition at line 2721 of file game_lua_kernel.cpp.
References unit::create(), pathfind::find_vacant_tile(), luaW_checkconfig(), luaW_checklocation(), luaW_checkunit_ptr(), luaW_isunit(), pathfind::VACANT_ANY, map_location::valid(), map_location::wml_x(), and map_location::wml_y().
|
private |
Finds all the locations for which a given unit would remove the fog (if there was fog on the map).
Definition at line 2029 of file game_lua_kernel.cpp.
References actions::create_jamming_map(), d, pathfind::paths::destinations, e, pathfind::vision_path::edges, unit_map::find(), resources::gameboard, unit::get_location(), unit_map::iterator_base< iter_types >::get_shared_ptr(), luaW_checklocation(), luaW_checkunit(), luaW_push_namedtuple(), unit::side(), units(), and unit_map::iterator_base< iter_types >::valid().
|
private |
Fires an event.
Definition at line 616 of file game_lua_kernel.cpp.
References b, data, game_events::wml_event_pump::fire(), luaW_toconfig(), luaW_tolocation(), play_controller_, and play_controller::pump().
|
private |
Fires a wml menu item.
NOTE: This is not an "official" feature, it may currently cause assertion failures if used with menu items which have "needs_select". It is not supported right now to use it this way. The purpose of this function right now is to make it possible to have automated sanity tests for the wml menu items system.
Definition at line 668 of file game_lua_kernel.cpp.
References b, game_events::wmi_manager::fire_item(), game_state_, gamedata(), game_state::get_wml_menu_items(), luaW_checklocation(), and units().
|
private |
Floats some text on the map.
Definition at line 2750 of file game_lua_kernel.cpp.
References game_display::float_label(), color_t::from_rgb_string(), game_display_, font::LABEL_COLOR, luaW_checklocation(), and luaW_checktstring().
|
private |
Definition at line 420 of file game_lua_kernel.cpp.
References game_display_, game_state_, gamedata(), luaW_checkvconfig(), and lua_gui2::show_gamestate_inspector().
|
private |
Returns information on a single achievement, or no data if the achievement is not found.
Definition at line 3148 of file game_lua_kernel.cpp.
References config::add_child(), ERR_LUA, game_config_manager::get(), and luaW_pushconfig().
|
private |
Gets all the WML variables currently set.
Definition at line 4717 of file game_lua_kernel.cpp.
References gamedata(), and luaW_pushconfig().
|
private |
Definition at line 4177 of file game_lua_kernel.cpp.
References game_display_, and display::get_color_overlay().
|
private |
Gets the unit displayed in the sidebar.
Definition at line 465 of file game_lua_kernel.cpp.
References board(), game_display::displayed_unit_hex(), game_board::find_visible_unit(), game_display_, luaW_pushunit(), display::show_everything(), teams(), unit_map::iterator_base< iter_types >::valid(), and display::viewing_team().
|
private |
Definition at line 4802 of file game_lua_kernel.cpp.
References board(), preferences::fog(), luaW_checklocation(), luaW_checkteam(), and t.
|
private |
Definition at line 4265 of file game_lua_kernel.cpp.
References game_display_, map_labels::get_label(), label, display::labels(), luaW_checklocation(), luaW_checkteam(), luaW_pushconfig(), n, team::team_name(), and teams().
|
private |
Gets all the locations matching a given filter.
Definition at line 3563 of file game_lua_kernel.cpp.
References game_state_, luaW_checkvconfig(), luaW_isunit(), luaW_push_locationset(), and luaW_tounit().
|
private |
Returns the currently overed tile.
Definition at line 1200 of file game_lua_kernel.cpp.
References board(), game_display_, map(), display::mouseover_hex(), map_location::wml_x(), and map_location::wml_y().
|
private |
Gets the numeric ids of all the units matching a given filter on the recall lists.
Definition at line 578 of file game_lua_kernel.cpp.
References i, luaW_checkvconfig(), luaW_pushunit(), vconfig::null(), s, t, and teams().
|
private |
Returns the currently selected tile.
Definition at line 1218 of file game_lua_kernel.cpp.
References board(), game_display_, map(), display::selected_hex(), map_location::wml_x(), and map_location::wml_y().
|
private |
Definition at line 3745 of file game_lua_kernel.cpp.
References board(), i, luaW_pushteam(), utf8::size(), and teams().
|
private |
Returns a proxy table array for all sides matching the given SSF.
Definition at line 3758 of file game_lua_kernel.cpp.
References board(), game_state_, side_filter::get_teams(), utf8::index(), LOG_LUA, luaW_checkvconfig(), luaW_pushteam(), my_name(), vconfig::null(), and teams().
|
private |
Definition at line 4592 of file game_lua_kernel.cpp.
References tod_manager::get_area_ids(), tod_manager::get_area_on_hex(), luaW_push_schedule(), luaW_tolocation(), and tod_man().
|
private |
Gets time of day information.
Definition at line 1078 of file game_lua_kernel.cpp.
References board(), tod_manager::get_area_by_id(), tod_manager::get_area_by_index(), tod_manager::get_illuminated_time_of_day(), tod_manager::get_time_of_day(), luaW_check_schedule(), luaW_push_tod(), luaW_tolocation(), map(), tod_manager::number_of_turns(), tod_man(), tod_manager::turn(), and units().
|
private |
Gets the unit at the given location or with the given id.
Definition at line 436 of file game_lua_kernel.cpp.
References unit_map::find(), luaW_pushunit(), luaW_tolocation(), units(), and unit_map::iterator_base< iter_types >::valid().
|
private |
Gets all the units matching a given filter.
Definition at line 489 of file game_lua_kernel.cpp.
References unit_filter::all_matches_at(), unit_filter::all_matches_on_map(), unit_filter::all_matches_with_unit(), i, luaW_checkvconfig(), luaW_pushunit(), luaW_tolocation(), luaW_tounit(), units(), and map_location::valid().
|
private |
Gets a WML variable.
Definition at line 685 of file game_lua_kernel.cpp.
References gamedata(), game_data::get_variable_access_read(), and luaW_pushvariable().
|
private |
Gets the side of a village owner.
Definition at line 1125 of file game_lua_kernel.cpp.
References board(), luaW_checklocation(), map(), and display_context::village_owner().
|
private |
Returns whether an achievement has been completed.
Definition at line 3127 of file game_lua_kernel.cpp.
References preferences::achievement(), resources::controller, ERR_LUA, and synced_context::is_synced().
|
private |
Returns whether an achievement has been completed.
Definition at line 3258 of file game_lua_kernel.cpp.
References resources::controller, ERR_LUA, synced_context::is_synced(), and preferences::sub_achievement().
|
private |
|
private |
Highlights the given location on the map.
Definition at line 801 of file game_lua_kernel.cpp.
References game_display::display_unit_hex(), game_display_, game_display::highlight_hex(), luaW_checklocation(), and map().
|
private |
Returns whether the first side is an enemy of the second one.
Definition at line 820 of file game_lua_kernel.cpp.
References board(), luaW_toteam(), utf8::size(), t, and teams().
|
private |
Return true if a replay is in progress but the player has chosen to skip it.
Definition at line 3391 of file game_lua_kernel.cpp.
References game_state::events_manager_, game_state_, play_controller::is_skipping_replay(), play_controller::is_skipping_story(), and play_controller_.
|
private |
Sets whether gamemap scrolling is disabled for the user.
Definition at line 856 of file game_lua_kernel.cpp.
References game_display_, luaW_toboolean(), and display::set_view_locked().
|
private |
Logs a message Arg 1: (optional) Logger; "wml" for WML errors or deprecations Arg 2: Message Arg 3: Whether to print to chat (always true if arg 1 is "wml")
Definition at line 4787 of file game_lua_kernel.cpp.
References ERR_WML, game_state::events_manager_, game_state_, lg::log_to_chat(), luaW_toboolean(), and wfl::msg().
|
private |
Definition at line 3934 of file game_lua_kernel.cpp.
References replay::add_log_data(), play_controller::get_replay(), luaW_toconfig(), play_controller_, and resources::recorder.
|
private |
Matches a location against the given filter.
Definition at line 3587 of file game_lua_kernel.cpp.
References game_state_, luaW_checklocation(), luaW_checkvconfig(), luaW_isunit(), luaW_tounit(), and vconfig::null().
|
private |
Matches a side against the given filter.
Definition at line 3615 of file game_lua_kernel.cpp.
References game_state_, luaW_checkvconfig(), luaW_toteam(), side_filter::match(), vconfig::null(), utf8::size(), t, and teams().
|
private |
Matches a unit against the given filter.
Definition at line 532 of file game_lua_kernel.cpp.
References board(), unit::get_location(), game_board::get_team(), unit::id(), luaW_checkunit_ref(), luaW_checkvconfig(), luaW_tolocation(), luaW_tounit(), vconfig::null(), lua_unit::on_recall_list(), t, and WRN_LUA.
|
private |
Displays a message in the chat window and in the logs.
Definition at line 1758 of file game_lua_kernel.cpp.
References h, LOG_LUA, lua_chat(), and luaW_checktstring().
|
private |
|
private |
Definition at line 2327 of file game_lua_kernel.cpp.
References luaW_check_floating_label(), and font::move_floating_label().
|
private |
Overrides the shroud entirely.
All locations are shrouded, except for the ones passed in as argument 2. Arg 1: Side number Arg 2: List of locations that should be unshrouded
Definition at line 776 of file game_lua_kernel.cpp.
References board(), game_display_, display::invalidate_all(), display::labels(), luaW_check_locationset(), luaW_checkteam(), luaW_type_error(), display::recalculate_minimap(), map_labels::recalculate_shroud(), and t.
|
private |
Plays a sound, possibly repeated.
Definition at line 3064 of file game_lua_kernel.cpp.
References play_controller::is_skipping_replay(), play_controller_, sound::play_sound(), and sound::SOUND_FX.
|
private |
Progresses the provided achievement.
Definition at line 3204 of file game_lua_kernel.cpp.
References achievement::achieved_, achievement::current_progress_, ERR_LUA, game_config_manager::get(), achievement::id_, intf_set_achievement(), lua_push(), achievement::max_progress_, preferences::progress_achievement(), and achievement::sub_achievements_.
|
private |
Puts a unit on a recall list.
Definition at line 2640 of file game_lua_kernel.cpp.
References board(), unit::create(), unit_map::erase(), game_board::get_team(), luaW_checkconfig(), luaW_checkunit_ref(), luaW_isunit(), map_locked_, utf8::size(), t, teams(), units(), and resources::whiteboard.
|
private |
Places a unit on the map.
Definition at line 2546 of file game_lua_kernel.cpp.
References unit::create(), game_events::wml_event_pump::fire(), unit::get_location(), lua_unit::get_shared(), unit_map::insert(), luaW_checkconfig(), luaW_checkunit_ref(), luaW_isunit(), luaW_toboolean(), luaW_tolocation(), map(), map_locked_, lua_unit::on_map(), play_controller_, play_controller::pump(), lua_unit::put_map(), put_unit_helper(), map_location::set_wml_x(), map_location::set_wml_y(), units(), and map_location::valid().
|
private |
Definition at line 4301 of file game_lua_kernel.cpp.
References actions::clear_shroud(), game_display_, game_state_, side_filter::get_teams(), display::invalidate_all(), luaW_checkvconfig(), luaW_toboolean(), game_display::maybe_rebuild(), and display::recalculate_minimap().
|
private |
Definition at line 4162 of file game_lua_kernel.cpp.
References game_state::events_manager_, and game_state_.
|
private |
Definition at line 2315 of file game_lua_kernel.cpp.
References luaW_check_floating_label(), and font::remove_floating_label().
|
private |
Definition at line 4246 of file game_lua_kernel.cpp.
References game_display_, display::labels(), luaW_checklocation(), luaW_table_get_def(), and map_labels::set_label().
|
private |
Removes an overlay from a tile.
Definition at line 3917 of file game_lua_kernel.cpp.
References game_display_, luaW_checklocation(), display::remove_overlay(), and display::remove_single_overlay().
|
private |
Removing new time_areas dynamically with Standard Location Filters.
Definition at line 4581 of file game_lua_kernel.cpp.
References LOG_LUA, log_scope, tod_manager::remove_time_area(), and tod_man().
|
private |
Replacing the current time of day schedule.
Definition at line 4617 of file game_lua_kernel.cpp.
References ERR_LUA, game_display_, vconfig::get_children(), vconfig::get_parsed_config(), LOG_LUA, luaW_check_schedule(), luaW_checkvconfig(), game_display::new_turn(), tod_manager::replace_schedule(), and tod_man().
|
private |
Definition at line 4189 of file game_lua_kernel.cpp.
References display::fade_to(), game_display_, and luaW_type_error().
|
private |
Definition at line 4642 of file game_lua_kernel.cpp.
References game_display_, and display::scroll().
|
private |
Scrolls to given tile.
Definition at line 3334 of file game_lua_kernel.cpp.
References game_display_, luaW_checklocation(), luaW_toboolean(), display::ONSCREEN, display::ONSCREEN_WARP, display::SCROLL, display::scroll_to_tile(), and display::WARP.
|
private |
Selects and highlights the given location on the map.
Definition at line 3357 of file game_lua_kernel.cpp.
References gui2::event::implementation::fire_event(), play_controller::get_mouse_handler_base(), luaW_checklocation(), luaW_toboolean(), map(), map_location::null_location(), play_controller_, and events::mouse_handler::select_hex().
|
private |
Sets an achievement as being completed.
Definition at line 3078 of file game_lua_kernel.cpp.
References achievement::achieved_, achievement::current_progress_, achievement::description_completed_, ERR_LUA, game_config_manager::get(), achievement::icon_completed_, achievement::id_, luaW_getglobal(), luaW_pcall(), luaW_pushtstring(), achievement::max_progress_, achievement::name_completed_, sound::play_sound(), preferences::set_achievement(), sound::SOUND_FX, and achievement::sound_path_.
Referenced by intf_progress_achievement(), and intf_set_sub_achievement().
|
private |
|
private |
|
private |
Arg 1: text - string Arg 2: options table.
Definition at line 2351 of file game_lua_kernel.cpp.
References font::add_floating_label(), ALPHA_OPAQUE, font::CENTER_ALIGN, color_t::from_hex_string(), game_display_, impl_floating_label_getmethod(), font::LABEL_COLOR, labelKey, font::LEFT_ALIGN, luaW_check_floating_label(), luaW_checklocation(), luaW_checktstring(), luaW_table_set(), luaW_tableget(), luaW_tostring(), display::map_outside_area(), preferences::options(), font::remove_floating_label(), font::RIGHT_ALIGN, font::floating_label::set_alignment(), font::floating_label::set_bg_color(), font::floating_label::set_clip_rect(), font::floating_label::set_color(), font::floating_label::set_font_size(), font::floating_label::set_lifetime(), font::floating_label::set_position(), utf8::size(), and font::SIZE_SMALL.
|
private |
Definition at line 721 of file game_lua_kernel.cpp.
References game_state_, game_state::get_wml_menu_items(), luaW_checkvconfig(), and game_events::wmi_manager::set_item().
|
private |
Definition at line 3637 of file game_lua_kernel.cpp.
References board(), game_config::images::flag, game_display_, game_board::get_team(), luaW_toteam(), display::reinit_flags_for_team(), team::set_color(), team::set_flag(), utf8::size(), t, and teams().
|
private |
Marks a single sub-achievement as completed.
Definition at line 3280 of file game_lua_kernel.cpp.
References sub_achievement::achieved_, achievement::achieved_, achievement::current_progress_, game_config_manager::get(), sub_achievement::id_, achievement::id_, intf_set_achievement(), lua_push(), achievement::max_progress_, preferences::set_sub_achievement(), and achievement::sub_achievements_.
|
private |
Sets a WML variable.
Definition at line 697 of file game_lua_kernel.cpp.
References game_data::clear_variable(), gamedata(), game_data::get_variable_access_write(), and luaW_checkvariable().
|
private |
Sets the owner of a village.
Definition at line 1142 of file game_lua_kernel.cpp.
References board(), gamedata(), game_board::get_team(), team::get_village(), team::lose_village(), luaW_checklocation(), luaW_toboolean(), map(), and display_context::village_owner().
|
private |
Simulates a combat between two units.
Definition at line 3027 of file game_lua_kernel.cpp.
References battle_context::get_attacker_combatant(), battle_context::get_attacker_stats(), battle_context::get_defender_combatant(), battle_context::get_defender_stats(), luaW_checkunit(), luaW_pushsimdata(), luaW_pushsimweapon(), and units().
|
private |
Set whether to skip messages Arg 1 (optional) - boolean.
Definition at line 3405 of file game_lua_kernel.cpp.
References game_state::events_manager_, game_state_, and luaW_toboolean().
|
private |
Teeleports a unit to a location.
Arg 1: unit Arg 2: target location Arg 3: bool (ignore_passability) Arg 4: bool (clear_shroud) Arg 5: bool (animate)
Definition at line 4730 of file game_lua_kernel.cpp.
References actions::shroud_clearer::clear_dest(), actions::clear_shroud(), unit::clear_status_caches(), actions::shroud_clearer::clear_unit(), unit_map::find(), pathfind::find_vacant_tile(), actions::shroud_clearer::fire_events(), game_display_, unit_map::iterator_base< iter_types >::get_shared_ptr(), actions::get_village(), game_display::invalidate_unit_after_move(), luaW_checklocation(), luaW_checkunit_ptr(), luaW_toboolean(), map(), unit_map::move(), unit_display::move_unit(), units(), and pathfind::VACANT_ANY.
|
private |
Implements the lifting and resetting of fog via WML.
Keeping affect_normal_fog as false causes only the fog override to be affected. Otherwise, fog lifting will be implemented similar to normal sight (cannot be individually reset and ends at the end of the turn), and fog resetting will, in addition to removing overrides, extend the specified teams' normal fog to all hexes.
Arg 1: (optional) Side number, or list of side numbers Arg 2: List of locations; each is a two-element array or a table with x and y keys Arg 3: (optional) boolean
Definition at line 4822 of file game_lua_kernel.cpp.
References board(), draw::clear(), game_display_, game_board::get_team(), display::invalidate_all(), luaW_check_locationset(), luaW_toboolean(), luaW_toteam(), display::recalculate_minimap(), utf8::size(), t, and teams().
|
private |
Toggle shroud on some locations Arg 1: Side number Arg 2: List of locations on which to place/remove shroud.
Definition at line 745 of file game_lua_kernel.cpp.
References board(), game_display_, display::invalidate_all(), display::labels(), luaW_check_locationset(), luaW_checkteam(), display::recalculate_minimap(), map_labels::recalculate_shroud(), and t.
|
private |
Returns true if the unit has the given ability enabled.
Definition at line 2910 of file game_lua_kernel.cpp.
References unit::get_ability_bool(), and luaW_checkunit().
|
private |
Gets whether gamemap scrolling is disabled for the user.
Definition at line 842 of file game_lua_kernel.cpp.
References game_display_, and display::view_locked().
|
private |
Definition at line 1772 of file game_lua_kernel.cpp.
References game_display_, display::get_zoom_factor(), luaW_toboolean(), display::set_zoom(), and game_config::tile_size.
void game_lua_kernel::load_game | ( | const config & | level | ) |
Executes the game_events.on_load function and passes to it all the scenario tags not yet handled.
Definition at line 5451 of file game_lua_kernel.cpp.
References is_handled_file_tag(), game_config::images::level, luaW_getglobal(), luaW_pcall(), luaW_pushconfig(), and lua_kernel_base::mState.
|
overridevirtual |
Error reporting mechanisms, used by virtual methods protected_call and load_string.
Reimplemented from lua_kernel_base.
Definition at line 185 of file game_lua_kernel.cpp.
References lua_kernel_base::log_error(), lua_chat(), and wfl::msg().
Referenced by run_filter(), and save_game().
|
private |
Definition at line 191 of file game_lua_kernel.cpp.
References display_chat_manager::add_chat_message(), game_display_, game_display::get_chat_manager(), events::chat_handler::MESSAGE_PUBLIC, and wfl::msg().
Referenced by intf_message(), and log_error().
|
private |
Definition at line 893 of file game_lua_kernel.cpp.
Referenced by impl_current_get(), and intf_get_time_area().
const gamemap & game_lua_kernel::map | ( | ) | const |
Definition at line 4912 of file game_lua_kernel.cpp.
References game_state::board_, game_state_, and game_board::map().
Referenced by intf_erase_unit(), intf_find_path(), intf_get_mouseover_tile(), intf_get_selected_tile(), intf_get_time_of_day(), intf_get_village_owner(), intf_highlight_hex(), intf_put_unit(), intf_select_unit(), intf_set_village_owner(), and intf_teleport().
bool game_lua_kernel::mouse_button_callback | ( | const map_location & | loc, |
const std::string & | button, | ||
const std::string & | event | ||
) |
Definition at line 5955 of file game_lua_kernel.cpp.
References lua_push(), luaW_getglobal(), luaW_pcall(), luaW_toboolean(), lua_kernel_base::mState, map_location::wml_x(), and map_location::wml_y().
void game_lua_kernel::mouse_over_hex_callback | ( | const map_location & | loc | ) |
Definition at line 5942 of file game_lua_kernel.cpp.
References lua_push(), luaW_getglobal(), luaW_pcall(), lua_kernel_base::mState, map_location::wml_x(), and map_location::wml_y().
|
inlineoverridevirtual |
User-visible name of the lua kernel that they are talking to.
Reimplemented from lua_kernel_base.
Definition at line 216 of file game_lua_kernel.hpp.
Referenced by intf_get_sides().
|
inline |
Definition at line 279 of file game_lua_kernel.hpp.
References has_preloaded_.
void game_lua_kernel::push_builtin_effect | ( | ) |
Registers a function for use as an effect handler.
Definition at line 5572 of file game_lua_kernel.cpp.
References lua_kernel_base::mState.
Referenced by game_lua_kernel().
|
private |
Definition at line 2527 of file game_lua_kernel.cpp.
References unit_map::erase(), game_display_, display::invalidate(), units(), and resources::whiteboard.
Referenced by intf_put_unit().
bool game_lua_kernel::run_event | ( | const game_events::queued_event & | ev | ) |
Executes the game_events.on_event function.
Returns false if there was no lua handler for this event
Definition at line 5516 of file game_lua_kernel.cpp.
References luaW_getglobal(), luaW_pcall(), lua_kernel_base::mState, game_events::queued_event::name, and queued_events_.
Referenced by game_events::wml_event_pump::operator()().
bool game_lua_kernel::run_filter | ( | char const * | name, |
const map_location & | l | ||
) |
Runs a script from a location filter.
The script is an already compiled function given by its name.
Definition at line 5804 of file game_lua_kernel.cpp.
References lua_kernel_base::mState, run_filter(), map_location::wml_x(), and map_location::wml_y().
bool game_lua_kernel::run_filter | ( | char const * | name, |
const team & | t | ||
) |
Runs a script from a location filter.
The script is an already compiled function given by its name.
Definition at line 5815 of file game_lua_kernel.cpp.
References luaW_pushteam(), lua_kernel_base::mState, run_filter(), and t.
bool game_lua_kernel::run_filter | ( | char const * | name, |
const unit & | u | ||
) |
Runs a script from a unit filter.
The script is an already compiled function given by its name.
Definition at line 5826 of file game_lua_kernel.cpp.
References luaW_pushlocalunit(), and lua_kernel_base::mState.
Referenced by terrain_filter::match_internal(), side_filter::match_internal(), and run_filter().
bool game_lua_kernel::run_filter | ( | char const * | name, |
int | nArgs | ||
) |
Runs a script from a filter.
The script is an already compiled function given by its name.
Definition at line 5844 of file game_lua_kernel.cpp.
References b, log_error(), luaW_getglobal(), luaW_pcall(), luaW_toboolean(), lua_kernel_base::mState, game_config::path, utils::split(), and utils::STRIP_SPACES.
bool game_lua_kernel::run_wml_action | ( | const std::string & | cmd, |
const vconfig & | cfg, | ||
const game_events::queued_event & | ev | ||
) |
Runs a command from an event handler.
Definition at line 5662 of file game_lua_kernel.cpp.
References luaW_getglobal(), luaW_pcall(), luaW_pushvconfig(), lua_kernel_base::mState, and queued_events_.
bool game_lua_kernel::run_wml_conditional | ( | const std::string & | cmd, |
const vconfig & | cfg | ||
) |
Evaluates a WML conidition.
Definition at line 5685 of file game_lua_kernel.cpp.
References b, ERR_WML, lg::log_to_chat(), luaW_getglobal(), luaW_pcall(), luaW_pushvconfig(), luaW_toboolean(), and lua_kernel_base::mState.
bool game_lua_kernel::run_wml_event | ( | int | ref, |
const vconfig & | args, | ||
const game_events::queued_event & | ev, | ||
bool * | out = nullptr |
||
) |
Run a WML stored in the Lua registry.
ref | The unique index into the EVENT_TABLE within the Lua registry |
args | Arguments to pass to the event function, as a config |
ev | The event data for the event being fired |
out | If non-null, receives the result of the called function (provided it is a boolean value) |
Definition at line 5778 of file game_lua_kernel.cpp.
References EVENT_TABLE, luaW_pcall(), luaW_pushvconfig(), luaW_toboolean(), lua_kernel_base::mState, ON_SCOPE_EXIT, and queued_events_.
Referenced by game_events::event_handler::handle_event(), and lua_event_filter::operator()().
void game_lua_kernel::save_game | ( | config & | cfg | ) |
Executes the game_events.on_save function and adds to cfg the returned tags.
Also flushes the [lua] tags.
Definition at line 5478 of file game_lua_kernel.cpp.
References config::erase(), i, is_handled_file_tag(), log_error(), luaW_getglobal(), luaW_pcall(), luaW_toconfig(), lua_kernel_base::mState, config::ordered_begin(), config::ordered_end(), and config::splice_children().
int game_lua_kernel::save_wml_event | ( | ) |
Store a WML event in the Lua registry, as a function.
Uses a default function that interprets ActionWML.
Definition at line 5720 of file game_lua_kernel.cpp.
References EVENT_TABLE, intf_run_event_wml(), lua_kernel_base::mState, and ON_SCOPE_EXIT.
Referenced by intf_add_event(), intf_add_event_simple(), intf_add_undo_actions(), lua_event_filter::lua_event_filter(), and game_events::event_handler::register_wml_event().
int game_lua_kernel::save_wml_event | ( | const std::string & | name, |
const std::string & | id, | ||
const std::string & | code | ||
) |
Store a WML event in the Lua registry, as a function.
Compiles the function from the given code.
name | The event name, used to generate a chunk name for the compiled function |
id | The event id, used to generate a chunk name for the compiled function |
code | The actual code of the function |
Definition at line 5732 of file game_lua_kernel.cpp.
References ERR_LUA, EVENT_TABLE, lua_kernel_base::load_string(), lua_kernel_base::mState, and ON_SCOPE_EXIT.
int game_lua_kernel::save_wml_event | ( | int | idx | ) |
Store a WML event in the Lua registry, as a function.
Uses the function at the specified Lua stack index.
idx | The Lua stack index of the function to store |
Definition at line 5757 of file game_lua_kernel.cpp.
References EVENT_TABLE, lua_kernel_base::mState, and ON_SCOPE_EXIT.
void game_lua_kernel::select_hex_callback | ( | const map_location & | loc | ) |
Definition at line 5974 of file game_lua_kernel.cpp.
References lua_push(), luaW_getglobal(), luaW_pcall(), lua_kernel_base::mState, map_location::wml_x(), and map_location::wml_y().
void game_lua_kernel::set_game_display | ( | game_display * | gd | ) |
Definition at line 5404 of file game_lua_kernel.cpp.
References game_display_.
void game_lua_kernel::set_wml_action | ( | const std::string & | cmd, |
game_events::wml_action::handler | h | ||
) |
Registers a function for use as an action handler.
Definition at line 5610 of file game_lua_kernel.cpp.
References h, and lua_kernel_base::mState.
Referenced by game_lua_kernel().
void game_lua_kernel::set_wml_condition | ( | const std::string & | , |
bool(*)(const vconfig &) | |||
) |
Registers a function for use as a conditional handler.
Definition at line 5642 of file game_lua_kernel.cpp.
References cfun_wml_condition(), h, and lua_kernel_base::mState.
Referenced by game_lua_kernel().
|
private |
converts synced_context::get_synced_state() to a string.
Definition at line 1671 of file game_lua_kernel.cpp.
References gamedata(), synced_context::get_synced_state(), game_data::INITIAL, synced_context::LOCAL_CHOICE, game_data::PRELOAD, synced_context::SYNCED, and synced_context::UNSYNCED.
Referenced by impl_current_get().
std::vector< team > & game_lua_kernel::teams | ( | ) |
Definition at line 4908 of file game_lua_kernel.cpp.
References game_state::board_, game_state_, and game_board::teams().
Referenced by impl_scenario_set(), intf_add_tile_overlay(), intf_create_side(), intf_end_turn(), intf_find_cost_map(), intf_find_path(), intf_find_reach(), intf_get_displayed_unit(), intf_get_label(), intf_get_recall_units(), intf_get_side(), intf_get_sides(), intf_is_enemy(), intf_match_side(), intf_put_recall_unit(), intf_set_side_id(), and intf_toggle_fog().
|
private |
Definition at line 4920 of file game_lua_kernel.cpp.
References game_state_, and game_state::tod_manager_.
Referenced by impl_game_config_get(), impl_game_config_set(), impl_scenario_get(), impl_scenario_set(), impl_schedule_get(), impl_schedule_len(), impl_schedule_set(), impl_theme_item(), intf_add_time_area(), intf_get_time_area(), intf_get_time_of_day(), intf_remove_time_area(), and intf_replace_schedule().
|
private |
Definition at line 4904 of file game_lua_kernel.cpp.
References game_state::board_, game_state_, and game_board::units().
Referenced by intf_erase_unit(), intf_extract_unit(), intf_find_cost_map(), intf_find_path(), intf_find_reach(), intf_find_vision_range(), intf_fire_wml_menu_item(), intf_get_time_of_day(), intf_get_unit(), intf_get_units(), intf_put_recall_unit(), intf_put_unit(), intf_simulate_combat(), intf_teleport(), and put_unit_helper().
|
friend |
Definition at line 72 of file game_lua_kernel.hpp.
|
private |
Definition at line 61 of file game_lua_kernel.hpp.
Referenced by clear_wml_event(), game_lua_kernel(), run_wml_event(), and save_wml_event().
|
private |
Definition at line 50 of file game_lua_kernel.hpp.
Referenced by get_display(), impl_game_config_set(), impl_theme_item(), intf_add_label(), intf_add_tile_overlay(), intf_clear_messages(), intf_color_adjust(), intf_delay(), intf_deselect_hex(), intf_find_cost_map(), intf_float_label(), intf_gamestate_inspector(), intf_get_color_adjust(), intf_get_displayed_unit(), intf_get_label(), intf_get_mouseover_tile(), intf_get_selected_tile(), intf_highlight_hex(), intf_lock_view(), intf_override_shroud(), intf_redraw(), intf_remove_label(), intf_remove_tile_overlay(), intf_replace_schedule(), intf_screen_fade(), intf_scroll(), intf_scroll_to_tile(), intf_set_floating_label(), intf_set_side_id(), intf_teleport(), intf_toggle_fog(), intf_toggle_shroud(), intf_view_locked(), intf_zoom(), lua_chat(), put_unit_helper(), and set_game_display().
|
private |
Definition at line 51 of file game_lua_kernel.hpp.
Referenced by board(), gamedata(), get_sides_vector(), intf_add_event(), intf_add_event_simple(), intf_add_event_wml(), intf_add_tile_overlay(), intf_add_time_area(), intf_clear_menu_item(), intf_create_side(), intf_find_cost_map(), intf_fire_wml_menu_item(), intf_gamestate_inspector(), intf_get_locations(), intf_get_sides(), intf_is_skipping_messages(), intf_log(), intf_match_location(), intf_match_side(), intf_redraw(), intf_remove_event(), intf_set_menu_item(), intf_skip_messages(), map(), teams(), tod_man(), and units().
|
private |
Definition at line 62 of file game_lua_kernel.hpp.
Referenced by intf_add_event(), intf_add_event_simple(), and preload_finished().
|
private |
Definition at line 60 of file game_lua_kernel.hpp.
Referenced by initialize().
int game_lua_kernel::map_locked_ |
A value != 0 means that the shouldn't remove any units from the map, usually because we are currently operating on a unit& and removing it might cause memory corruptions note that we don't check for the dtor of lua owned units because we assume that we operate on such a unit that the lua function that invoked the operation on that unit (like wesnoth.units.add_modification, wesnoth.units.matches ..) have a local copy of that lua_unit* userdata in its stack that prevents it from being collected.
Definition at line 211 of file game_lua_kernel.hpp.
Referenced by intf_erase_unit(), intf_extract_unit(), intf_put_recall_unit(), intf_put_unit(), map_locker::map_locker(), and map_locker::~map_locker().
|
private |
Definition at line 52 of file game_lua_kernel.hpp.
Referenced by game_lua_kernel(), impl_current_get(), impl_end_level_data_set(), impl_game_config_get(), impl_game_config_set(), impl_run_animation(), impl_scenario_get(), impl_scenario_set(), impl_theme_item(), intf_allow_undo(), intf_cancel_action(), intf_delay(), intf_end_turn(), intf_fire_event(), intf_is_skipping_messages(), intf_log_replay(), intf_play_sound(), intf_put_unit(), and intf_select_unit().
|
staticprivate |
Definition at line 70 of file game_lua_kernel.hpp.
Referenced by extract_preload_scripts(), and initialize().
|
staticprivate |
Definition at line 69 of file game_lua_kernel.hpp.
Referenced by extract_preload_scripts(), and initialize().
|
private |
Definition at line 64 of file game_lua_kernel.hpp.
Referenced by game_lua_kernel(), get_event_info(), run_event(), run_wml_action(), and run_wml_event().
|
private |
Definition at line 53 of file game_lua_kernel.hpp.
Referenced by impl_theme_item(), impl_theme_items_get(), and impl_theme_items_set().