forked from github/server
re-implement faction:add_message for Lua.
only ancient xmas scripts were using it, but it's a useful function to have.
This commit is contained in:
parent
fb32ebcd18
commit
bac3286440
|
@ -22,6 +22,7 @@ without prior permission by the authors of Eressea.
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
|
#include <kernel/messages.h>
|
||||||
#include <kernel/plane.h>
|
#include <kernel/plane.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
|
@ -211,6 +212,15 @@ static int tolua_faction_renumber(lua_State * L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int tolua_faction_addnotice(lua_State * L)
|
||||||
|
{
|
||||||
|
faction *self = (faction *)tolua_tousertype(L, 1, 0);
|
||||||
|
const char *str = tolua_tostring(L, 2, 0);
|
||||||
|
|
||||||
|
addmessage(NULL, self, str, MSG_MESSAGE, ML_IMPORTANT);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int tolua_faction_get_objects(lua_State * L)
|
static int tolua_faction_get_objects(lua_State * L)
|
||||||
{
|
{
|
||||||
faction *self = (faction *) tolua_tousertype(L, 1, 0);
|
faction *self = (faction *) tolua_tousertype(L, 1, 0);
|
||||||
|
@ -563,9 +573,10 @@ void tolua_faction_open(lua_State * L)
|
||||||
.property("x", &faction_getorigin_x, &faction_setorigin_x)
|
.property("x", &faction_getorigin_x, &faction_setorigin_x)
|
||||||
.property("y", &faction_getorigin_y, &faction_setorigin_y)
|
.property("y", &faction_getorigin_y, &faction_setorigin_y)
|
||||||
|
|
||||||
.def("add_notice", &faction_addnotice)
|
|
||||||
#endif
|
#endif
|
||||||
tolua_variable(L, TOLUA_CAST "objects", tolua_faction_get_objects,
|
tolua_function(L, TOLUA_CAST "add_notice", &tolua_faction_addnotice);
|
||||||
|
|
||||||
|
tolua_variable(L, TOLUA_CAST "objects", tolua_faction_get_objects,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
tolua_endmodule(L);
|
tolua_endmodule(L);
|
||||||
|
|
Loading…
Reference in New Issue