diff --git a/scripts/eressea/xmas2004.lua b/scripts/eressea/xmas2004.lua index 6a6bcfa63..92913c183 100644 --- a/scripts/eressea/xmas2004.lua +++ b/scripts/eressea/xmas2004.lua @@ -1,6 +1,6 @@ function use_snowman(u, amount) if u.region.terrain == "glacier" then - local man = add_unit(u.faction, u.region) + local man = unit.create(u.faction, u.region) man.race = "snowman" man.number = amount u:add_item("snowman", -amount) diff --git a/scripts/tests/eressea.lua b/scripts/tests/eressea.lua index 767cff742..8a0060088 100644 --- a/scripts/tests/eressea.lua +++ b/scripts/tests/eressea.lua @@ -182,3 +182,21 @@ function test_no_uruk() local f1 = faction.create("noreply@eressea.de", "uruk", "de") assert_equal(f1.race, "orc") end + +function test_snowman() + local r = region.create(0, 0, "glacier") + local f = faction.create("noreply@eressea.de", "human", "de") + local u = unit.create(f, r, 1) + u:add_item("snowman", 1) + u:clear_orders() + u:add_order("BENUTZEN 1 Schneemann") + process_orders() + for u2 in r.units do + if u2~=u then + assert_equal(u2.race, "snowman") + u = nil + break + end + end + assert_equal(nil, u) +end