forked from github/server
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:
parent
258f3c37c0
commit
fc2b8f3471
|
@ -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
|
||||
|
|
|
@ -996,6 +996,9 @@ void economics(region * r)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (destroyed) {
|
||||
fset(u, UFL_LONGACTION | UFL_NOTMOVING);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue