#include "scripting/lua_team.hpp"
#include "scripting/lua_attributes.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.
Classes | |
struct | lua_object_traits< team > |
Namespaces | |
lua_team | |
This namespace contains bindings for lua to hold a pointer to a team, and to access and modify it. | |
Macros | |
#define | SIDE_GETTER(name, type) LATTR_GETTER(name, type, team, t) |
#define | SIDE_SETTER(name, type) LATTR_SETTER(name, type, team, t) |
Functions | |
SIDE_GETTER ("side", int) | |
SIDE_GETTER ("save_id", std::string) | |
SIDE_GETTER ("gold", int) | |
SIDE_SETTER ("gold", int) | |
SIDE_GETTER ("objectives", t_string) | |
SIDE_SETTER ("objectives", t_string) | |
SIDE_GETTER ("village_gold", int) | |
SIDE_SETTER ("village_gold", int) | |
SIDE_GETTER ("village_support", int) | |
SIDE_SETTER ("village_support", int) | |
SIDE_GETTER ("num_villages", int) | |
SIDE_GETTER ("recall_cost", int) | |
SIDE_SETTER ("recall_cost", int) | |
SIDE_GETTER ("base_income", int) | |
SIDE_SETTER ("base_income", int) | |
SIDE_GETTER ("total_income", int) | |
SIDE_GETTER ("objectives_changed", bool) | |
SIDE_SETTER ("objectives_changed", bool) | |
SIDE_GETTER ("fog", bool) | |
SIDE_SETTER ("fog", bool) | |
SIDE_GETTER ("shroud", bool) | |
SIDE_SETTER ("shroud", bool) | |
SIDE_GETTER ("hidden", bool) | |
SIDE_SETTER ("hidden", bool) | |
SIDE_GETTER ("scroll_to_leader", bool) | |
SIDE_SETTER ("scroll_to_leader", bool) | |
static void | reinit_flag_for_team (lua_State *L, const team &t) |
SIDE_GETTER ("color", std::string) | |
SIDE_SETTER ("color", std::string) | |
SIDE_GETTER ("flag", std::string) | |
SIDE_SETTER ("flag", std::string) | |
SIDE_GETTER ("flag_icon", std::string) | |
SIDE_SETTER ("flag_icon", std::string) | |
SIDE_GETTER ("user_team_name", t_string) | |
SIDE_SETTER ("user_team_name", t_string) | |
SIDE_GETTER ("team_name", std::string) | |
SIDE_SETTER ("team_name", std::string) | |
SIDE_GETTER ("faction", std::string) | |
SIDE_GETTER ("faction_name", t_string) | |
SIDE_GETTER ("controller", std::string) | |
SIDE_SETTER ("controller", std::string) | |
SIDE_GETTER ("is_local", bool) | |
SIDE_GETTER ("defeat_condition", std::string) | |
SIDE_SETTER ("defeat_condition", std::string) | |
SIDE_GETTER ("share_vision", std::string) | |
SIDE_SETTER ("share_vision", std::string) | |
SIDE_GETTER ("carryover_bonus", double) | |
SIDE_SETTER ("carryover_bonus", double) | |
SIDE_GETTER ("carryover_percentage", int) | |
SIDE_SETTER ("carryover_percentage", int) | |
SIDE_GETTER ("carryover_gold", int) | |
SIDE_SETTER ("carryover_gold", int) | |
SIDE_GETTER ("carryover_add", bool) | |
SIDE_SETTER ("carryover_add", bool) | |
SIDE_GETTER ("lost", bool) | |
SIDE_SETTER ("lost", bool) | |
SIDE_GETTER ("persistent", bool) | |
SIDE_SETTER ("persistent", bool) | |
SIDE_GETTER ("suppress_end_turn_confirmation", bool) | |
SIDE_SETTER ("suppress_end_turn_confirmation", bool) | |
SIDE_GETTER ("share_maps", bool) | |
SIDE_GETTER ("share_view", bool) | |
SIDE_GETTER ("chose_random", bool) | |
SIDE_GETTER ("side_name", t_string) | |
SIDE_SETTER ("side_name", t_string) | |
SIDE_GETTER ("shroud_data", std::string) | |
SIDE_SETTER ("shroud_data", std::string) | |
SIDE_GETTER ("recruit", std::set< std::string >) | |
SIDE_SETTER ("recruit", std::set< std::string >) | |
SIDE_GETTER ("variables", lua_index_raw) | |
SIDE_GETTER ("starting_location", utils::optional< map_location >) | |
SIDE_GETTER ("num_units", int) | |
SIDE_GETTER ("total_upkeep", int) | |
SIDE_GETTER ("expenses", int) | |
SIDE_GETTER ("net_income", int) | |
SIDE_GETTER ("__cfg", config) | |
static int | impl_side_get (lua_State *L) |
Gets some data on a side (__index metamethod). More... | |
static int | impl_side_dir (lua_State *L) |
Gets a list of data on a side (__dir 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" |
luaW_Registry | sideReg {"wesnoth", "sides", Team} |
#define SIDE_GETTER | ( | name, | |
type | |||
) | LATTR_GETTER(name, type, team, t) |
Definition at line 47 of file lua_team.cpp.
#define SIDE_SETTER | ( | name, | |
type | |||
) | LATTR_SETTER(name, type, team, t) |
Definition at line 48 of file lua_team.cpp.
|
static |
Gets a list of data on a side (__dir metamethod).
Definition at line 399 of file lua_team.cpp.
References luaW_Registry::dir(), and sideReg.
|
static |
Definition at line 433 of file lua_team.cpp.
|
static |
Gets some data on a side (__index metamethod).
Definition at line 389 of file lua_team.cpp.
References luaW_Registry::get(), and sideReg.
|
static |
Sets some data on a side (__newindex metamethod).
Definition at line 428 of file lua_team.cpp.
|
static |
Turns a lua proxy side to string.
(__tostring metamethod)
Definition at line 407 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 451 of file lua_team.cpp.
|
static |
Sets the variable of a side (__newindex metamethod).
Definition at line 472 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 543 of file lua_team.cpp.
Referenced by lua_object_traits< team >::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 548 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 536 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 562 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 |
SIDE_GETTER | ( | "__cfg" | , |
config | |||
) |
Definition at line 377 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "base_income" | , |
int | |||
) |
Definition at line 111 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "carryover_add" | , |
bool | |||
) |
Definition at line 277 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "carryover_bonus" | , |
double | |||
) |
Definition at line 253 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "carryover_gold" | , |
int | |||
) |
Definition at line 269 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "carryover_percentage" | , |
int | |||
) |
Definition at line 261 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "chose_random" | , |
bool | |||
) |
Definition at line 317 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "color" | , |
std::string | |||
) |
Definition at line 170 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "controller" | , |
std::string | |||
) |
Definition at line 220 of file lua_team.cpp.
References string_enums::enum_base< Definition >::get_string(), and t.
SIDE_GETTER | ( | "defeat_condition" | , |
std::string | |||
) |
Definition at line 232 of file lua_team.cpp.
References string_enums::enum_base< Definition >::get_string(), and t.
SIDE_GETTER | ( | "expenses" | , |
int | |||
) |
Definition at line 369 of file lua_team.cpp.
References team_data::expenses, resources::gameboard, and t.
SIDE_GETTER | ( | "faction" | , |
std::string | |||
) |
Definition at line 212 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "faction_name" | , |
t_string | |||
) |
Definition at line 216 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "flag" | , |
std::string | |||
) |
Definition at line 179 of file lua_team.cpp.
References game_config::images::flag, and t.
SIDE_GETTER | ( | "flag_icon" | , |
std::string | |||
) |
Definition at line 188 of file lua_team.cpp.
References game_config::images::flag_icon, and t.
SIDE_GETTER | ( | "fog" | , |
bool | |||
) |
Definition at line 131 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "gold" | , |
int | |||
) |
Definition at line 67 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "hidden" | , |
bool | |||
) |
Definition at line 147 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "is_local" | , |
bool | |||
) |
Definition at line 228 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "lost" | , |
bool | |||
) |
Definition at line 285 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "net_income" | , |
int | |||
) |
Definition at line 373 of file lua_team.cpp.
References resources::gameboard, team_data::net_income, and t.
SIDE_GETTER | ( | "num_units" | , |
int | |||
) |
Definition at line 361 of file lua_team.cpp.
References resources::gameboard, t, and team_data::units.
SIDE_GETTER | ( | "num_villages" | , |
int | |||
) |
Definition at line 99 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "objectives" | , |
t_string | |||
) |
Definition at line 75 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "objectives_changed" | , |
bool | |||
) |
Definition at line 123 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "persistent" | , |
bool | |||
) |
Definition at line 293 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "recall_cost" | , |
int | |||
) |
Definition at line 103 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "recruit" | , |
std::set< std::string > | |||
) |
Definition at line 338 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "save_id" | , |
std::string | |||
) |
Definition at line 62 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "scroll_to_leader" | , |
bool | |||
) |
Definition at line 155 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "share_maps" | , |
bool | |||
) |
Definition at line 309 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "share_view" | , |
bool | |||
) |
Definition at line 313 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "share_vision" | , |
std::string | |||
) |
Definition at line 240 of file lua_team.cpp.
References string_enums::enum_base< Definition >::get_string(), and t.
SIDE_GETTER | ( | "shroud" | , |
bool | |||
) |
Definition at line 139 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "shroud_data" | , |
std::string | |||
) |
Definition at line 329 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "side" | , |
int | |||
) |
Definition at line 58 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "side_name" | , |
t_string | |||
) |
Definition at line 321 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "starting_location" | , |
utils::optional< map_location > | |||
) |
Definition at line 355 of file lua_team.cpp.
References resources::gameboard, game_board::map(), gamemap_base::starting_position(), and t.
SIDE_GETTER | ( | "suppress_end_turn_confirmation" | , |
bool | |||
) |
Definition at line 301 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "team_name" | , |
std::string | |||
) |
Definition at line 204 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "total_income" | , |
int | |||
) |
Definition at line 119 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "total_upkeep" | , |
int | |||
) |
Definition at line 365 of file lua_team.cpp.
References resources::gameboard, t, and team_data::upkeep.
SIDE_GETTER | ( | "user_team_name" | , |
t_string | |||
) |
Definition at line 196 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "variables" | , |
lua_index_raw | |||
) |
Definition at line 346 of file lua_team.cpp.
SIDE_GETTER | ( | "village_gold" | , |
int | |||
) |
Definition at line 83 of file lua_team.cpp.
References t.
SIDE_GETTER | ( | "village_support" | , |
int | |||
) |
Definition at line 91 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "base_income" | , |
int | |||
) |
Definition at line 115 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "carryover_add" | , |
bool | |||
) |
Definition at line 281 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "carryover_bonus" | , |
double | |||
) |
Definition at line 257 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "carryover_gold" | , |
int | |||
) |
Definition at line 273 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "carryover_percentage" | , |
int | |||
) |
Definition at line 265 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "color" | , |
std::string | |||
) |
Definition at line 174 of file lua_team.cpp.
References reinit_flag_for_team(), and t.
SIDE_SETTER | ( | "controller" | , |
std::string | |||
) |
Definition at line 224 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "defeat_condition" | , |
std::string | |||
) |
Definition at line 236 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "flag" | , |
std::string | |||
) |
Definition at line 183 of file lua_team.cpp.
References reinit_flag_for_team(), and t.
SIDE_SETTER | ( | "flag_icon" | , |
std::string | |||
) |
Definition at line 192 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "fog" | , |
bool | |||
) |
Definition at line 135 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "gold" | , |
int | |||
) |
Definition at line 71 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "hidden" | , |
bool | |||
) |
Definition at line 151 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "lost" | , |
bool | |||
) |
Definition at line 289 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "objectives" | , |
t_string | |||
) |
Definition at line 79 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "objectives_changed" | , |
bool | |||
) |
Definition at line 127 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "persistent" | , |
bool | |||
) |
Definition at line 297 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "recall_cost" | , |
int | |||
) |
Definition at line 107 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "recruit" | , |
std::set< std::string > | |||
) |
Definition at line 342 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "scroll_to_leader" | , |
bool | |||
) |
Definition at line 159 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "share_vision" | , |
std::string | |||
) |
Definition at line 244 of file lua_team.cpp.
References string_enums::enum_base< Definition >::get_enum(), and t.
SIDE_SETTER | ( | "shroud" | , |
bool | |||
) |
Definition at line 143 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "shroud_data" | , |
std::string | |||
) |
Definition at line 333 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "side_name" | , |
t_string | |||
) |
Definition at line 325 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "suppress_end_turn_confirmation" | , |
bool | |||
) |
Definition at line 305 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "team_name" | , |
std::string | |||
) |
Definition at line 208 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "user_team_name" | , |
t_string | |||
) |
Definition at line 200 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "village_gold" | , |
int | |||
) |
Definition at line 87 of file lua_team.cpp.
References t.
SIDE_SETTER | ( | "village_support" | , |
int | |||
) |
Definition at line 95 of file lua_team.cpp.
References t.
luaW_Registry sideReg {"wesnoth", "sides", Team} |
Definition at line 49 of file lua_team.cpp.
Referenced by impl_side_dir(), and impl_side_get().
|
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 44 of file lua_team.cpp.
|
static |
Definition at line 45 of file lua_team.cpp.
Referenced by SIDE_GETTER().