forked from github/server
bind faction.flags to Lua
This commit is contained in:
parent
79feb5723c
commit
841876e335
|
@ -1330,3 +1330,10 @@ function test_bug_1795_demons()
|
||||||
assert_equal(limit+1, u1.number, u1.number .. "!=" .. (limit+1))
|
assert_equal(limit+1, u1.number, u1.number .. "!=" .. (limit+1))
|
||||||
assert_equal(peasants+growth, r:get_resource("peasant"))
|
assert_equal(peasants+growth, r:get_resource("peasant"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function test_faction_flags()
|
||||||
|
f = faction.create("noreply@eressea.de", "human", "de")
|
||||||
|
assert_equal(0, f.flags)
|
||||||
|
f.flags = 42
|
||||||
|
assert_equal(42, f.flags)
|
||||||
|
end
|
||||||
|
|
|
@ -160,6 +160,14 @@ static int tolua_faction_get_flags(lua_State * L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int tolua_faction_set_flags(lua_State * L)
|
||||||
|
{
|
||||||
|
faction *self = (faction *) tolua_tousertype(L, 1, 0);
|
||||||
|
int flags = (int)tolua_tonumber(L, 2, self->flags);
|
||||||
|
self->flags = flags;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int tolua_faction_get_options(lua_State * L)
|
static int tolua_faction_get_options(lua_State * L)
|
||||||
{
|
{
|
||||||
faction *self = (faction *) tolua_tousertype(L, 1, 0);
|
faction *self = (faction *) tolua_tousertype(L, 1, 0);
|
||||||
|
@ -525,7 +533,7 @@ void tolua_faction_open(lua_State * L)
|
||||||
tolua_faction_set_age);
|
tolua_faction_set_age);
|
||||||
tolua_variable(L, TOLUA_CAST "options", tolua_faction_get_options,
|
tolua_variable(L, TOLUA_CAST "options", tolua_faction_get_options,
|
||||||
tolua_faction_set_options);
|
tolua_faction_set_options);
|
||||||
tolua_variable(L, TOLUA_CAST "flags", tolua_faction_get_flags, NULL);
|
tolua_variable(L, TOLUA_CAST "flags", tolua_faction_get_flags, tolua_faction_set_flags);
|
||||||
tolua_variable(L, TOLUA_CAST "lastturn", tolua_faction_get_lastturn,
|
tolua_variable(L, TOLUA_CAST "lastturn", tolua_faction_get_lastturn,
|
||||||
tolua_faction_set_lastturn);
|
tolua_faction_set_lastturn);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue