#include "scripting/lua_unit_type.hpp"#include "scripting/lua_attributes.hpp"#include "scripting/lua_common.hpp"#include "scripting/lua_unit_attacks.hpp"#include "scripting/push_check.hpp"#include "units/types.hpp"#include <string>#include <cstring>Go to the source code of this file.
Classes | |
| struct | lua_object_traits< unit_type > |
Namespaces | |
| lua_unit_type | |
| This namespace contains bindings for lua to hold a reference to a unit type and access its stats. | |
Macros | |
| #define | UNIT_TYPE_GETTER(name, type) LATTR_GETTER(name, type, unit_type, ut) |
| #define | UNIT_TYPE_VALID(name) LATTR_VALID(name, unit_type, ut) |
Typedefs | |
| using | traits_map = std::map< std::string, config > |
Functions | |
| UNIT_TYPE_GETTER ("name", t_string) | |
| UNIT_TYPE_GETTER ("id", std::string) | |
| UNIT_TYPE_GETTER ("alignment", std::string) | |
| UNIT_TYPE_GETTER ("race", std::string) | |
| UNIT_TYPE_GETTER ("image", std::string) | |
| UNIT_TYPE_GETTER ("icon", std::string) | |
| UNIT_TYPE_GETTER ("profile", std::string) | |
| UNIT_TYPE_GETTER ("small_profile", std::string) | |
| UNIT_TYPE_GETTER ("max_hitpoints", int) | |
| UNIT_TYPE_GETTER ("max_moves", int) | |
| UNIT_TYPE_GETTER ("max_experience", int) | |
| UNIT_TYPE_GETTER ("cost", int) | |
| UNIT_TYPE_GETTER ("level", int) | |
| UNIT_TYPE_GETTER ("recall_cost", int) | |
| UNIT_TYPE_GETTER ("advances_to", std::vector< std::string >) | |
| UNIT_TYPE_GETTER ("advances_from", std::vector< std::string >) | |
| UNIT_TYPE_GETTER ("__cfg", config) | |
| UNIT_TYPE_GETTER ("traits", traits_map) | |
| UNIT_TYPE_GETTER ("abilities", std::vector< std::string >) | |
| UNIT_TYPE_GETTER ("attacks", lua_index_raw) | |
| UNIT_TYPE_VALID ("variations") | |
| UNIT_TYPE_GETTER ("variations", lua_index_raw) | |
| static int | impl_unit_type_get (lua_State *L) |
| Gets some data on a unit type (__index metamethod). More... | |
| static int | impl_unit_type_dir (lua_State *L) |
| Gets a list of data on a unit type (__dir metamethod). More... | |
| static int | impl_unit_type_equal (lua_State *L) |
| static int | impl_unit_type_list (lua_State *L) |
| static int | impl_unit_type_lookup (lua_State *L) |
| static int | impl_unit_type_new (lua_State *L) |
| static int | impl_unit_type_count (lua_State *L) |
| static int | impl_unit_type_next (lua_State *L) |
| static int | impl_unit_type_pairs (lua_State *L) |
| static int | impl_unit_type_tostring (lua_State *L) |
| Turns a lua proxy unit type to string. More... | |
| std::string | lua_unit_type::register_metatable (lua_State *L) |
| std::string | lua_unit_type::register_table (lua_State *L) |
| void | luaW_pushunittype (lua_State *L, const unit_type &ut) |
| Create a lua object containing a reference to a unittype, and a metatable to access the properties. More... | |
| const unit_type * | luaW_tounittype (lua_State *L, int idx) |
| Test if a stack element is a unit type, and return it if so. More... | |
| const unit_type & | luaW_checkunittype (lua_State *L, int idx) |
| Test if a stack element is a unit type, and return it if so. More... | |
Variables | |
| static const char | UnitType [] = "unit type" |
| Implementation for a lua reference to a unit_type. More... | |
| static const char | UnitTypeTable [] = "unit types" |
| luaW_Registry | unitTypeReg {UnitType} |
| #define UNIT_TYPE_GETTER | ( | name, | |
| type | |||
| ) | LATTR_GETTER(name, type, unit_type, ut) |
Definition at line 36 of file lua_unit_type.cpp.
| #define UNIT_TYPE_VALID | ( | name | ) | LATTR_VALID(name, unit_type, ut) |
Definition at line 37 of file lua_unit_type.cpp.
| using traits_map = std::map<std::string,config> |
Definition at line 115 of file lua_unit_type.cpp.
|
static |
Definition at line 224 of file lua_unit_type.cpp.
References unit_type_data::types(), and unit_types.
Referenced by lua_unit_type::register_table().
|
static |
Gets a list of data on a unit type (__dir metamethod).
Definition at line 160 of file lua_unit_type.cpp.
References luaW_Registry::dir(), and unitTypeReg.
Referenced by lua_unit_type::register_metatable().
|
static |
Definition at line 165 of file lua_unit_type.cpp.
References luaW_checkunittype(), and luaW_tounittype().
Referenced by lua_unit_type::register_metatable().
|
static |
Gets some data on a unit type (__index metamethod).
Definition at line 151 of file lua_unit_type.cpp.
References luaW_Registry::get(), and unitTypeReg.
Referenced by lua_unit_type::register_metatable().
|
static |
Definition at line 176 of file lua_unit_type.cpp.
References unit_race::FEMALE, utils::views::keys, lua_push(), unit_race::MALE, p, unit_type_data::types(), unit_types, and UnitTypeTable.
Referenced by lua_unit_type::register_table().
|
static |
Definition at line 196 of file lua_unit_type.cpp.
References unit_type_data::find(), unit_type::get_gender_unit_type(), unit_type::get_variation(), luaW_pushunittype(), unit_types, and UnitTypeTable.
Referenced by lua_unit_type::register_table().
|
static |
Definition at line 216 of file lua_unit_type.cpp.
Referenced by lua_unit_type::register_table().
|
static |
Definition at line 230 of file lua_unit_type.cpp.
References unit_map::begin(), unit_type_data::build_unit_type(), unit_map::end(), unit_race::FEMALE, unit_map::find(), unit_type::FULL, unit_type::get_gender_unit_type(), unit_type::has_gender_variation(), luaW_pushunittype(), unit_race::MALE, unit_type_data::types(), unit_types, UnitTypeTable, and unit_type::variation_types().
Referenced by impl_unit_type_pairs().
|
static |
Definition at line 279 of file lua_unit_type.cpp.
References impl_unit_type_next().
Referenced by lua_unit_type::register_table().
|
static |
Turns a lua proxy unit type to string.
(__tostring metamethod)
Definition at line 289 of file lua_unit_type.cpp.
References unit_type::id(), lua_push(), and luaW_checkunittype().
Referenced by lua_unit_type::register_metatable().
| const unit_type& luaW_checkunittype | ( | lua_State * | L, |
| int | idx | ||
| ) |
Test if a stack element is a unit type, and return it if so.
Definition at line 358 of file lua_unit_type.cpp.
References UnitType.
Referenced by lua_object_traits< unit_type >::get(), impl_unit_type_equal(), and impl_unit_type_tostring().
| void luaW_pushunittype | ( | lua_State * | L, |
| const unit_type & | ut | ||
| ) |
Create a lua object containing a reference to a unittype, and a metatable to access the properties.
Definition at line 344 of file lua_unit_type.cpp.
References UnitType.
Referenced by impl_unit_type_lookup(), impl_unit_type_next(), lua_gui2::intf_show_recruit_dialog(), and luaW_pushfaivariant().
| const unit_type* luaW_tounittype | ( | lua_State * | L, |
| int | idx | ||
| ) |
Test if a stack element is a unit type, and return it if so.
Definition at line 350 of file lua_unit_type.cpp.
Referenced by impl_unit_attacks_get(), impl_unit_attacks_len(), impl_unit_attacks_set(), impl_unit_type_equal(), lua_formula_bridge::intf_eval_formula(), lua_gui2::intf_show_recruit_dialog(), luaW_tofaivariant(), and WIDGET_SETTER().
| UNIT_TYPE_GETTER | ( | "__cfg" | , |
| config | |||
| ) |
Definition at line 111 of file lua_unit_type.cpp.
| UNIT_TYPE_GETTER | ( | "abilities" | , |
| std::vector< std::string > | |||
| ) |
Definition at line 124 of file lua_unit_type.cpp.
| UNIT_TYPE_GETTER | ( | "advances_from" | , |
| std::vector< std::string > | |||
| ) |
Definition at line 107 of file lua_unit_type.cpp.
| UNIT_TYPE_GETTER | ( | "advances_to" | , |
| std::vector< std::string > | |||
| ) |
Definition at line 103 of file lua_unit_type.cpp.
| UNIT_TYPE_GETTER | ( | "alignment" | , |
| std::string | |||
| ) |
Definition at line 55 of file lua_unit_type.cpp.
References string_enums::enum_base< Definition >::get_string().
| UNIT_TYPE_GETTER | ( | "attacks" | , |
| lua_index_raw | |||
| ) |
Definition at line 128 of file lua_unit_type.cpp.
References push_unit_attacks_table().
| UNIT_TYPE_GETTER | ( | "cost" | , |
| int | |||
| ) |
Definition at line 91 of file lua_unit_type.cpp.
| UNIT_TYPE_GETTER | ( | "icon" | , |
| std::string | |||
| ) |
Definition at line 67 of file lua_unit_type.cpp.
| UNIT_TYPE_GETTER | ( | "id" | , |
| std::string | |||
| ) |
Definition at line 51 of file lua_unit_type.cpp.
| UNIT_TYPE_GETTER | ( | "image" | , |
| std::string | |||
| ) |
Definition at line 63 of file lua_unit_type.cpp.
| UNIT_TYPE_GETTER | ( | "level" | , |
| int | |||
| ) |
Definition at line 95 of file lua_unit_type.cpp.
| UNIT_TYPE_GETTER | ( | "max_experience" | , |
| int | |||
| ) |
Definition at line 87 of file lua_unit_type.cpp.
| UNIT_TYPE_GETTER | ( | "max_hitpoints" | , |
| int | |||
| ) |
Definition at line 79 of file lua_unit_type.cpp.
| UNIT_TYPE_GETTER | ( | "max_moves" | , |
| int | |||
| ) |
Definition at line 83 of file lua_unit_type.cpp.
| UNIT_TYPE_GETTER | ( | "name" | , |
| t_string | |||
| ) |
Definition at line 47 of file lua_unit_type.cpp.
| UNIT_TYPE_GETTER | ( | "profile" | , |
| std::string | |||
| ) |
Definition at line 71 of file lua_unit_type.cpp.
| UNIT_TYPE_GETTER | ( | "race" | , |
| std::string | |||
| ) |
Definition at line 59 of file lua_unit_type.cpp.
| UNIT_TYPE_GETTER | ( | "recall_cost" | , |
| int | |||
| ) |
Definition at line 99 of file lua_unit_type.cpp.
| UNIT_TYPE_GETTER | ( | "small_profile" | , |
| std::string | |||
| ) |
Definition at line 75 of file lua_unit_type.cpp.
| UNIT_TYPE_GETTER | ( | "traits" | , |
| traits_map | |||
| ) |
Definition at line 116 of file lua_unit_type.cpp.
| UNIT_TYPE_GETTER | ( | "variations" | , |
| lua_index_raw | |||
| ) |
Definition at line 138 of file lua_unit_type.cpp.
References UnitTypeTable.
| UNIT_TYPE_VALID | ( | "variations" | ) |
Definition at line 134 of file lua_unit_type.cpp.
|
static |
Implementation for a lua reference to a unit_type.
Definition at line 33 of file lua_unit_type.cpp.
Referenced by luaW_checkunittype(), luaW_pushunittype(), luaW_tounittype(), and lua_unit_type::register_metatable().
| luaW_Registry unitTypeReg {UnitType} |
Definition at line 38 of file lua_unit_type.cpp.
Referenced by impl_unit_type_dir(), and impl_unit_type_get().
|
static |
Definition at line 34 of file lua_unit_type.cpp.
Referenced by impl_unit_type_list(), impl_unit_type_lookup(), impl_unit_type_next(), lua_unit_type::register_table(), and UNIT_TYPE_GETTER().