forked from github/server
Merge pull request #242 from badgerman/feature/bug-2080-move-after-destroy
bug 2080: long actions after DESTROY
This commit is contained in:
commit
37eb189cd0
|
@ -84,3 +84,17 @@ function test_follow_ship()
|
||||||
assert_equal(2, u1.region.x)
|
assert_equal(2, u1.region.x)
|
||||||
assert_equal(2, u2.region.x)
|
assert_equal(2, u2.region.x)
|
||||||
end
|
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) {
|
if (s && *s) {
|
||||||
n = atoi((const char *)s);
|
n = atoi((const char *)s);
|
||||||
if (n <= 0) {
|
if (n <= 0) {
|
||||||
cmistake(u, ord, 288, MSG_PRODUCE);
|
n = INT_MAX;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue