Bugfix 1922 entering of RF_BLOCKED regions with ships

This commit is contained in:
Gerd Wellenreuther 2012-06-07 20:59:26 +02:00
parent d2cee21af5
commit 74ddb1f881
2 changed files with 46 additions and 1 deletions

View File

@ -917,6 +917,50 @@ function test_parser()
assert_not_equal(0, u:get_skill("melee"))
end
function test_bug_1922()
-- see http://bugs.eressea.de/view.php?id=1922
local r = region.create(0, 0, "ocean")
local r2 = region.create(1, 0, "plain")
r2:set_flag(2) -- region should not be accessible
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
local s = _test_create_ship(r)
settings.set("rules.ship.drifting","0") -- ships are not drifting
settings.set("rules.economy.food","4") -- does not need silver
u.ship = s
u:clear_orders()
u:add_order("NACH O")
u:set_skill("sailing",120) -- supadupa captain able to drive a trireme
process_orders()
assert_not_equal(r2,u.region) -- unit should not reach r2.
end
function test_bug_1922_by_foot()
-- see http://bugs.eressea.de/view.php?id=1922
local r = region.create(0, 0, "plain")
local r2 = region.create(1, 0, "plain")
r2:set_flag(2) -- region should not be accessible
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
settings.set("rules.economy.food","4") -- does not need silver
u:clear_orders()
u:add_order("NACH O")
process_orders()
assert_not_equal(r2,u.region) -- unit should not reach r2.
end
function test_bug_1814()
-- see http://bugs.eressea.de/view.php?id=1814
local r = region.create(0, 0, "mountain")

View File

@ -704,6 +704,7 @@ static float damage_drift(void)
static void drifting_ships(region * r)
{
direction_t d;
if (get_param_int(global.parameters, "rules.ship.drifting", 1)==0) return;
if (fval(r->terrain, SEA_REGION)) {
ship **shp = &r->ships;
@ -1718,7 +1719,7 @@ sail(unit * u, order * ord, boolean move_on_land, region_list ** routep)
assert(sh == u->ship || !"ship has sunk, but we didn't notice it");
if (fval(next_point->terrain, FORBIDDEN_REGION)) {
if (fval(next_point->terrain, FORBIDDEN_REGION)||fval(next_point,RF_BLOCKED)) {
ADDMSG(&f->msgs, msg_message("sailforbidden",
"ship region", sh, next_point));
break;