From f0203119ba067b989774a6fa238f26ad58ed0ed1 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 17 Dec 2007 17:55:51 +0000 Subject: [PATCH] lua: move ship --- src/eressea/lua/ship.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/eressea/lua/ship.cpp b/src/eressea/lua/ship.cpp index 8e1c3283a..6693acc09 100644 --- a/src/eressea/lua/ship.cpp +++ b/src/eressea/lua/ship.cpp @@ -3,9 +3,10 @@ #include "objects.h" // kernel includes -#include -#include -#include +#include +#include +#include +#include // lua includes #pragma warning (push) @@ -70,6 +71,18 @@ ship_getcapacity(const ship& s) { return shipcapacity(&s); } +static void +ship_setregion(ship& sh, region& r) +{ + move_ship(&sh, sh.region, &r, NULL); +} + +static region * +ship_getregion(const ship& sh) +{ + return sh.region; +} + void bind_ship(lua_State * L) { @@ -85,7 +98,7 @@ bind_ship(lua_State * L) .property("capacity", &ship_getcapacity) .property("maxsize", &ship_maxsize) .def_readonly("name", &ship::name) - .def_readonly("region", &ship::region) + .property("region", &ship_getregion, &ship_setregion) .def_readonly("id", &ship::no) .def_readonly("info", &ship::display) .def_readwrite("damage", &ship::damage)