Storage for a unit, either owned by the Lua code (ptr != 0), a local variable unit (c_ptr != 0), on a recall list (side != 0), or on the map. More...
#include <lua_unit.hpp>
Public Member Functions | |
lua_unit (std::size_t u) | |
lua_unit (unit_ptr u) | |
lua_unit (int s, std::size_t u) | |
lua_unit (unit &u) | |
~lua_unit () | |
bool | on_map () const |
int | on_recall_list () const |
unit * | get () const |
unit_ptr | get_shared () const |
unit * | operator-> () const |
unit & | operator* () const |
void | clear_ref () |
bool | put_map (const map_location &loc) |
Private Member Functions | |
lua_unit (const lua_unit &)=delete | |
lua_unit & | operator= (const lua_unit &)=delete |
Static Private Member Functions | |
static void | setmetatable (lua_State *L) |
Private Attributes | |
std::size_t | uid |
unit_ptr | ptr |
int | side |
unit * | c_ptr |
Friends | |
template<typename... Args> | |
lua_unit * | luaW_pushunit (lua_State *L, Args... args) |
lua_unit * | luaW_pushlocalunit (lua_State *L, unit &u) |
Pushes a private unit on the stack. More... | |
Storage for a unit, either owned by the Lua code (ptr != 0), a local variable unit (c_ptr != 0), on a recall list (side != 0), or on the map.
Shared units are represented by their underlying ID (uid).
Definition at line 80 of file lua_unit.hpp.
|
privatedelete |
|
inline |
Definition at line 94 of file lua_unit.hpp.
|
inline |
Definition at line 95 of file lua_unit.hpp.
|
inline |
Definition at line 96 of file lua_unit.hpp.
|
inline |
Definition at line 97 of file lua_unit.hpp.
lua_unit::~lua_unit | ( | ) |
Definition at line 44 of file lua_unit.cpp.
|
inline |
unit * lua_unit::get | ( | ) | const |
Definition at line 48 of file lua_unit.cpp.
References c_ptr, unit_map::find(), recall_list_manager::find_if_matches_underlying_id(), resources::gameboard, unit_map::iterator_base< iter_types >::get_shared_ptr(), game_board::get_team(), ptr, team::recall_list(), side, uid, game_board::units(), and unit_map::iterator_base< iter_types >::valid().
Referenced by operator*(), and operator->().
unit_ptr lua_unit::get_shared | ( | ) | const |
Definition at line 59 of file lua_unit.cpp.
References unit_map::find(), recall_list_manager::find_if_matches_underlying_id(), resources::gameboard, unit_map::iterator_base< iter_types >::get_shared_ptr(), game_board::get_team(), ptr, team::recall_list(), side, uid, game_board::units(), and unit_map::iterator_base< iter_types >::valid().
Referenced by game_lua_kernel::intf_put_unit().
|
inline |
Definition at line 100 of file lua_unit.hpp.
Referenced by game_lua_kernel::intf_erase_unit(), and game_lua_kernel::intf_put_unit().
|
inline |
Definition at line 102 of file lua_unit.hpp.
References side.
Referenced by game_lua_kernel::intf_erase_unit(), and game_lua_kernel::intf_match_unit().
|
inline |
Definition at line 108 of file lua_unit.hpp.
References get().
|
inline |
Definition at line 107 of file lua_unit.hpp.
References get().
bool lua_unit::put_map | ( | const map_location & | loc | ) |
Definition at line 74 of file lua_unit.cpp.
References ERR_LUA, recall_list_manager::extract_if_matches_underlying_id(), resources::gameboard, game_board::get_team(), loc, ptr, team::recall_list(), unit_map::replace(), side, uid, and game_board::units().
Referenced by game_lua_kernel::intf_put_unit().
|
staticprivate |
Definition at line 207 of file lua_unit.cpp.
References getunitKey.
Pushes a private unit on the stack.
Definition at line 212 of file lua_unit.cpp.
|
friend |
Definition at line 116 of file lua_unit.hpp.
|
private |
Definition at line 85 of file lua_unit.hpp.
Referenced by clear_ref(), and get().
|
private |
Definition at line 83 of file lua_unit.hpp.
Referenced by clear_ref(), get(), get_shared(), on_map(), and put_map().
|
private |
Definition at line 84 of file lua_unit.hpp.
Referenced by clear_ref(), get(), get_shared(), on_map(), on_recall_list(), and put_map().
|
private |
Definition at line 82 of file lua_unit.hpp.
Referenced by clear_ref(), get(), get_shared(), and put_map().