forked from github/server
LUA-Updates:
- building.region (read/write) - unit.faction (read/write)
This commit is contained in:
parent
2b8c21dad3
commit
f80cc1c2d7
2 changed files with 28 additions and 2 deletions
|
@ -78,6 +78,20 @@ building_setname(building& b, const char * name)
|
|||
set_string(&b.name, name);
|
||||
}
|
||||
|
||||
static region *
|
||||
building_getregion(const building& b)
|
||||
{
|
||||
return b.region;
|
||||
}
|
||||
|
||||
static void
|
||||
building_setregion(building& b, region& r)
|
||||
{
|
||||
choplist(&b.region->buildings, &b);
|
||||
addlist(&r.buildings, &b);
|
||||
b.region = &r;
|
||||
}
|
||||
|
||||
static std::ostream&
|
||||
operator<<(std::ostream& stream, building& b)
|
||||
{
|
||||
|
@ -130,7 +144,7 @@ bind_building(lua_State * L)
|
|||
.property("name", &building_getname, &building_setname)
|
||||
.property("info", &building_getinfo, &building_setinfo)
|
||||
.property("units", &building_units, return_stl_iterator)
|
||||
.def_readonly("region", &building::region)
|
||||
.property("region", &building_getregion, &building_setregion)
|
||||
.def_readonly("id", &building::no)
|
||||
.def_readwrite("size", &building::size)
|
||||
.def("add_action", &building_addaction)
|
||||
|
|
|
@ -331,6 +331,18 @@ unit_setaura(unit& u, int points)
|
|||
return set_spellpoints(&u, points);
|
||||
}
|
||||
|
||||
static faction *
|
||||
unit_getfaction(const unit& u)
|
||||
{
|
||||
return u.faction;
|
||||
}
|
||||
|
||||
static void
|
||||
unit_setfaction(unit& u, faction& f)
|
||||
{
|
||||
u_setfaction(&u, &f);
|
||||
}
|
||||
|
||||
static const char *
|
||||
unit_getmagic(const unit& u)
|
||||
{
|
||||
|
@ -387,7 +399,7 @@ bind_unit(lua_State * L)
|
|||
.property("name", &unit_getname, &unit_setname)
|
||||
.property("info", &unit_getinfo, &unit_setinfo)
|
||||
.property("id", &unit_getid, &unit_setid)
|
||||
.def_readonly("faction", &unit::faction)
|
||||
.property("faction", &unit_getfaction, &unit_setfaction)
|
||||
.def_readwrite("hp", &unit::hp)
|
||||
.def_readwrite("status", &unit::status)
|
||||
|
||||
|
|
Loading…
Reference in a new issue