From 4dded69d031c6fb3e2c01d94f14b9d1e43f64cec Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 31 May 2004 10:27:33 +0000 Subject: [PATCH] =?UTF-8?q?lua-interface=20kann=20Befehle=20erzeugen=20ud?= =?UTF-8?q?=20l=C3=B6schen,=20terraformen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/eressea/lua/region.cpp | 32 ++++++++++++++++++++++++++++++++ src/eressea/lua/unit.cpp | 15 +++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/src/eressea/lua/region.cpp b/src/eressea/lua/region.cpp index 29fa01c5f..6df2c29c0 100644 --- a/src/eressea/lua/region.cpp +++ b/src/eressea/lua/region.cpp @@ -103,12 +103,44 @@ region_setflag(region& r, int bit, bool set) else r.flags &= ~(1<units!=NULL) { + // TODO: error message + return r; + } + terraform(r, T_FIREWALL); + // TODO: durch einen NULL-äquivalenten terraintyp ersetzen + } + return NULL; + } + if (r==NULL) r = new_region(x, y); + terraform(r, t); + return r; +} + void bind_region(lua_State * L) { module(L)[ def("regions", &get_regions, return_stl_iterator), def("get_region", &findregion), + def("terraform", &terraform_region), class_("region") .def(tostring(self)) diff --git a/src/eressea/lua/unit.cpp b/src/eressea/lua/unit.cpp index 6c905022c..67933fb4c 100644 --- a/src/eressea/lua/unit.cpp +++ b/src/eressea/lua/unit.cpp @@ -267,6 +267,19 @@ unit_setmagic(unit& u, const char * type) } } +static void +unit_addorder(unit& u, const char * str) +{ + addstrlist(&u.orders, str); +} + +static void +unit_clearorders(unit& u) +{ + freestrlist(u.orders); + u.orders = NULL; +} + void bind_unit(lua_State * L) { @@ -282,6 +295,8 @@ bind_unit(lua_State * L) .def_readonly("id", &unit::no) .def_readwrite("hp", &unit::hp) .def_readwrite("status", &unit::status) + .def("add_order", &unit_addorder) + .def("clear_orders", &unit_clearorders) .def("get_item", &unit_getitem) .def("add_item", &unit_additem) .def("get_skill", &unit_getskill)