das mit dem namen geht so natürlich nicht

This commit is contained in:
Enno Rehling 2004-04-11 00:20:46 +00:00
parent 800fa9e2f7
commit 408cbfdfc3
1 changed files with 13 additions and 1 deletions

View File

@ -205,6 +205,18 @@ unit_getregion(const unit& u)
return u.region; return u.region;
} }
static const char *
unit_getname(const unit& u)
{
return u.name;
}
static void
unit_setname(unit& u, const char * name)
{
set_string(&u.name, name);
}
void void
bind_unit(lua_State * L) bind_unit(lua_State * L)
{ {
@ -213,7 +225,7 @@ bind_unit(lua_State * L)
def("add_unit", &add_unit), def("add_unit", &add_unit),
class_<struct unit>("unit") class_<struct unit>("unit")
.def_readwrite("name", &unit::name) .property("name", &unit_getname, &unit_setname)
.def_readonly("faction", &unit::faction) .def_readonly("faction", &unit::faction)
.def_readonly("id", &unit::no) .def_readonly("id", &unit::no)
.def_readwrite("hp", &unit::hp) .def_readwrite("hp", &unit::hp)