diff --git a/src/eressea/tolua/bind_faction.c b/src/eressea/tolua/bind_faction.c index e602fa820..c9abcc189 100644 --- a/src/eressea/tolua/bind_faction.c +++ b/src/eressea/tolua/bind_faction.c @@ -124,6 +124,15 @@ tolua_faction_get_age(lua_State* tolua_S) return 1; } +static int +tolua_faction_set_age(lua_State* tolua_S) +{ + faction * self = (faction *)tolua_tousertype(tolua_S, 1, 0); + int age = (int)tolua_tonumber(tolua_S, 2, 0); + self->age = age; + return 0; +} + static int tolua_faction_get_flags(lua_State* tolua_S) { @@ -409,7 +418,7 @@ tolua_faction_open(lua_State* tolua_S) tolua_variable(tolua_S, "alliance", tolua_faction_get_alliance, tolua_faction_set_alliance); tolua_variable(tolua_S, "score", tolua_faction_get_score, NULL); tolua_variable(tolua_S, "id", tolua_faction_get_id, NULL); - tolua_variable(tolua_S, "age", tolua_faction_get_age, NULL); + tolua_variable(tolua_S, "age", tolua_faction_get_age, tolua_faction_set_age); tolua_variable(tolua_S, "options", tolua_faction_get_options, NULL); tolua_variable(tolua_S, "flags", tolua_faction_get_flags, NULL); tolua_variable(tolua_S, "lastturn", tolua_faction_get_lastturn, NULL); diff --git a/src/eressea/tolua/bind_region.c b/src/eressea/tolua/bind_region.c index 5ad66d727..4ee02f76d 100644 --- a/src/eressea/tolua/bind_region.c +++ b/src/eressea/tolua/bind_region.c @@ -277,6 +277,17 @@ static int tolua_region_get_ships(lua_State* tolua_S) return 1; } +static int tolua_region_get_age(lua_State* tolua_S) +{ + region * self = (region *)tolua_tousertype(tolua_S, 1, 0); + + if (self) { + lua_pushnumber(tolua_S, self->age); + return 1; + } + return 0; +} + static int tolua_region_getkey(lua_State* tolua_S) { @@ -337,6 +348,7 @@ tolua_region_open(lua_State* tolua_S) tolua_variable(tolua_S, "info", tolua_region_get_info, tolua_region_set_info); tolua_variable(tolua_S, "units", tolua_region_get_units, NULL); tolua_variable(tolua_S, "ships", tolua_region_get_ships, NULL); + tolua_variable(tolua_S, "age", tolua_region_get_age, NULL); tolua_variable(tolua_S, "buildings", tolua_region_get_buildings, NULL); tolua_variable(tolua_S, "terrain", tolua_region_get_terrain, NULL); tolua_function(tolua_S, "get_resourcelevel", tolua_region_get_resourcelevel); @@ -356,7 +368,6 @@ tolua_region_open(lua_State* tolua_S) .def("get_road", ®ion_getroad) .def("set_road", ®ion_setroad) .def("next", ®ion_next) - .def_readwrite("age", ®ion::age) .def("add_item", ®ion_additem) .property("items", ®ion_items, return_stl_iterator) .property("plane_id", ®ion_plane)