forked from github/server
region-keys and some renaming.
This commit is contained in:
parent
229706e6e4
commit
3067eb51ea
|
@ -70,7 +70,7 @@ find_plane_id(const char * name)
|
|||
}
|
||||
|
||||
static bool
|
||||
get_flag(const char * name)
|
||||
get_key(const char * name)
|
||||
{
|
||||
int flag = atoi36(name);
|
||||
attrib * a = find_key(global.attribs, flag);
|
||||
|
@ -78,7 +78,7 @@ get_flag(const char * name)
|
|||
}
|
||||
|
||||
static void
|
||||
set_flag(const char * name, bool value)
|
||||
set_key(const char * name, bool value)
|
||||
{
|
||||
int flag = atoi36(name);
|
||||
attrib * a = find_key(global.attribs, flag);
|
||||
|
@ -252,8 +252,8 @@ bind_eressea(lua_State * L)
|
|||
def("set_string", &lua_setstring),
|
||||
def("get_string", &lua_getstring),
|
||||
|
||||
def("set_flag", &set_flag),
|
||||
def("get_flag", &get_flag),
|
||||
def("set_key", &set_key),
|
||||
def("get_key", &get_key),
|
||||
|
||||
def("get_gamename", &get_gamename),
|
||||
/* planes not really implemented */
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
#include <kernel/terrain.h>
|
||||
#include <kernel/unit.h>
|
||||
|
||||
#include <attributes/key.h>
|
||||
|
||||
// lua includes
|
||||
#include <lua.hpp>
|
||||
#include <luabind/luabind.hpp>
|
||||
|
@ -306,6 +308,27 @@ region_additem(region& r, const char * iname, int number)
|
|||
return -1;
|
||||
}
|
||||
|
||||
static bool
|
||||
region_getkey(region& r, const char * name)
|
||||
{
|
||||
int flag = atoi36(name);
|
||||
attrib * a = find_key(r.attribs, flag);
|
||||
return (a!=NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
region_setkey(region& r, const char * name, bool value)
|
||||
{
|
||||
int flag = atoi36(name);
|
||||
attrib * a = find_key(r.attribs, flag);
|
||||
if (a==NULL && value) {
|
||||
add_key(&r.attribs, flag);
|
||||
} else if (a!=NULL && !value) {
|
||||
a_remove(&r.attribs, a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
bind_region(lua_State * L)
|
||||
{
|
||||
|
@ -326,6 +349,9 @@ bind_region(lua_State * L)
|
|||
.def("add_notice", ®ion_addnotice)
|
||||
.def("add_direction", ®ion_adddirection)
|
||||
|
||||
.def("get_key", ®ion_getkey)
|
||||
.def("set_key", ®ion_setkey)
|
||||
|
||||
.def("get_flag", ®ion_getflag)
|
||||
.def("set_flag", ®ion_setflag)
|
||||
|
||||
|
|
Loading…
Reference in New Issue