bug 2080: long actions after DESTROY

https://bugs.eressea.de/view.php?id=2080
we forgot to set the flags. also added a test for the future.
This commit is contained in:
Enno Rehling 2015-07-02 11:42:18 +02:00
parent 258f3c37c0
commit fc2b8f3471
3 changed files with 18 additions and 2 deletions

View File

@ -84,3 +84,17 @@ function test_follow_ship()
assert_equal(2, u1.region.x)
assert_equal(2, u2.region.x)
end
function test_dont_move_after_destroy()
local r1 = region.create(0, 0, "plain")
local r2 = region.create(1, 0, "plain")
local f = faction.create("test@example.com", "human", "de")
local u = unit.create(f, r1, 1)
u.building = building.create(r1, "castle")
u:clear_orders()
u:add_order("NACH O")
u:add_order("ZERSTOERE " .. itoa36(u.building.id))
process_orders()
assert_equal(r1, u.region)
assert_equal(nil, u.building)
end

View File

@ -996,6 +996,9 @@ void economics(region * r)
}
}
}
if (destroyed) {
fset(u, UFL_LONGACTION | UFL_NOTMOVING);
}
}
}

View File

@ -164,8 +164,7 @@ int destroy_cmd(unit * u, struct order *ord)
if (s && *s) {
n = atoi((const char *)s);
if (n <= 0) {
cmistake(u, ord, 288, MSG_PRODUCE);
return 0;
n = INT_MAX;
}
}