forked from github/server
laen test does not work. trying to make setresource add the raw material to fix it
This commit is contained in:
parent
166d4ccc2c
commit
1fe075e82d
|
@ -573,16 +573,7 @@ local function _test_create_laen()
|
|||
local r = region.create(0,0, "mountain")
|
||||
local f1 = faction.create("noreply@eressea.de", "human", "de")
|
||||
local u1 = unit.create(f1, r, 1)
|
||||
|
||||
-- TODO this is a stupid way to create a laen region
|
||||
for i = 1, 10000 do
|
||||
r = region.create(i,0, "mountain")
|
||||
if r:get_resource("laen") > 2 then
|
||||
break
|
||||
end
|
||||
end
|
||||
assert(r:get_resource("laen")>2, "could not run test properly, please try again")
|
||||
|
||||
r:set_resource("laen", 3)
|
||||
return r, u1
|
||||
end
|
||||
|
||||
|
|
|
@ -1016,6 +1016,16 @@ void region_setresource(region * r, const resource_type * rtype, int value)
|
|||
rsetpeasants(r, value);
|
||||
else if (rtype == rt_find("horse"))
|
||||
rsethorses(r, value);
|
||||
else {
|
||||
int i;
|
||||
for (i = 0; r->terrain->production[i].type; ++i) {
|
||||
const terrain_production *production = r->terrain->production + i;
|
||||
if (production->type==rtype) {
|
||||
add_resource(r, 1, value, dice_rand(production->divisor), rtype);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue