Lua extension: ships get a weight and capacity property.

This commit is contained in:
Enno Rehling 2006-07-25 09:57:47 +00:00
parent 93b5f5502a
commit da6e342ff3
1 changed files with 13 additions and 0 deletions

View File

@ -50,6 +50,17 @@ ship_gettype(const ship& s) {
return s.type->name[0]; return s.type->name[0];
} }
int
ship_getweight(const ship& s) {
int w, c;
getshipweight(&s, &w, &c);
return w;
}
int
ship_getcapacity(const ship& s) {
return shipcapacity(&s);
}
void void
bind_ship(lua_State * L) bind_ship(lua_State * L)
@ -62,6 +73,8 @@ bind_ship(lua_State * L)
.def(self == ship()) .def(self == ship())
.def(tostring(self)) .def(tostring(self))
.property("type", &ship_gettype) .property("type", &ship_gettype)
.property("weight", &ship_getweight)
.property("capacity", &ship_getcapacity)
.def_readonly("name", &ship::name) .def_readonly("name", &ship::name)
.def_readonly("region", &ship::region) .def_readonly("region", &ship::region)
.def_readonly("id", &ship::no) .def_readonly("id", &ship::no)