LUA: region.herbtype

This commit is contained in:
Enno Rehling 2006-05-08 20:28:53 +00:00
parent 9fd87309c7
commit d72c0ab07e
1 changed files with 23 additions and 7 deletions

View File

@ -70,6 +70,21 @@ lua_region_getowner(const region& r) {
return region_owner(&r);
}
static void
region_setherbtype(region& r, const char * str) {
const struct resource_type * rtype = rt_find(str);
if (rtype!=NULL && rtype->itype!=NULL) {
rsetherbtype(&r, rtype->itype);
}
}
static const char *
region_getherbtype(const region& r) {
const struct item_type * itype = rherbtype(&r);
if (itype==NULL) return NULL;
return itype->rtype->_name[0];
}
static void
region_setinfo(region& r, const char * info) {
set_string(&r.display, info);
@ -301,6 +316,7 @@ bind_region(lua_State * L)
.property("name", &region_getname, &region_setname)
.property("info", &region_getinfo, &region_setinfo)
.property("owner", &lua_region_getowner, &lua_region_setowner)
.property("herbtype", &region_getherbtype, &region_setherbtype)
.property("terrain", &region_getterrain)
.def("add_notice", &region_addnotice)
.def("add_direction", &region_adddirection)