forked from github/server
Bug 2618: Zusätzlicher Test Piraterie
This commit is contained in:
parent
7f57aa2a18
commit
0db8f2167b
|
@ -1,6 +1,6 @@
|
|||
require 'tests.e2.movement'
|
||||
require 'tests.e2.carts'
|
||||
require 'tests.e2.quit'
|
||||
require 'tests.e2.movement'
|
||||
require 'tests.e2.astral'
|
||||
require 'tests.e2.spells'
|
||||
require 'tests.e2.e2features'
|
||||
|
|
|
@ -5,11 +5,40 @@ module("tests.e2.movement", package.seeall, lunit.testcase)
|
|||
function setup()
|
||||
eressea.free_game()
|
||||
eressea.settings.set("rules.food.flags", "4")
|
||||
eressea.settings.set("rules.ship.damage.nocrewocean", "0")
|
||||
eressea.settings.set("rules.ship.damage.nocrew", "0")
|
||||
eressea.settings.set("rules.ship.drifting", "0")
|
||||
eressea.settings.set("rules.ship.storms", "0")
|
||||
eressea.settings.set("nmr.timeout", "0")
|
||||
eressea.settings.set("NewbieImmunity", "0")
|
||||
end
|
||||
|
||||
function test_piracy()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local r2 = region.create(1, 0, "ocean")
|
||||
local r3 = region.create(-1, 0, "ocean")
|
||||
local f = faction.create("human", "pirate@eressea.de", "de")
|
||||
local f2 = faction.create("human", "elf@eressea.de", "de")
|
||||
local u1 = unit.create(f, r2, 1)
|
||||
local u2 = unit.create(f2, r3, 1)
|
||||
|
||||
u1.ship = ship.create(r2, "longboat")
|
||||
u2.ship = ship.create(r3, "longboat")
|
||||
u1:set_skill("sailing", 10)
|
||||
u2:set_skill("sailing", 10)
|
||||
|
||||
u1:clear_orders()
|
||||
u1:add_order("PIRATERIE")
|
||||
u2:clear_orders()
|
||||
u2:add_order("NACH o")
|
||||
|
||||
process_orders()
|
||||
|
||||
assert_equal(r, u2.region) -- Nach Osten
|
||||
assert_equal(r, u1.region) -- Entern!
|
||||
end
|
||||
|
||||
function test_piracy_to_land()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local r2 = region.create(1, 0, "plain")
|
||||
local r3 = region.create(-1, 0, "ocean")
|
||||
|
@ -30,10 +59,8 @@ function test_piracy()
|
|||
|
||||
process_orders()
|
||||
|
||||
if r2~=u1.region then
|
||||
write_reports()
|
||||
end
|
||||
assert_equal(r2, u1.region) -- should pass, but fails!!!
|
||||
assert_equal(r, u2.region) -- Nach Osten
|
||||
assert_equal(r2, u1.region) -- bewegt sich nicht
|
||||
end
|
||||
|
||||
function test_dolphin_on_land()
|
||||
|
|
14
src/move.c
14
src/move.c
|
@ -696,18 +696,17 @@ int check_ship_allowed(struct ship *sh, const region * r)
|
|||
return SA_NO_COAST;
|
||||
}
|
||||
|
||||
static void set_coast(ship * sh, region * r, region * rnext)
|
||||
static enum direction_t set_coast(ship * sh, region * r, region * rnext)
|
||||
{
|
||||
if (sh->type->flags & SFL_NOCOAST) {
|
||||
sh->coast = NODIRECTION;
|
||||
return sh->coast = NODIRECTION;
|
||||
}
|
||||
else if (!fval(rnext->terrain, SEA_REGION) && !flying_ship(sh)) {
|
||||
sh->coast = reldirection(rnext, r);
|
||||
assert(fval(r->terrain, SEA_REGION));
|
||||
}
|
||||
else {
|
||||
sh->coast = NODIRECTION;
|
||||
if (fval(r->terrain, SEA_REGION)) {
|
||||
return sh->coast = reldirection(rnext, r);
|
||||
}
|
||||
}
|
||||
return sh->coast = NODIRECTION;
|
||||
}
|
||||
|
||||
static double overload_start(void) {
|
||||
|
@ -1923,7 +1922,6 @@ static void sail(unit * u, order * ord, region_list ** routep, bool drifting)
|
|||
replace_order(&u->orders, ord, norder);
|
||||
free_order(norder);
|
||||
}
|
||||
set_order(&u->thisorder, NULL);
|
||||
set_coast(sh, last_point, current_point);
|
||||
|
||||
if (is_cursed(sh->attribs, &ct_flyingship)) {
|
||||
|
|
Loading…
Reference in New Issue