forked from github/server
BUG owner of a building can't enter ship
If owner of a building want to enter a ship or other building, he must first leave the bulding. Commands are "leave" and "enter <ship/tower> <ID>". For buildings was that OK but not for ships. The building owner was inside the region after that commans and not in the ship.
This commit is contained in:
parent
6639fbbbbb
commit
918ab39bef
|
@ -710,3 +710,25 @@ function test_golem_use_four_iron()
|
|||
assert_equal(4, u1:get_item("towershield"))
|
||||
end
|
||||
|
||||
function test_building_owner_can_enter_ship()
|
||||
local r1 = region.create(1, 2, "plain")
|
||||
local f1 = faction.create("noreply@tteessttiinngg.de", "human", "de")
|
||||
local b1 = building.create(r1, "castle")
|
||||
b1.size = 10
|
||||
local s1 = ship.create(r1, "cutter")
|
||||
|
||||
local u1 = unit.create(f1, r1, 10)
|
||||
u1.building = b1
|
||||
u1:add_item("money", u1.number * 100)
|
||||
u1:clear_orders()
|
||||
u1:add_order("VERLASSEN")
|
||||
u1:add_order("BETRETE SCHIFF " .. itoa36(s1.id))
|
||||
|
||||
local u2 = unit.create(f1, r1, 10)
|
||||
u2.ship = s1
|
||||
u2:add_item("money", u1.number * 100)
|
||||
u2:clear_orders()
|
||||
process_orders()
|
||||
assert_equal(s1.id, u1.ship.id)
|
||||
assert_not_equal(b1.id, u1.ship.id, "BUG owner of the building can not go into a ship")
|
||||
end
|
||||
|
|
|
@ -1259,10 +1259,11 @@ int enter_ship(unit * u, struct order *ord, int id, int report)
|
|||
if (leave(u, false)) {
|
||||
u_set_ship(u, sh);
|
||||
fset(u, UFL_ENTER);
|
||||
return 1;
|
||||
} else if (report) {
|
||||
cmistake(u, ord, 150, MSG_MOVE);
|
||||
}
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int enter_building(unit * u, order * ord, int id, int report)
|
||||
|
|
Loading…
Reference in New Issue