Bug 2482: Untote können ihre eigenen Gegenstände reservieren.

This commit is contained in:
Enno Rehling 2018-11-03 18:25:22 +01:00
parent 2b478731c3
commit d9f800f444
2 changed files with 32 additions and 2 deletions

View File

@ -6,6 +6,33 @@ function setup()
eressea.free_game() eressea.free_game()
end end
function test_undead_reserve_self()
local r1 = region.create(0, 0, "plain")
local f1 = faction.create("human")
local u1 = unit.create(f1, r1, 1)
u1.race = "undead"
u1:clear_orders()
u1:add_item("log", 2)
u1:add_order("RESERVIERE 1 Holz")
u1:add_order("GIB 0 ALLES Holz")
process_orders()
assert_equal(1, u1:get_item("log"))
end
function test_undead_reserve_other()
local r1 = region.create(0, 0, "plain")
local f1 = faction.create("human")
local u1 = unit.create(f1, r1, 1)
local u2 = unit.create(f1, r1, 1)
u2:add_item("log", 2)
u1.race = "undead"
u1:clear_orders()
u1:add_order("RESERVIERE 1 Holz")
process_orders()
assert_equal(0, u1:get_item("log"))
assert_equal(2, u2:get_item("log"))
end
function test_undead_give_item() function test_undead_give_item()
local r1 = region.create(0, 0, "plain") local r1 = region.create(0, 0, "plain")
local f1 = faction.create("human", "hodor@eressea.de", "de") local f1 = faction.create("human", "hodor@eressea.de", "de")

View File

@ -3379,7 +3379,7 @@ int pay_cmd(unit * u, struct order *ord)
static int reserve_i(unit * u, struct order *ord, int flags) static int reserve_i(unit * u, struct order *ord, int flags)
{ {
char token[128]; char token[128];
if (u->number > 0 && (u_race(u)->ec_flags & ECF_GETITEM)) { if (u->number > 0) {
int use, count, para; int use, count, para;
const item_type *itype; const item_type *itype;
const char *s; const char *s;
@ -3413,7 +3413,10 @@ static int reserve_i(unit * u, struct order *ord, int flags)
} }
int reserve_cmd(unit * u, struct order *ord) { int reserve_cmd(unit * u, struct order *ord) {
return reserve_i(u, ord, GET_DEFAULT); if ((u_race(u)->ec_flags & ECF_GETITEM)) {
return reserve_i(u, ord, GET_DEFAULT);
}
return 0;
} }
int reserve_self(unit * u, struct order *ord) { int reserve_self(unit * u, struct order *ord) {