#include <game_lua_kernel.hpp>
Public Member Functions | |
std::vector< team > & | teams () |
const gamemap & | map () const |
game_lua_kernel (CVideo *, game_state &, play_controller &, reports &) | |
void | set_game_display (game_display *gd) |
virtual std::string | my_name () |
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 (game_events::queued_event const &) |
Executes the game_events.on_event function. More... | |
void | push_builtin_effect () |
Registers a function for use as an effect handler. More... | |
void | set_wml_action (std::string const &, game_events::wml_action::handler) |
Registers a function for use as an action handler. More... | |
bool | run_wml_action (std::string const &, vconfig const &, game_events::queued_event const &) |
Runs a command from an event handler. More... | |
bool | run_filter (char const *name, unit const &u) |
Runs a script from a unit filter. More... | |
bool | run_filter (char const *name, map_location const &l) |
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 (std::string const &, vconfig const &) |
Runs a command from an event handler. More... | |
virtual void | log_error (char const *msg, char const *context="Lua error") |
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) |
int | return_unit_method (lua_State *L, char const *m) |
void | mouse_over_hex_callback (const map_location &loc) |
void | select_hex_callback (const map_location &loc) |
![]() | |
lua_kernel_base (CVideo *ptr) | |
virtual | ~lua_kernel_base () |
void | run_lua_tag (const config &cfg) |
Runs a [lua] tag. More... | |
void | run (char const *prog, int nArgs=0) |
Runs a plain script. More... | |
void | throwing_run (char const *prog, int nArgs) |
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" package into the Lua environment. More... | |
std::vector< std::string > | get_global_var_names () |
Gets all the global variable names in the Lua environment. 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 () |
void | clear_log () |
void | set_external_log (std::ostream *lg) |
virtual void | throw_exception (char const *msg, char const *context="Lua error") |
void | set_video (CVideo *ptr) |
virtual boost::uint32_t | get_random_seed () |
lua_State * | get_state () |
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.add_modification, wesnoth.match_unit ..) have a local copy of that lua_unit* userdata in its stack that prevents it from beeing collected. More... | |
Private Member Functions | |
game_board & | board () |
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_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_animate_unit (lua_State *) |
int | intf_gamestate_inspector (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_get_side_variable (lua_State *L) |
Gets a side specific WML variable. More... | |
int | intf_random (lua_State *L) |
Returns a random numer, same interface as math.random. More... | |
int | intf_set_variable (lua_State *L) |
Sets a WML variable. More... | |
int | intf_set_side_variable (lua_State *L) |
Gets a side specific 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_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 | intf_get_terrain (lua_State *L) |
Gets a terrain code. More... | |
int | intf_set_terrain (lua_State *L) |
Sets a terrain code. More... | |
int | intf_get_terrain_info (lua_State *L) |
Gets details about a terrain. More... | |
int | intf_get_time_of_day (lua_State *L) |
Gets time of day information. More... | |
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_map_size (lua_State *L) |
Returns the map size. 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 | intf_get_starting_location (lua_State *L) |
Returns the starting position of a side. More... | |
int | impl_game_config_get (lua_State *L) |
Gets some game_config data (__index metamethod). More... | |
int | impl_game_config_set (lua_State *L) |
Sets some game_config data (__newindex metamethod). More... | |
int | impl_current_get (lua_State *L) |
Gets some data about current point of game (__index metamethod). More... | |
int | intf_check_end_level_disabled (lua_State *L) |
int | intf_clear_messages (lua_State *) |
Removes all messages from the chat window. More... | |
int | intf_end_level (lua_State *) |
int | intf_end_turn (lua_State *) |
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_cost_map (lua_State *L) |
Is called with one or more units and builds a cost 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_open_help (lua_State *L) |
int | intf_play_sound (lua_State *L) |
Plays a sound, possibly repeated. More... | |
int | intf_print (lua_State *L) |
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_set_menu_item (lua_State *L) |
int | intf_set_next_scenario (lua_State *L) |
int | intf_shroud_op (lua_State *L, bool place_shroud) |
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_hex (lua_State *L) |
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_get_villages (lua_State *L) |
Gets all the villages matching a given filter, or all the villages on the map if no filter is given. 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_modify_ai_wml (lua_State *L) |
int | intf_modify_side (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_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... | |
int | intf_add_event (lua_State *L) |
Adding new events. More... | |
int | intf_remove_event (lua_State *L) |
int | intf_color_adjust (lua_State *L) |
int | intf_delay (lua_State *L) |
Delays engine for a while. More... | |
int | intf_kill (lua_State *L) |
int | intf_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 | intf_set_time_of_day (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) |
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_remove_sound_source (lua_State *L) |
Removes a sound source by its ID Arg 1: sound source ID. More... | |
int | intf_add_sound_source (lua_State *L) |
Add a new sound source Arg 1: Table containing keyword arguments. More... | |
int | intf_get_sound_source (lua_State *L) |
Get an existing sound source Arg 1: The sound source ID Return: Config of sound source info, or nil if it didn't exist This is a copy of the sound source info, so you need to call add_sound_source again after changing it. 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... | |
std::string | synced_state () |
converts synced_context::get_synced_state() to a string. More... | |
void | lua_chat (std::string const &caption, std::string const &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 (config const &game_config) |
Private Attributes | |
game_display * | game_display_ |
game_state & | game_state_ |
play_controller & | play_controller_ |
reports & | reports_ |
config | level_lua_ |
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 | |
![]() | |
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... | |
int | intf_show_dialog (lua_State *L) |
int | intf_show_message_dialog (lua_State *L) |
int | intf_show_popup_dialog (lua_State *L) |
int | intf_show_lua_console (lua_State *L) |
bool | protected_call (int nArgs, int nRets, error_handler) |
bool | load_string (char const *prog, error_handler) |
virtual bool | protected_call (int nArgs, int nRets) |
virtual bool | load_string (char const *prog) |
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... | |
![]() | |
static bool | protected_call (lua_State *L, int nArgs, int nRets, error_handler) |
![]() | |
lua_State * | mState |
CVideo * | video_ |
command_log | cmd_log_ |
Definition at line 48 of file game_lua_kernel.hpp.
game_lua_kernel::game_lua_kernel | ( | CVideo * | video, |
game_state & | gs, | ||
play_controller & | pc, | ||
reports & | reports_object | ||
) |
Definition at line 4501 of file game_lua_kernel.cpp.
References unit::builtin_effects, lua_kernel_base::cmd_log_, getunitKey, gui2::event::handler, impl_unit_attack_get(), impl_unit_attack_set(), impl_unit_attacks_get(), impl_unit_attacks_len(), impl_unit_collect(), impl_unit_equality(), impl_unit_get(), impl_unit_set(), impl_unit_status_get(), impl_unit_status_set(), impl_unit_variables_get(), impl_unit_variables_set(), ai::lua_ai_context::init(), intf_add_known_unit(), intf_add_modification(), intf_advance_unit(), intf_copy_unit(), intf_create_unit(), intf_debug(), intf_debug_ai(), intf_do_unsynced(), intf_eval_conditional(), intf_get_era(), intf_get_image_size(), intf_get_time_stamp(), intf_get_traits(), intf_get_viewing_side(), intf_modify_ai(), intf_set_music(), intf_synchronize_choice(), intf_synchronize_choices(), intf_transform_unit(), intf_unit_ability(), intf_unit_defense(), intf_unit_jamming_cost(), intf_unit_movement_cost(), intf_unit_resistance(), intf_unit_vision_cost(), lua_createtable(), lua_getglobal(), lua_istable, lua_newtable, lua_newuserdata(), lua_pop, lua_pushcfunction, lua_pushlightuserdata(), lua_pushstring(), lua_rawset(), LUA_REGISTRYINDEX, lua_setfield(), lua_setglobal(), lua_setmetatable(), lua_settop(), luaL_setfuncs(), luaW_getglobal(), lua_kernel_base::mState, push_builtin_effect(), push_locations_talbe(), queued_events_, lua_unit_type::register_metatable(), lua_race::register_metatable(), lua_team::register_metatable(), lua_common::register_vconfig_metatable(), game_events::wml_action::registry(), set_wml_action(), uattackKey, uattacksKey, unitvarKey, and ustatusKey.
std::string game_lua_kernel::apply_effect | ( | const std::string & | name, |
unit & | u, | ||
const config & | cfg, | ||
bool | need_apply | ||
) |
Definition at line 5213 of file game_lua_kernel.cpp.
References lua_unit::clear_ref(), ERR_LUA, lua_gettop(), lua_isnone, lua_isnumber(), lua_isstring(), lua_istable, lua_pushvalue(), lua_settop(), lua_tostring, lua_type(), lua_typename(), luaL_getmetafield(), luaW_getglobal(), luaW_pcall(), luaW_pushconfig(), luaW_pushlocalunit(), and lua_kernel_base::mState.
Referenced by unit::add_modification().
|
private |
Definition at line 4456 of file game_lua_kernel.cpp.
References game_state::board_, and game_state_.
Referenced by impl_theme_item(), intf_find_cost_map(), intf_find_path(), intf_find_reach(), intf_get_displayed_unit(), intf_get_map_size(), intf_get_mouseover_tile(), intf_get_selected_tile(), intf_get_starting_location(), intf_get_terrain(), intf_get_terrain_info(), intf_get_time_of_day(), intf_get_village_owner(), intf_set_terrain(), and intf_set_village_owner().
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 5034 of file game_lua_kernel.cpp.
References unit::apply_builtin_effect(), unit::describe_builtin_effect(), lua_unit::get(), lua_pushstring(), lua_tostring, lua_upvalueindex, luaW_checkconfig(), luaW_checkunit(), and luaW_toboolean().
Executes its upvalue as a wml action.
Definition at line 5084 of file game_lua_kernel.cpp.
References get_event_info(), h, lua_touserdata(), lua_upvalueindex, and luaW_checkvconfig().
ai::lua_ai_action_handler * game_lua_kernel::create_lua_ai_action_handler | ( | char const * | code, |
ai::lua_ai_context & | context | ||
) |
Definition at line 5284 of file game_lua_kernel.cpp.
References ai::lua_ai_action_handler::create(), and lua_kernel_base::mState.
Referenced by ai::aspect_attacks_lua::aspect_attacks_lua(), ai::lua_aspect< T >::lua_aspect(), ai::lua_candidate_action_wrapper::lua_candidate_action_wrapper(), ai::lua_candidate_action_wrapper_external::lua_candidate_action_wrapper_external(), ai::lua_stage_wrapper::lua_stage_wrapper(), and ai::lua_goal::on_create().
ai::lua_ai_context * game_lua_kernel::create_lua_ai_context | ( | char const * | code, |
ai::engine_lua * | engine | ||
) |
Definition at line 5279 of file game_lua_kernel.cpp.
References ai::lua_ai_context::create(), and lua_kernel_base::mState.
Definition at line 166 of file game_lua_kernel.cpp.
References config::child(), and config::child_range().
Referenced by game_config_manager::load_game_config().
|
private |
Definition at line 4472 of file game_lua_kernel.cpp.
References game_state_, and game_state::gamedata_.
Referenced by intf_allow_end_turn(), intf_fire_wml_menu_item(), intf_get_all_vars(), intf_get_variable(), intf_heal_unit(), intf_set_next_scenario(), intf_set_variable(), intf_set_village_owner(), and synced_state().
|
private |
Definition at line 4480 of file game_lua_kernel.cpp.
References queued_events_.
Referenced by cfun_wml_action(), impl_current_get(), intf_animate_unit(), intf_heal_unit(), and intf_kill().
Gets a vector of sides from side= attribute in a given config node.
Promotes consistent behavior.
Definition at line 193 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.
Referenced by intf_modify_side(), intf_scroll(), and intf_shroud_op().
Gets some data about current point of game (__index metamethod).
Definition at line 1711 of file game_lua_kernel.cpp.
References config::add_child(), config::child(), play_controller::current_side(), game_events::queued_event::data, game_events::entity_location::filter_x(), game_events::entity_location::filter_y(), get_event_info(), game_events::queued_event::loc1, game_events::queued_event::loc2, luaL_checkstring, luaW_pushconfig(), game_events::queued_event::name, play_controller_, return_int_attrib, return_string_attrib, synced_state(), play_controller::turn(), map_location::valid(), font::weapon, map_location::x, and map_location::y.
Gets some game_config data (__index metamethod).
Definition at line 1615 of file game_lua_kernel.cpp.
References game_config::base_income, config::child_range(), resources::classification, game_config::debug, game_config::debug_lua, game_config_manager::game_config(), game_config_manager::get(), play_controller::get_classification(), play_controller::get_mp_settings(), game_config::kill_experience, LOG_LUA, luaL_checkstring, game_config::mp_debug, mp_game_settings::mp_era, resources::mp_settings, play_controller_, game_config::poison_amount, game_config::recall_cost, game_config::rest_heal_amount, return_bool_attrib, return_cfgref_attrib, return_int_attrib, return_string_attrib, mp_game_settings::to_config(), tod_man(), game_config::version, game_config::village_income, and game_config::village_support.
Sets some game_config data (__newindex metamethod).
Definition at line 1661 of file game_lua_kernel.cpp.
References game_config::base_income, game_config::kill_experience, LOG_LUA, luaL_argerror(), luaL_checkstring, modify_int_attrib, game_config::poison_amount, game_config::recall_cost, game_config::rest_heal_amount, tod_man(), game_config::village_income, and game_config::village_support.
|
private |
Executes its upvalue as a theme item generator.
Definition at line 4219 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().
Creates a field of the theme_items table and returns it (__index metamethod).
Definition at line 4229 of file game_lua_kernel.cpp.
References impl_theme_item(), lua_pushvalue(), lua_rawset(), luaL_checkstring, lua_cpp::push_closure(), reports::register_generator(), and reports_.
Sets a field of the theme_items table (__newindex metamethod).
Definition at line 4243 of file game_lua_kernel.cpp.
References lua_pushvalue(), lua_rawset(), luaL_checkstring, reports::register_generator(), and reports_.
Definition at line 4830 of file game_lua_kernel.cpp.
References config::append_children(), config::child_range(), lua_kernel_base::cmd_log_, config::empty(), level_lua_, game_config::load_config(), load_game(), lua_kernel_base::log_error(), lua_createtable(), lua_getglobal(), lua_newtable, lua_pop, lua_pushstring(), lua_rawget(), lua_setfield(), lua_settop(), luaW_pushracetable(), luaW_pushunittype(), lua_kernel_base::mState, lua_kernel_base::protected_call(), lua_kernel_base::run_lua_tag(), unit_type_data::types(), and unit_types.
Adding new events.
Definition at line 3602 of file game_lua_kernel.cpp.
References game_events::manager::add_event_handler(), game_state::events_manager_, game_state_, vconfig::get_config(), vconfig::get_parsed_config(), and luaW_checkvconfig().
Add a new sound source Arg 1: Table containing keyword arguments.
Definition at line 4337 of file game_lua_kernel.cpp.
References soundsource::manager::add(), config::debug(), ERR_LUA, play_controller::get_soundsource_man(), luaW_checkconfig(), and play_controller_.
Adds an overlay on a tile.
Definition at line 3567 of file game_lua_kernel.cpp.
References display::add_overlay(), game_display_, luaW_checkconfig(), and luaW_checklocation().
Adding new time_areas dynamically with Standard Location Filters.
Definition at line 4080 of file game_lua_kernel.cpp.
References tod_manager::add_time_area(), game_state_, terrain_filter::get_locations(), vconfig::get_parsed_config(), LOG_LUA, log_scope, luaW_checkvconfig(), and tod_man().
Allow undo sets the flag saying whether the event has mutated the game to false.
Definition at line 4061 of file game_lua_kernel.cpp.
References gamedata(), luaW_toboolean(), and game_data::set_allow_end_turn().
Allow undo sets the flag saying whether the event has mutated the game to false.
Definition at line 4068 of file game_lua_kernel.cpp.
References game_events::t_pump::context_mutated(), lua_isboolean, luaW_toboolean(), play_controller_, and play_controller::pump().
Definition at line 821 of file game_lua_kernel.cpp.
References get_event_info(), luaW_checkvconfig(), and unit_display::wml_animation().
Definition at line 1789 of file game_lua_kernel.cpp.
References play_controller::is_regular_game_end(), lua_pushboolean(), and play_controller_.
Definition at line 1195 of file game_lua_kernel.cpp.
References game_events::wmi_container::erase(), game_state_, game_state::get_wml_menu_items(), luaL_checkstring, utils::split(), utils::STRIP_SPACES, and WRN_LUA.
Removes all messages from the chat window.
Definition at line 1798 of file game_lua_kernel.cpp.
References display_chat_manager::clear_chat_messages(), game_display_, and game_display::get_chat_manager().
Definition at line 3621 of file game_lua_kernel.cpp.
References display::adjust_color_overlay(), display::draw(), game_display_, display::invalidate_all(), and luaW_checkvconfig().
Delays engine for a while.
Definition at line 3638 of file game_lua_kernel.cpp.
References CVideo::delay(), game_display_, luaL_checkinteger(), luaW_toboolean(), play_controller_, controller_base::play_slice(), and display::turbo_speed().
Deselects any highlighted hex on the map.
No arguments or return values
Definition at line 2988 of file game_lua_kernel.cpp.
References game_display_, play_controller::get_mouse_handler_base(), game_display::highlight_hex(), play_controller_, and events::mouse_handler::select_hex().
Definition at line 1806 of file game_lua_kernel.cpp.
References transient_end_level::carryover_report, transient_end_level::custom_endlevel_music, play_controller::is_regular_game_end(), end_level_data::is_victory, transient_end_level::linger_mode, luaW_checkvconfig(), play_controller_, end_level_data::prescenario_save, end_level_data::proceed_to_next_level, end_level_data::replay_save, transient_end_level::reveal_map, play_controller::set_end_level_data(), teams(), and end_level_data::transient.
Definition at line 1828 of file game_lua_kernel.cpp.
References play_controller::force_end_turn(), and play_controller_.
Erases a unit from the map.
Definition at line 2469 of file game_lua_kernel.cpp.
References unit_map::erase(), recall_list_manager::erase_if_matches_id(), lua_unit::get(), lua_unit::get_shared(), getunitKey, lua_isnoneornil, lua_touserdata(), luaL_argerror(), luaL_error(), luaW_checkconfig(), luaW_hasmetatable(), luaW_tolocation(), map(), map_locked_, lua_unit::on_map(), lua_unit::on_recall_list(), team::recall_list(), teams(), units(), map_location::x, and map_location::y.
Extracts a unit from the map or a recall list and gives it to Lua.
Definition at line 2561 of file game_lua_kernel.cpp.
References recall_list_manager::erase_if_matches_id(), unit_map::extract(), lua_unit::get_shared(), getunitKey, lua_touserdata(), luaL_argerror(), luaL_error(), luaL_typerror(), luaW_hasmetatable(), map_locked_, lua_unit::on_map(), lua_unit::on_recall_list(), team::recall_list(), teams(), and units().
Is called with one or more units and builds a cost map.
Definition at line 2094 of file game_lua_kernel.cpp.
References pathfind::full_cost_map::add_unit(), board(), map_labels::clear_all(), debug, resources::fake_units, unit_map::find(), unit_type_data::find(), game_display_, game_state_, terrain_filter::get_locations(), pathfind::full_cost_map::get_pair_at(), i, intf_find_cost_map_helper(), display::labels(), load_fake_units(), lua_createtable(), lua_isnil, lua_istable, lua_pop, lua_pushinteger(), lua_pushstring(), lua_rawget(), lua_rawseti(), luaL_argerror(), luaL_checkinteger(), luaW_checklocation(), luaW_toboolean(), luaW_tounit(), luaW_tovconfig(), vconfig::null(), map_labels::set_label(), game_board::teams(), teams(), vconfig::unconstructed_vconfig(), unit_types, units(), and unit_map::iterator_base< iter_types >::valid().
Finds a path between two locations.
Definition at line 1857 of file game_lua_kernel.cpp.
References pathfind::a_star_search(), board(), unit_map::find(), unit::get_location(), unit_map::iterator_base< iter_types >::get_shared_ptr(), pathfind::get_teleport_locations(), gamemap::h(), i, lua_createtable(), lua_isfunction, lua_isnil, lua_istable, lua_isuserdata(), lua_pop, lua_pushinteger(), lua_pushstring(), lua_rawget(), lua_rawseti(), luaL_argerror(), luaL_checkinteger(), luaL_checknumber(), luaW_checklocation(), luaW_checkunit(), luaW_toboolean(), game_board::map(), map(), pathfind::plain_route::move_cost, unit::side(), pathfind::plain_route::steps, game_board::teams(), teams(), units(), unit_map::iterator_base< iter_types >::valid(), and gamemap::w().
Finds all the locations reachable by a unit.
Definition at line 1965 of file game_lua_kernel.cpp.
References board(), pathfind::paths::step::curr, pathfind::paths::destinations, unit_map::find(), unit_map::iterator_base< iter_types >::get_shared_ptr(), i, lua_createtable(), lua_isnil, lua_istable, lua_isuserdata(), lua_pop, lua_pushinteger(), lua_pushstring(), lua_rawget(), lua_rawseti(), lua_tointeger, luaL_argerror(), luaL_checkinteger(), luaW_checklocation(), luaW_checkunit(), luaW_toboolean(), pathfind::paths::step::move_left, unit::side(), game_board::teams(), teams(), units(), unit_map::iterator_base< iter_types >::valid(), map_location::x, and map_location::y.
Finds a vacant tile.
Definition at line 2596 of file game_lua_kernel.cpp.
References pathfind::find_vacant_tile(), getunitKey, lua_isnoneornil, lua_pushinteger(), lua_touserdata(), luaW_checkconfig(), luaW_checklocation(), luaW_hasmetatable(), pathfind::VACANT_ANY, map_location::valid(), map_location::x, and map_location::y.
Fires an event.
Definition at line 1040 of file game_lua_kernel.cpp.
References config::add_child(), game_events::t_pump::fire(), lua_isnoneornil, lua_pushboolean(), luaL_checkstring, luaW_checkconfig(), luaW_tolocation(), play_controller_, pos, and play_controller::pump().
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 1080 of file game_lua_kernel.cpp.
References game_events::wmi_container::fire_item(), game_state_, gamedata(), game_state::get_wml_menu_items(), lua_pushboolean(), luaL_checkstring, luaW_checklocation(), and units().
Floats some text on the map.
Definition at line 2624 of file game_lua_kernel.cpp.
References game_display::float_label(), game_display_, font::LABEL_COLOR, lua_isnoneornil, luaL_checkstring, luaW_checklocation(), luaW_checktstring(), and help::string_to_color().
Definition at line 831 of file game_lua_kernel.cpp.
References game_display_, luaW_checkvconfig(), lua_gui2::show_gamestate_inspector(), and display::video().
Gets all the WML variables currently set.
Definition at line 4257 of file game_lua_kernel.cpp.
References gamedata(), and luaW_pushconfig().
Gets the unit displayed in the sidebar.
Definition at line 883 of file game_lua_kernel.cpp.
References board(), game_display::displayed_unit_hex(), game_board::find_visible_unit(), game_display_, getunitKey, lua_newuserdata(), lua_pushlightuserdata(), lua_rawget(), LUA_REGISTRYINDEX, lua_setmetatable(), display::show_everything(), teams(), unit_map::iterator_base< iter_types >::valid(), and display::viewing_team().
Gets all the locations matching a given filter.
Definition at line 3172 of file game_lua_kernel.cpp.
References game_state_, terrain_filter::get_locations(), i, lua_createtable(), lua_pushinteger(), lua_rawseti(), and luaW_checkvconfig().
Returns the map size.
Definition at line 1529 of file game_lua_kernel.cpp.
References board(), gamemap::border_size(), gamemap::h(), lua_pushinteger(), game_board::map(), map(), and gamemap::w().
Returns the currently overed tile.
Definition at line 1543 of file game_lua_kernel.cpp.
References board(), game_display_, lua_pushinteger(), map(), display::mouseover_hex(), map_location::x, and map_location::y.
Gets the numeric ids of all the units matching a given filter on the recall lists.
Definition at line 996 of file game_lua_kernel.cpp.
References game_state_, getunitKey, i, lua_newtable, lua_newuserdata(), lua_pushlightuserdata(), lua_pushvalue(), lua_rawget(), lua_rawseti(), LUA_REGISTRYINDEX, lua_setmetatable(), lua_settop(), luaW_checkvconfig(), vconfig::null(), and teams().
Returns the currently selected tile.
Definition at line 1561 of file game_lua_kernel.cpp.
References board(), game_display_, lua_pushinteger(), map(), display::selected_hex(), map_location::x, and map_location::y.
Gets a side specific WML variable.
Definition at line 1110 of file game_lua_kernel.cpp.
References luaL_argerror(), luaL_checkinteger(), luaL_checkstring, luaW_pushvariable(), and teams().
Returns a proxy table array for all sides matching the given SSF.
Definition at line 3447 of file game_lua_kernel.cpp.
References game_state_, side_filter::get_teams(), LOG_LUA, lua_createtable(), lua_rawseti(), lua_settop(), luaW_checkvconfig(), luaW_pushteam(), my_name(), vconfig::null(), and teams().
Get an existing sound source Arg 1: The sound source ID Return: Config of sound source info, or nil if it didn't exist This is a copy of the sound source info, so you need to call add_sound_source again after changing it.
Definition at line 4359 of file game_lua_kernel.cpp.
References config::empty(), soundsource::manager::get(), play_controller::get_soundsource_man(), luaL_checkstring, luaW_pushconfig(), and play_controller_.
Returns the starting position of a side.
Arg 1: side number Ret 1: table with unnamed indices holding wml coordinates x and y
Definition at line 1579 of file game_lua_kernel.cpp.
References board(), lua_createtable(), lua_pushinteger(), lua_rawseti(), luaL_argerror(), luaL_checkint, game_board::map(), map(), gamemap::starting_position(), teams(), map_location::x, and map_location::y.
Gets a terrain code.
Definition at line 1332 of file game_lua_kernel.cpp.
References board(), lua_pushstring(), luaW_checklocation(), game_board::map(), and t_translation::write_terrain_code().
Gets details about a terrain.
Definition at line 1380 of file game_lua_kernel.cpp.
References board(), terrain_type::description(), terrain_type::editor_image(), terrain_type::editor_name(), terrain_type::gives_healing(), terrain_type::icon_image(), terrain_type::id(), lg::info(), terrain_type::is_castle(), terrain_type::is_keep(), terrain_type::is_village(), terrain_type::light_bonus(), lua_newtable, lua_push(), lua_pushboolean(), lua_pushinteger(), lua_pushstring(), lua_setfield(), luaL_checkstring, luaW_pushtstring(), game_board::map(), terrain_type::name(), t_translation::NONE_TERRAIN, t_translation::read_terrain_code(), and gamemap::tdata().
Gets time of day information.
Definition at line 1421 of file game_lua_kernel.cpp.
References tod_color::b, board(), time_of_day::bonus_modified, time_of_day::color, tod_color::g, tod_manager::get_illuminated_time_of_day(), tod_manager::get_time_of_day(), time_of_day::id, time_of_day::image, time_of_day::lawful_bonus, lua_isboolean, lua_isnil, lua_isnumber(), lua_istable, lua_newtable, lua_pop, lua_pushinteger(), lua_pushstring(), lua_rawgeti(), lua_setfield(), luaL_argerror(), luaL_checkint, luaW_pushtstring(), luaW_toboolean(), luaW_tolocation(), map(), time_of_day::name, tod_manager::number_of_turns(), tod_color::r, tod_man(), tod_manager::turn(), and units().
Gets the unit at the given location or with the given id.
Definition at line 847 of file game_lua_kernel.cpp.
References unit_map::find(), getunitKey, lua_isnumber(), lua_isstring(), lua_newuserdata(), lua_pushlightuserdata(), lua_rawget(), LUA_REGISTRYINDEX, lua_setmetatable(), luaL_argerror(), luaL_checkstring, luaW_tolocation(), units(), and unit_map::iterator_base< iter_types >::valid().
Gets all the units matching a given filter.
Definition at line 909 of file game_lua_kernel.cpp.
References game_state_, getunitKey, i, lua_newtable, lua_newuserdata(), lua_pushlightuserdata(), lua_pushvalue(), lua_rawget(), lua_rawseti(), LUA_REGISTRYINDEX, lua_setmetatable(), lua_settop(), and luaW_checkvconfig().
Gets a WML variable.
Definition at line 1097 of file game_lua_kernel.cpp.
References gamedata(), game_data::get_variable_access_read(), luaL_checkstring, and luaW_pushvariable().
Gets the side of a village owner.
Definition at line 1482 of file game_lua_kernel.cpp.
References board(), lua_pushinteger(), luaW_checklocation(), map(), and display_context::village_owner().
Gets all the villages matching a given filter, or all the villages on the map if no filter is given.
Definition at line 3201 of file game_lua_kernel.cpp.
References game_state_, i, lua_createtable(), lua_newtable, lua_pushinteger(), lua_rawseti(), luaW_checkvconfig(), map(), terrain_filter::match(), and gamemap::villages().
Definition at line 2256 of file game_lua_kernel.cpp.
References amount, unit_map::begin(), config::attribute_value::blank(), vconfig::child(), unit_map::end(), unit_map::find(), game_state_, gamedata(), get_event_info(), game_data::get_variable(), game_events::queued_event::loc1, luaW_checkvconfig(), vconfig::null(), unit::STATE_PETRIFIED, unit::STATE_POISONED, unit::STATE_SLOWED, unit::STATE_UNHEALABLE, unit_display::unit_healing(), and units().
Highlights the given location on the map.
Definition at line 1272 of file game_lua_kernel.cpp.
References game_display::display_unit_hex(), game_display_, game_display::highlight_hex(), luaL_argerror(), luaW_checklocation(), and map().
Referenced by intf_select_hex().
Returns whether the first side is an enemy of the second one.
Definition at line 1291 of file game_lua_kernel.cpp.
References lua_pushboolean(), luaL_checkint, and teams().
Return true if a replay is in progress but the player has chosen to skip it.
Definition at line 3002 of file game_lua_kernel.cpp.
References game_state::events_manager_, game_state_, play_controller::is_skipping_replay(), lua_pushboolean(), and play_controller_.
Definition at line 3692 of file game_lua_kernel.cpp.
References unit_map::begin(), vconfig::child(), config::attribute_value::empty(), unit_map::erase(), ERR_LUA, gui2::event::find(), unit_map::find(), game_events::t_pump::fire(), gui2::event::implementation::fire_event(), game_display_, game_state_, get_event_info(), vconfig::has_child(), display::invalidate(), game_events::queued_event::loc1, lua_pushinteger(), luaW_checkvconfig(), game_events::entity_location::matches_unit(), game_events::queued_event::name, play_controller_, play_controller::pump(), display::redraw_minimap(), display::scroll_to_tile(), teams(), unit_display::unit_die(), units(), and WRN_LUA.
Definition at line 3816 of file game_lua_kernel.cpp.
References game_display_, vconfig::get_config(), display::labels(), luaW_checkvconfig(), resources::screen, and map_labels::set_label().
Sets whether gamemap scrolling is disabled for the user.
Definition at line 1318 of file game_lua_kernel.cpp.
References game_display_, luaW_toboolean(), and display::set_view_locked().
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 4380 of file game_lua_kernel.cpp.
References game_state::events_manager_, game_state_, lua_isstring(), luaL_checkstring, luaW_toboolean(), game_logic::msg(), and lg::wml_error().
Matches a location against the given filter.
Definition at line 3231 of file game_lua_kernel.cpp.
References game_state_, lua_pushboolean(), luaW_checklocation(), luaW_checkvconfig(), terrain_filter::match(), and vconfig::null().
Matches a side against the given filter.
Definition at line 3255 of file game_lua_kernel.cpp.
References game_state_, lua_pushboolean(), luaL_checkinteger(), luaW_checkvconfig(), side_filter::match(), vconfig::null(), and teams().
Matches a unit against the given filter.
Definition at line 941 of file game_lua_kernel.cpp.
References recall_list_manager::find_index(), game_state_, lua_unit::get(), unit::get_location(), getunitKey, unit::id(), lua_pushboolean(), lua_touserdata(), luaL_argerror(), luaL_typerror(), luaW_checkvconfig(), luaW_hasmetatable(), luaW_tolocation(), vconfig::null(), lua_unit::on_recall_list(), team::recall_list(), team::save_id(), teams(), and WRN_LUA.
Displays a message in the chat window and in the logs.
Definition at line 1754 of file game_lua_kernel.cpp.
References LOG_LUA, lua_chat(), lua_isnone, and luaW_checktstring().
Definition at line 3272 of file game_lua_kernel.cpp.
References game_state_, vconfig::get_parsed_config(), side_filter::get_teams(), luaW_checkvconfig(), and ai::manager::modify_active_ai_for_side().
Definition at line 3285 of file game_lua_kernel.cpp.
References ai::manager::add_ai_for_side_from_file(), game_config::base_income, team::change_controller_by_wml(), team::change_team(), config::child_range(), config::attribute_value::empty(), game_config::images::flag, game_config::images::flag_icon, preferences::fog(), game_display_, vconfig::get_parsed_config(), get_sides_vector(), team::handle_legacy_share_vision(), display::invalidate_all(), LOG_LUA, luaW_checkvconfig(), team::merge_shroud_map_data(), ai::manager::modify_active_ai_config_old_for_side(), display::recalculate_minimap(), team::refog(), display::reinit_flags_for_side(), team::reshroud(), team::set_base_income(), team::set_color(), team::set_defeat_condition_string(), team::set_flag(), team::set_flag_icon(), team::set_fog(), team::set_gold(), team::set_hidden(), team::set_no_turn_confirmation(), team::set_recruits(), team::set_scroll_to_leader(), team::set_shroud(), utils::set_split(), team::set_village_gold(), team::set_village_support(), preferences::shroud(), team::team_name(), teams(), config::attribute_value::to_bool(), config::attribute_value::to_int(), preferences::village_gold(), and game_config::village_support.
Definition at line 1768 of file game_lua_kernel.cpp.
References game_display_, luaL_checkstring, help::show_help(), and display::video().
Plays a sound, possibly repeated.
Definition at line 2921 of file game_lua_kernel.cpp.
References play_controller::is_skipping_replay(), lua_tointeger, luaL_checkstring, play_controller_, sound::play_sound(), and sound::SOUND_FX.
Definition at line 2338 of file game_lua_kernel.cpp.
References font::add_floating_label(), create_color(), game_display_, vconfig::has_attribute(), font::LABEL_COLOR, luaW_checkvconfig(), display::map_outside_area(), font::remove_floating_label(), 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(), font::SIZE_SMALL, and help::string_to_color().
Puts a unit on a recall list.
Definition at line 2518 of file game_lua_kernel.cpp.
References recall_list_manager::add(), unit_map::erase(), recall_list_manager::erase_by_underlying_id(), lua_unit::get_shared(), getunitKey, lua_tointeger, lua_touserdata(), luaL_argerror(), luaL_error(), luaW_checkconfig(), luaW_hasmetatable(), map_locked_, lua_unit::on_map(), lua_unit::on_recall_list(), team::recall_list(), teams(), and units().
Places a unit on the map.
Definition at line 2385 of file game_lua_kernel.cpp.
References unit_map::erase(), game_events::t_pump::fire(), game_display_, lua_unit::get_shared(), getunitKey, unit_map::insert(), display::invalidate(), lua_isnoneornil, lua_isnumber(), lua_tointeger, lua_touserdata(), luaL_argerror(), luaL_checkinteger(), luaL_error(), luaW_checkconfig(), luaW_hasmetatable(), luaW_toboolean(), luaW_tolocation(), map(), map_locked_, lua_unit::on_map(), play_controller_, play_controller::pump(), lua_unit::put_map(), units(), map_location::valid(), WRN_LUA, map_location::x, and map_location::y.
Returns a random numer, same interface as math.random.
Definition at line 1162 of file game_lua_kernel.cpp.
References random_new::generator, lua_isnoneornil, lua_isnumber(), lua_push(), and luaL_argerror().
Definition at line 3831 of file game_lua_kernel.cpp.
References actions::clear_shroud(), display::draw(), game_display_, game_state_, side_filter::get_teams(), display::invalidate_all(), luaW_checkvconfig(), luaW_toboolean(), game_display::maybe_rebuild(), display::recalculate_minimap(), and resources::screen.
Definition at line 3615 of file game_lua_kernel.cpp.
References game_state::events_manager_, game_state_, and luaL_checkstring.
Removes a sound source by its ID Arg 1: sound source ID.
Definition at line 4325 of file game_lua_kernel.cpp.
References play_controller::get_soundsource_man(), luaL_checkstring, play_controller_, and soundsource::manager::remove().
Removes an overlay from a tile.
Definition at line 3584 of file game_lua_kernel.cpp.
References game_display_, lua_tostring, luaW_checklocation(), display::remove_overlay(), and display::remove_single_overlay().
Removing new time_areas dynamically with Standard Location Filters.
Definition at line 4097 of file game_lua_kernel.cpp.
References LOG_LUA, log_scope, luaL_checkstring, tod_manager::remove_time_area(), and tod_man().
Replacing the current time of day schedule.
Definition at line 4109 of file game_lua_kernel.cpp.
References ERR_LUA, game_display_, vconfig::get_children(), vconfig::get_parsed_config(), LOG_LUA, luaW_checkvconfig(), game_display::new_turn(), tod_manager::replace_schedule(), and tod_man().
Definition at line 4171 of file game_lua_kernel.cpp.
References display::draw(), game_display_, get_sides_vector(), vconfig::has_child(), luaW_checkvconfig(), display::scroll(), and teams().
Scrolls to given tile.
Definition at line 2936 of file game_lua_kernel.cpp.
References game_display_, luaW_checklocation(), luaW_toboolean(), display::SCROLL, display::scroll_to_tile(), and display::WARP.
Definition at line 2948 of file game_lua_kernel.cpp.
References ERR_LUA, intf_highlight_hex(), intf_select_unit(), lua_isnoneornil, lua_replace(), luaW_checklocation(), luaW_pushlocation(), and luaW_toboolean().
Selects and highlights the given location on the map.
Definition at line 2971 of file game_lua_kernel.cpp.
References gui2::event::implementation::fire_event(), play_controller::get_mouse_handler_base(), lua_isnoneornil, luaL_argerror(), luaW_checklocation(), luaW_toboolean(), map(), play_controller_, and events::mouse_handler::select_hex().
Referenced by intf_select_hex().
Definition at line 1208 of file game_lua_kernel.cpp.
References resources::classification, game_classification::end_credits, play_controller::get_classification(), luaW_toboolean(), and play_controller_.
Definition at line 1215 of file game_lua_kernel.cpp.
References resources::classification, game_classification::end_text, game_classification::end_text_duration, play_controller::get_classification(), lua_isnumber(), lua_tonumber, luaW_checktstring(), and play_controller_.
Definition at line 1189 of file game_lua_kernel.cpp.
References game_state_, game_state::get_wml_menu_items(), luaL_checkstring, luaW_checkvconfig(), and game_events::wmi_container::set_item().
Definition at line 1226 of file game_lua_kernel.cpp.
References gamedata(), luaL_checkstring, and game_data::set_next_scenario().
Gets a side specific WML variable.
Definition at line 1128 of file game_lua_kernel.cpp.
References luaL_argerror(), luaL_checkinteger(), luaL_checkstring, luaW_checkvariable(), and teams().
Sets a terrain code.
Definition at line 1349 of file game_lua_kernel.cpp.
References board(), game_board::change_terrain(), game_display_, lua_isnil, lua_isnone, lua_isnoneornil, luaL_checkstring, luaW_checklocation(), luaW_toboolean(), and game_display::needs_rebuild().
Definition at line 4125 of file game_lua_kernel.cpp.
References gui2::event::find(), game_display_, tod_manager::get_area_ids(), lua_isstring(), lua_tonumberx(), lua_tostring, luaL_argerror(), luaL_checkstring, tod_manager::set_current_time(), tod_manager::times(), and tod_man().
Sets a WML variable.
Definition at line 1146 of file game_lua_kernel.cpp.
References game_data::clear_variable(), gamedata(), game_data::get_variable_access_write(), lua_isnoneornil, luaL_argerror(), luaL_checkstring, and luaW_checkvariable().
Sets the owner of a village.
Definition at line 1499 of file game_lua_kernel.cpp.
References board(), gamedata(), lua_isnoneornil, luaL_checkint, luaW_checklocation(), luaW_toboolean(), map(), teams(), and display_context::village_owner().
Definition at line 1232 of file game_lua_kernel.cpp.
References team::clear_shroud(), game_display_, game_state_, terrain_filter::get_locations(), get_sides_vector(), display::invalidate_all(), display::labels(), luaW_checkvconfig(), team::place_shroud(), display::recalculate_minimap(), map_labels::recalculate_shroud(), and teams().
Simulates a combat between two units.
Definition at line 2868 of file game_lua_kernel.cpp.
References unit::attacks(), unit::get_location(), lua_isnumber(), lua_tointeger, luaL_argerror(), luaW_checkunit(), luaW_pushsimdata(), luaW_pushsimweapon(), and units().
Set whether to skip messages Arg 1 (optional) - boolean.
Definition at line 3016 of file game_lua_kernel.cpp.
References game_state::events_manager_, game_state_, lua_isnone, and luaW_toboolean().
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 4270 of file game_lua_kernel.cpp.
References actions::shroud_clearer::clear_dest(), actions::clear_shroud(), unit::clear_status_caches(), actions::shroud_clearer::clear_unit(), display::draw(), unit_map::find(), pathfind::find_vacant_tile(), actions::shroud_clearer::fire_events(), game_display_, actions::get_village(), game_display::invalidate_unit_after_move(), luaW_checklocation(), luaW_checkunit_ptr(), luaW_toboolean(), map(), unit_map::move(), unit_display::move_unit(), gamemap::on_board(), units(), and pathfind::VACANT_ANY.
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 4406 of file game_lua_kernel.cpp.
References team::add_fog_override(), team::clear_fog(), game_display_, display::invalidate_all(), lua_isboolean, lua_isnumber(), lua_istable, lua_tonumber, luaW_toboolean(), display::recalculate_minimap(), team::refog(), team::remove_fog_override(), and teams().
Gets whether gamemap scrolling is disabled for the user.
Definition at line 1304 of file game_lua_kernel.cpp.
References game_display_, lua_pushboolean(), and display::view_locked().
Executes the game_events.on_load function and passes to it all the scenario tags not yet handled.
Definition at line 4949 of file game_lua_kernel.cpp.
References config::all_children_range(), is_handled_file_tag(), lua_createtable(), lua_newtable, lua_pushstring(), lua_rawseti(), luaW_getglobal(), luaW_pcall(), luaW_pushconfig(), and lua_kernel_base::mState.
Referenced by initialize().
Reimplemented from lua_kernel_base.
Definition at line 175 of file game_lua_kernel.cpp.
References lua_kernel_base::log_error(), and lua_chat().
Referenced by run_filter(), and save_game().
|
private |
Definition at line 181 of file game_lua_kernel.cpp.
References display_chat_manager::add_chat_message(), game_display_, game_display::get_chat_manager(), and events::chat_handler::MESSAGE_PUBLIC.
Referenced by intf_message(), and log_error().
const gamemap & game_lua_kernel::map | ( | ) | const |
Definition at line 4468 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_map_size(), intf_get_mouseover_tile(), intf_get_selected_tile(), intf_get_starting_location(), intf_get_time_of_day(), intf_get_village_owner(), intf_get_villages(), intf_highlight_hex(), intf_put_unit(), intf_select_unit(), intf_set_village_owner(), and intf_teleport().
void game_lua_kernel::mouse_over_hex_callback | ( | const map_location & | loc | ) |
Definition at line 5289 of file game_lua_kernel.cpp.
References lua_push(), luaW_getglobal(), luaW_pcall(), lua_kernel_base::mState, map_location::x, and map_location::y.
|
inlinevirtual |
Reimplemented from lua_kernel_base.
Definition at line 193 of file game_lua_kernel.hpp.
Referenced by intf_get_sides().
void game_lua_kernel::push_builtin_effect | ( | ) |
Registers a function for use as an effect handler.
Definition at line 5059 of file game_lua_kernel.cpp.
References lua_gettop(), lua_newtable, lua_pushboolean(), lua_pushcclosure(), lua_pushstring(), lua_pushvalue(), lua_rawset(), lua_setmetatable(), and lua_kernel_base::mState.
Referenced by game_lua_kernel().
Definition at line 4889 of file game_lua_kernel.cpp.
References intf_add_modification(), intf_advance_unit(), intf_copy_unit(), intf_transform_unit(), intf_unit_ability(), intf_unit_defense(), intf_unit_jamming_cost(), intf_unit_movement_cost(), intf_unit_resistance(), intf_unit_vision_cost(), and lua_pushcfunction.
bool game_lua_kernel::run_event | ( | game_events::queued_event const & | ev | ) |
Executes the game_events.on_event function.
Returns false if there was no lua handler for this event
Definition at line 5014 of file game_lua_kernel.cpp.
References lua_pushstring(), luaW_getglobal(), luaW_pcall(), lua_kernel_base::mState, game_events::queued_event::name, and queued_events_.
bool game_lua_kernel::run_filter | ( | char const * | name, |
unit const & | u | ||
) |
Runs a script from a unit filter.
The script is an already compiled function given by its name.
Definition at line 5174 of file game_lua_kernel.cpp.
References unit_map::find(), unit::get_location(), getunitKey, lua_newuserdata(), lua_pushlightuserdata(), lua_rawget(), LUA_REGISTRYINDEX, lua_setmetatable(), lua_kernel_base::mState, units(), and unit_map::iterator_base< iter_types >::valid().
Referenced by terrain_filter::match_internal(), and run_filter().
bool game_lua_kernel::run_filter | ( | char const * | name, |
map_location const & | l | ||
) |
Runs a script from a location filter.
The script is an already compiled function given by its name.
Definition at line 5164 of file game_lua_kernel.cpp.
References lua_pushinteger(), lua_kernel_base::mState, run_filter(), map_location::x, and map_location::y.
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 5191 of file game_lua_kernel.cpp.
References log_error(), lua_insert(), lua_pop, luaW_getglobal(), luaW_pcall(), luaW_toboolean(), lua_kernel_base::mState, utils::split(), and utils::STRIP_SPACES.
bool game_lua_kernel::run_wml_action | ( | std::string const & | cmd, |
vconfig const & | cfg, | ||
game_events::queued_event const & | ev | ||
) |
Runs a command from an event handler.
Definition at line 5117 of file game_lua_kernel.cpp.
References luaW_getglobal(), luaW_pcall(), luaW_pushvconfig(), lua_kernel_base::mState, and queued_events_.
Referenced by game_events::event_handler::handle_event().
bool game_lua_kernel::run_wml_conditional | ( | std::string const & | cmd, |
vconfig const & | cfg | ||
) |
Runs a command from an event handler.
Definition at line 5139 of file game_lua_kernel.cpp.
References lua_pop, luaL_argerror(), luaW_getglobal(), luaW_pcall(), luaW_pushvconfig(), luaW_toboolean(), and lua_kernel_base::mState.
Executes the game_events.on_save function and adds to cfg the returned tags.
Also flushes the [lua] tags.
Definition at line 4976 of file game_lua_kernel.cpp.
References config::erase(), i, is_handled_file_tag(), log_error(), lua_pop, luaW_getglobal(), luaW_pcall(), luaW_toconfig(), lua_kernel_base::mState, config::ordered_begin(), config::ordered_end(), and config::splice_children().
void game_lua_kernel::select_hex_callback | ( | const map_location & | loc | ) |
Definition at line 5302 of file game_lua_kernel.cpp.
References lua_push(), luaW_getglobal(), luaW_pcall(), lua_kernel_base::mState, map_location::x, and map_location::y.
void game_lua_kernel::set_game_display | ( | game_display * | gd | ) |
Definition at line 4919 of file game_lua_kernel.cpp.
References game_display_, lua_kernel_base::set_video(), and display::video().
void game_lua_kernel::set_wml_action | ( | std::string const & | cmd, |
game_events::wml_action::handler | h | ||
) |
Registers a function for use as an action handler.
Definition at line 5097 of file game_lua_kernel.cpp.
References lua_getglobal(), lua_pop, lua_pushcclosure(), lua_pushlightuserdata(), lua_pushstring(), lua_rawget(), lua_rawset(), and lua_kernel_base::mState.
Referenced by game_lua_kernel().
|
private |
converts synced_context::get_synced_state() to a string.
Definition at line 1684 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 4464 of file game_lua_kernel.cpp.
References game_state::board_, game_state_, and game_board::teams_.
Referenced by intf_end_level(), intf_erase_unit(), intf_extract_unit(), intf_find_cost_map(), intf_find_path(), intf_find_reach(), intf_get_displayed_unit(), intf_get_recall_units(), intf_get_side_variable(), intf_get_sides(), intf_get_starting_location(), intf_is_enemy(), intf_kill(), intf_match_side(), intf_match_unit(), intf_modify_side(), intf_put_recall_unit(), intf_scroll(), intf_set_side_variable(), intf_set_village_owner(), intf_shroud_op(), and intf_toggle_fog().
|
private |
Definition at line 4476 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_theme_item(), intf_add_time_area(), intf_get_time_of_day(), intf_remove_time_area(), intf_replace_schedule(), and intf_set_time_of_day().
|
private |
Definition at line 4460 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_fire_wml_menu_item(), intf_get_time_of_day(), intf_get_unit(), intf_heal_unit(), intf_kill(), intf_put_recall_unit(), intf_put_unit(), intf_simulate_combat(), intf_teleport(), and run_filter().
|
friend |
Definition at line 71 of file game_lua_kernel.hpp.
|
private |
Definition at line 50 of file game_lua_kernel.hpp.
Referenced by impl_theme_item(), 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_displayed_unit(), intf_get_mouseover_tile(), intf_get_selected_tile(), intf_highlight_hex(), intf_kill(), intf_label(), intf_lock_view(), intf_modify_side(), intf_open_help(), intf_print(), intf_put_unit(), intf_redraw(), intf_remove_tile_overlay(), intf_replace_schedule(), intf_scroll(), intf_scroll_to_tile(), intf_set_terrain(), intf_set_time_of_day(), intf_shroud_op(), intf_teleport(), intf_toggle_fog(), intf_view_locked(), lua_chat(), 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_time_area(), intf_clear_menu_item(), intf_find_cost_map(), intf_fire_wml_menu_item(), intf_get_locations(), intf_get_recall_units(), intf_get_sides(), intf_get_units(), intf_get_villages(), intf_heal_unit(), intf_is_skipping_messages(), intf_kill(), intf_log(), intf_match_location(), intf_match_side(), intf_match_unit(), intf_modify_ai_wml(), intf_redraw(), intf_remove_event(), intf_set_menu_item(), intf_shroud_op(), intf_skip_messages(), map(), teams(), tod_man(), and units().
|
private |
Definition at line 61 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.add_modification, wesnoth.match_unit ..) have a local copy of that lua_unit* userdata in its stack that prevents it from beeing collected.
Definition at line 188 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 impl_current_get(), impl_game_config_get(), impl_theme_item(), intf_add_sound_source(), intf_allow_undo(), intf_check_end_level_disabled(), intf_delay(), intf_deselect_hex(), intf_end_level(), intf_end_turn(), intf_fire_event(), intf_get_sound_source(), intf_is_skipping_messages(), intf_kill(), intf_play_sound(), intf_put_unit(), intf_remove_sound_source(), intf_select_unit(), intf_set_end_campaign_credits(), and intf_set_end_campaign_text().
|
staticprivate |
Definition at line 69 of file game_lua_kernel.hpp.
|
staticprivate |
Definition at line 68 of file game_lua_kernel.hpp.
|
private |
Definition at line 63 of file game_lua_kernel.hpp.
Referenced by game_lua_kernel(), get_event_info(), run_event(), and run_wml_action().
|
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().