#include "scripting/lua_team.hpp"
#include "scripting/lua_common.hpp"
#include "scripting/push_check.hpp"
#include "scripting/game_lua_kernel.hpp"
#include "team.hpp"
#include "resources.hpp"
#include "game_board.hpp"
#include "game_display.hpp"
#include "map/map.hpp"
#include <string>
Go to the source code of this file.
Namespaces | |
lua_team | |
This namespace contains bindings for lua to hold a pointer to a team, and to access and modify it. | |
Functions | |
static int | impl_side_get (lua_State *L) |
Gets some data on a side (__index metamethod). More... | |
static int | impl_side_tostring (lua_State *L) |
Turns a lua proxy side to string. More... | |
static int | impl_side_set (lua_State *L) |
Sets some data on a side (__newindex metamethod). More... | |
static int | impl_side_equal (lua_State *L) |
static int | impl_side_variables_get (lua_State *L) |
Gets the variable of a side (__index metamethod). More... | |
static int | impl_side_variables_set (lua_State *L) |
Sets the variable of a side (__newindex metamethod). More... | |
std::string | lua_team::register_metatable (lua_State *L) |
void | luaW_pushteam (lua_State *L, team &tm) |
Create a full userdata containing a pointer to the team. More... | |
team & | luaW_checkteam (lua_State *L, int idx) |
Test if the top stack element is a team, and if not, error. More... | |
team & | luaW_checkteam (lua_State *L, int idx, game_board &board) |
Get a team either from a direct userdata or from a side number. More... | |
team * | luaW_toteam (lua_State *L, int idx) |
Test if the top stack element is a team, and if so, return it. More... | |
Variables | |
static const char * | Team = "side" |
Implementation for a lua reference to a team, used by the wesnoth in-game sides table. More... | |
static const char | teamVar [] = "side variables" |
|
static |
Definition at line 238 of file lua_team.cpp.
|
static |
Gets some data on a side (__index metamethod).
Definition at line 52 of file lua_team.cpp.
References d, game_config::images::flag, game_config::images::flag_icon, resources::gameboard, string_enums::enum_base< Definition >::get_string(), i, luaW_checkteam(), luaW_getglobal(), luaW_pushlocation(), game_board::map(), return_bool_attrib, return_cfg_attrib, return_float_attrib, return_int_attrib, return_string_attrib, return_tstring_attrib, gamemap_base::starting_position(), t, and teamVar.
|
static |
Sets some data on a side (__newindex metamethod).
Definition at line 161 of file lua_team.cpp.
|
static |
Turns a lua proxy side to string.
(__tostring metamethod)
Definition at line 140 of file lua_team.cpp.
References luaW_checkteam(), team::side(), and team::side_name().
|
static |
Gets the variable of a side (__index metamethod).
Definition at line 256 of file lua_team.cpp.
|
static |
Sets the variable of a side (__newindex metamethod).
Definition at line 277 of file lua_team.cpp.
team& luaW_checkteam | ( | lua_State * | L, |
int | idx | ||
) |
Test if the top stack element is a team, and if not, error.
Definition at line 347 of file lua_team.cpp.
Referenced by impl_side_get(), impl_side_tostring(), game_lua_kernel::intf_get_fog_or_shroud(), game_lua_kernel::intf_get_label(), game_lua_kernel::intf_override_shroud(), and game_lua_kernel::intf_toggle_shroud().
team& luaW_checkteam | ( | lua_State * | L, |
int | idx, | ||
game_board & | board | ||
) |
Get a team either from a direct userdata or from a side number.
Definition at line 352 of file lua_team.cpp.
void luaW_pushteam | ( | lua_State * | L, |
team & | tm | ||
) |
Create a full userdata containing a pointer to the team.
Definition at line 340 of file lua_team.cpp.
Referenced by game_lua_kernel::intf_get_side(), game_lua_kernel::intf_get_sides(), luaW_pushfaivariant(), and game_lua_kernel::run_filter().
team* luaW_toteam | ( | lua_State * | L, |
int | idx | ||
) |
Test if the top stack element is a team, and if so, return it.
Definition at line 366 of file lua_team.cpp.
Referenced by intf_append_ai(), intf_debug_ai(), lua_formula_bridge::intf_eval_formula(), game_lua_kernel::intf_is_enemy(), game_lua_kernel::intf_match_side(), intf_modify_ai(), game_lua_kernel::intf_set_side_id(), intf_switch_ai(), game_lua_kernel::intf_toggle_fog(), and luaW_tofaivariant().
|
static |
Implementation for a lua reference to a team, used by the wesnoth in-game sides table.
(The userdata has type team** because lua holds only a pointer to a team, not a full-size team. If it were a full object then we would cast to type team *, since checkudata returns a pointer to the type corresponding to the sizeof expr used when we allocated the userdata.)
Definition at line 43 of file lua_team.cpp.
|
static |
Definition at line 44 of file lua_team.cpp.
Referenced by impl_side_get().