Merge branch 'master' of git://github.com/eressea/server

This commit is contained in:
Thomas Troeger 2014-02-15 23:27:16 +01:00
commit 0d917ae76e
3 changed files with 29 additions and 6 deletions

View File

@ -45,6 +45,29 @@ function setup()
eressea.settings.set("NewbieImmunity", "0")
eressea.settings.set("rules.economy.food", "4")
eressea.settings.set("rules.encounters", "0")
eressea.settings.set("rules.peasants.growth", "1")
end
function test_no_peasant_growth()
local r = region.create(0, 0, "plain")
r:set_resource("peasant", 2000)
eressea.settings.set("rules.peasants.growth", "0")
process_orders()
assert_equal(r:get_resource("peasant"), 2000)
end
function test_demon_food()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "demon", "de")
local u = unit.create(f, r, 1)
local p = r:get_resource("peasant")
r:set_resource("peasant", 2000)
eressea.settings.set("rules.economy.food", "0")
eressea.settings.set("rules.peasants.growth", "0")
process_orders()
assert_not_nil(u)
assert_equal(1, u.number)
assert_equal(1999, r:get_resource("peasant"))
end
function test_fleeing_units_can_be_transported()

View File

@ -62,12 +62,10 @@ static int tolua_storage_read_unit(lua_State * L)
static int tolua_storage_write_unit(lua_State * L)
{
gamedata *data = (gamedata *)tolua_tousertype(L, 1, 0);
struct unit *u = (struct unit *)tolua_tousertype(L, 2, 0);
if (global.data_version) {
gamedata *data = (gamedata *)tolua_tousertype(L, 1, 0);
struct unit *u = (struct unit *)tolua_tousertype(L, 2, 0);
write_unit(data, u);
}
return 0;
return 0;
}
static int tolua_storage_read_float(lua_State * L)

View File

@ -938,7 +938,9 @@ void demographics(void)
* und gewandert sind */
calculate_emigration(r);
peasants(r);
if (get_param_int(global.parameters, "rules.peasants.growth", 1)) {
peasants(r);
}
if (r->age > 20) {
plagues(r, false);
}