neue regionsresourcen: "chaos" und "grave" (um chaoscount und detahcount zu verändern)

This commit is contained in:
Enno Rehling 2005-12-04 14:53:27 +00:00
parent e89b1c908d
commit 93eb6adeff
2 changed files with 12 additions and 0 deletions

View File

@ -2,6 +2,8 @@
#define LUA_OBJECTS_H #define LUA_OBJECTS_H
#include <attributes/object.h> #include <attributes/object.h>
#include <lua.hpp>
#include <luabind/luabind.hpp>
#include <luabind/object.hpp> #include <luabind/object.hpp>
struct lua_State; struct lua_State;

View File

@ -126,6 +126,8 @@ region_getresource(const region& r, const char * type)
const resource_type * rtype = rt_find(type); const resource_type * rtype = rt_find(type);
if (rtype==rt_find("money")) return rmoney(&r); if (rtype==rt_find("money")) return rmoney(&r);
if (rtype==rt_find("peasant")) return rpeasants(&r); if (rtype==rt_find("peasant")) return rpeasants(&r);
if (strcmp(type, "grave")==0) return deathcount(&r);
if (strcmp(type, "chaos")==0) return chaoscount(&r);
return 0; return 0;
} }
@ -135,6 +137,14 @@ region_setresource(region& r, const char * type, int value)
const resource_type * rtype = rt_find(type); const resource_type * rtype = rt_find(type);
if (rtype==rt_find("money")) rsetmoney(&r, value); if (rtype==rt_find("money")) rsetmoney(&r, value);
if (rtype==rt_find("peasant")) return rsetpeasants(&r, value); if (rtype==rt_find("peasant")) return rsetpeasants(&r, value);
if (strcmp(type, "grave")==0) {
int fallen = value-deathcount(&r);
deathcounts(&r, fallen);
}
if (strcmp(type, "chaos")==0) {
int fallen = value-chaoscount(&r);
chaoscounts(&r, fallen);
}
} }
static void static void