forked from github/server
Exporting more data for units (number, race)
This commit is contained in:
parent
58595fc001
commit
d996889339
|
@ -1124,12 +1124,10 @@ fix_dissolve(unit * u, int value, char mode)
|
||||||
{
|
{
|
||||||
attrib * a = a_find(u->attribs, &at_unitdissolve);
|
attrib * a = a_find(u->attribs, &at_unitdissolve);
|
||||||
|
|
||||||
unused(value);
|
|
||||||
|
|
||||||
if (a!=NULL) return;
|
if (a!=NULL) return;
|
||||||
a = a_add(&u->attribs, a_new(&at_unitdissolve));
|
a = a_add(&u->attribs, a_new(&at_unitdissolve));
|
||||||
a->data.ca[0] = mode;
|
a->data.ca[0] = mode;
|
||||||
a->data.ca[1] = 100;
|
a->data.ca[1] = value;
|
||||||
log_warning(("unit %s has race %s and no dissolve-attrib\n", unitname(u), rc_name(u->race, 0)));
|
log_warning(("unit %s has race %s and no dissolve-attrib\n", unitname(u), rc_name(u->race, 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <attributes/racename.h>
|
#include <attributes/racename.h>
|
||||||
|
|
||||||
// kernel includes
|
// kernel includes
|
||||||
|
#include <kernel/race.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
|
@ -100,6 +101,21 @@ unit_setskill(unit& u, const char * skname, int level)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
unit_getrace(const unit& u)
|
||||||
|
{
|
||||||
|
return u.race->_name[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
unit_setrace(unit& u, const char * rcname)
|
||||||
|
{
|
||||||
|
race * rc = rc_find(rcname);
|
||||||
|
if (rc!=NULL) {
|
||||||
|
u.race = rc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
bind_unit(lua_State * L)
|
bind_unit(lua_State * L)
|
||||||
{
|
{
|
||||||
|
@ -109,6 +125,7 @@ bind_unit(lua_State * L)
|
||||||
|
|
||||||
class_<struct unit>("unit")
|
class_<struct unit>("unit")
|
||||||
.def_readonly("name", &unit::name)
|
.def_readonly("name", &unit::name)
|
||||||
|
.def_readonly("size", &unit::number)
|
||||||
.def_readonly("region", &unit::region)
|
.def_readonly("region", &unit::region)
|
||||||
.def_readonly("faction", &unit::faction)
|
.def_readonly("faction", &unit::faction)
|
||||||
.def_readonly("id", &unit::no)
|
.def_readonly("id", &unit::no)
|
||||||
|
@ -119,5 +136,6 @@ bind_unit(lua_State * L)
|
||||||
.def("set_skill", &unit_setskill)
|
.def("set_skill", &unit_setskill)
|
||||||
.def("set_racename", &unit_setracename)
|
.def("set_racename", &unit_setracename)
|
||||||
.property("number", &unit_getnumber, &unit_setnumber)
|
.property("number", &unit_getnumber, &unit_setnumber)
|
||||||
|
.property("race", &unit_getrace, &unit_setrace)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue