LUA: faction.age

This commit is contained in:
Enno Rehling 2005-01-06 23:38:22 +00:00
parent 7bb61ccab4
commit fd2b7a540d
2 changed files with 21 additions and 2 deletions

View File

@ -29,9 +29,10 @@ CCFLAGS += -Wwrite-strings
-Wno-char-subscripts
;
# this require the latet luabind from CVS
C++FLAGS += -DHAVE_LUABIND_B7 ;
if $(HOST) = "hamunaptra" {
XMLHDRS = /homes2/info-f/enno/software/hamunaptra/include/libxml2 ;
C++FLAGS += -DHAVE_LUABIND_B7 ;
} else {
XMLHDRS = /usr/include/libxml2 ;
}
@ -66,7 +67,7 @@ rule UsingLuabind
rule UsingLua
{
SubDirHdrs $(LUA_ROOT)/include ;
SubDirHdrs /usr/include/lua50 ;
}
rule TargetDirectory

View File

@ -7,6 +7,7 @@
#include <kernel/faction.h>
#include <kernel/item.h>
#include <kernel/message.h>
#include <kernel/race.h>
#include <kernel/unit.h>
// util includes
@ -166,6 +167,22 @@ faction_addnotice(faction& f, const char * str)
ADDMSG(&f.msgs, msg_message("msg_event", "string", str));
}
static const char *
faction_getrace(const faction& f)
{
return f.race->_name[0];
}
static void
faction_setrace(faction& f, const char * rcname)
{
race * rc = rc_find(rcname);
if (rc!=NULL) {
f.race = rc;
}
}
void
bind_faction(lua_State * L)
{
@ -195,5 +212,6 @@ bind_faction(lua_State * L)
.property("locale", &faction_locale)
.property("units", &faction_units, return_stl_iterator)
.property("alliance", &faction_getalliance, &faction_setalliance)
.property("race", &faction_getrace, &faction_setrace)
];
}