forked from github/server
this test fails when btype->maxsize isn't used as a limit for building.
This commit is contained in:
parent
0bf003cdc4
commit
3c2754071d
|
@ -129,7 +129,7 @@
|
||||||
|
|
||||||
<building name="harbour" capacity="1" maxcapacity="25" maxsize="25" unique="yes">
|
<building name="harbour" capacity="1" maxcapacity="25" maxsize="25" unique="yes">
|
||||||
<maintenance type="money" amount="250"/>
|
<maintenance type="money" amount="250"/>
|
||||||
<construction skill="building" minskill="3" reqsize="25" maxsize="25">
|
<construction skill="building" minskill="3" reqsize="25">
|
||||||
<requirement type="log" quantity="125"/>
|
<requirement type="log" quantity="125"/>
|
||||||
<requirement type="stone" quantity="125"/>
|
<requirement type="stone" quantity="125"/>
|
||||||
<requirement type="money" quantity="6250"/>
|
<requirement type="money" quantity="6250"/>
|
||||||
|
|
|
@ -52,22 +52,26 @@ function test_build_castle_stages()
|
||||||
assert_equal(250, b.size)
|
assert_equal(250, b.size)
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_build_maxsize()
|
function test_build_harbour()
|
||||||
|
-- try to reproduce mantis bug 2221
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local f = faction.create("human")
|
local f = faction.create("human", "harbour@eressea.de", "de")
|
||||||
local u = unit.create(f, r, 100)
|
local u = unit.create(f, r)
|
||||||
local b = building.create(r, "harbour")
|
size = 30
|
||||||
|
u.number = 20
|
||||||
b.size = 20
|
u:set_skill("building", 3)
|
||||||
u:add_item("stone", 1000)
|
u:add_item("money", size*250)
|
||||||
u:add_item("log", 1000)
|
u:add_item("stone", size*5)
|
||||||
u:add_item("money", 10000)
|
u:add_item("log", size*5)
|
||||||
|
|
||||||
u:set_skill("building", 100)
|
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
u:add_order("MACHE BURG " .. itoa36(b.id))
|
u:add_order("MACHE HAFEN")
|
||||||
process_orders()
|
process_orders()
|
||||||
assert_equal(25, b.size) -- build no more than max
|
assert_not_nil(u.building)
|
||||||
|
assert_equal("harbour", u.building.type)
|
||||||
|
assert_equal(20, u.building.size)
|
||||||
process_orders()
|
process_orders()
|
||||||
assert_equal(25, b.size) -- stop at max
|
assert_equal(25, u.building.size)
|
||||||
|
process_orders()
|
||||||
|
assert_equal(25, u.building.size)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -62,29 +62,6 @@ function test_dwarf_bonus()
|
||||||
assert_equal(70, r:get_resource("iron"))
|
assert_equal(70, r:get_resource("iron"))
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_build_harbour()
|
|
||||||
-- try to reproduce mantis bug 2221
|
|
||||||
local r = region.create(0, 0, "plain")
|
|
||||||
local f = faction.create("human", "harbour@eressea.de", "de")
|
|
||||||
local u = unit.create(f, r)
|
|
||||||
size = 30
|
|
||||||
u.number = 20
|
|
||||||
u:set_skill("building", 3)
|
|
||||||
u:add_item("money", size*250)
|
|
||||||
u:add_item("stone", size*5)
|
|
||||||
u:add_item("log", size*5)
|
|
||||||
u:clear_orders()
|
|
||||||
u:add_order("MACHE HAFEN")
|
|
||||||
process_orders()
|
|
||||||
assert_not_nil(u.building)
|
|
||||||
assert_equal("harbour", u.building.type)
|
|
||||||
assert_equal(20, u.building.size)
|
|
||||||
process_orders()
|
|
||||||
assert_equal(25, u.building.size)
|
|
||||||
process_orders()
|
|
||||||
assert_equal(25, u.building.size)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function one_unit(r, f)
|
local function one_unit(r, f)
|
||||||
local u = unit.create(f, r, 1)
|
local u = unit.create(f, r, 1)
|
||||||
u:add_item("money", u.number * 100)
|
u:add_item("money", u.number * 100)
|
||||||
|
|
|
@ -717,8 +717,9 @@ build_building(unit * u, const building_type * btype, int id, int want, order *
|
||||||
b = u->building;
|
b = u->building;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b)
|
if (b) {
|
||||||
btype = b->type;
|
btype = b->type;
|
||||||
|
}
|
||||||
|
|
||||||
if (fval(btype, BTF_UNIQUE) && buildingtype_exists(r, btype, false)) {
|
if (fval(btype, BTF_UNIQUE) && buildingtype_exists(r, btype, false)) {
|
||||||
/* only one of these per region */
|
/* only one of these per region */
|
||||||
|
|
Loading…
Reference in New Issue