From 408cbfdfc33486af918e605efedab00eb78b13fd Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 11 Apr 2004 00:20:46 +0000 Subject: [PATCH] =?UTF-8?q?das=20mit=20dem=20namen=20geht=20so=20nat=C3=BC?= =?UTF-8?q?rlich=20nicht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/eressea/lua/unit.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/eressea/lua/unit.cpp b/src/eressea/lua/unit.cpp index 22c26fca3..169f4bd37 100644 --- a/src/eressea/lua/unit.cpp +++ b/src/eressea/lua/unit.cpp @@ -205,6 +205,18 @@ unit_getregion(const unit& u) 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 bind_unit(lua_State * L) { @@ -213,7 +225,7 @@ bind_unit(lua_State * L) def("add_unit", &add_unit), class_("unit") - .def_readwrite("name", &unit::name) + .property("name", &unit_getname, &unit_setname) .def_readonly("faction", &unit::faction) .def_readonly("id", &unit::no) .def_readwrite("hp", &unit::hp)