E3 does not have a boat, so tests needs to create a canoe sometimes

This commit is contained in:
Enno Rehling 2010-10-31 19:46:08 -07:00
parent 101ff092d5
commit c5418fc28b
2 changed files with 11 additions and 5 deletions

View File

@ -1,5 +1,13 @@
require "lunit"
local function _test_create_ship(r)
local s = ship.create(r, "canoe")
if (s==nil) then
s = ship.create(r, "boat")
end
return s
end
function setup()
free_game()
settings.set("nmr.removenewbie", "0")
@ -414,10 +422,7 @@ function test_id()
assert(get_building(fortytwo)==b)
assert(get_building(atoi36(fortytwo))==b)
local s = ship.create(r, "canoe")
if (s==nil) then
s = ship.create(r, "boat")
end
local s = _test_create_ship(r)
-- <not working> s.id = atoi36("42")
local fortytwo = itoa36(s.id)
assert(get_ship(fortytwo)==s)
@ -685,7 +690,7 @@ function test_swim_and_survive()
u:add_item("money", 100)
process_orders()
r.terrain = "ocean"
local s = ship.create(r, "boat")
local s = _test_create_ship(r)
u:clear_orders()
u:add_order("BETRETE SCHIFF " .. itoa36(s.id))
process_orders()

View File

@ -179,6 +179,7 @@ new_ship(const ship_type * stype, const struct locale * lang, region * r)
ship *sh = (ship *) calloc(1, sizeof(ship));
assert(stype);
assert(r);
sh->no = newcontainerid();
sh->coast = NODIRECTION;
sh->type = stype;