forked from github/server
Merge branch 'develop' of github.com:eressea/server into develop
This commit is contained in:
commit
f4b87b1778
|
@ -1,6 +1,6 @@
|
||||||
|
require 'tests.e2.movement'
|
||||||
require 'tests.e2.carts'
|
require 'tests.e2.carts'
|
||||||
require 'tests.e2.quit'
|
require 'tests.e2.quit'
|
||||||
require 'tests.e2.movement'
|
|
||||||
require 'tests.e2.astral'
|
require 'tests.e2.astral'
|
||||||
require 'tests.e2.spells'
|
require 'tests.e2.spells'
|
||||||
require 'tests.e2.e2features'
|
require 'tests.e2.e2features'
|
||||||
|
|
|
@ -5,11 +5,40 @@ module("tests.e2.movement", package.seeall, lunit.testcase)
|
||||||
function setup()
|
function setup()
|
||||||
eressea.free_game()
|
eressea.free_game()
|
||||||
eressea.settings.set("rules.food.flags", "4")
|
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("nmr.timeout", "0")
|
||||||
eressea.settings.set("NewbieImmunity", "0")
|
eressea.settings.set("NewbieImmunity", "0")
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_piracy()
|
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 r = region.create(0, 0, "plain")
|
||||||
local r2 = region.create(1, 0, "plain")
|
local r2 = region.create(1, 0, "plain")
|
||||||
local r3 = region.create(-1, 0, "ocean")
|
local r3 = region.create(-1, 0, "ocean")
|
||||||
|
@ -30,10 +59,8 @@ function test_piracy()
|
||||||
|
|
||||||
process_orders()
|
process_orders()
|
||||||
|
|
||||||
if r2~=u1.region then
|
assert_equal(r, u2.region) -- Nach Osten
|
||||||
write_reports()
|
assert_equal(r2, u1.region) -- bewegt sich nicht
|
||||||
end
|
|
||||||
assert_equal(r2, u1.region) -- should pass, but fails!!!
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_dolphin_on_land()
|
function test_dolphin_on_land()
|
||||||
|
|
12
src/move.c
12
src/move.c
|
@ -696,18 +696,17 @@ int check_ship_allowed(struct ship *sh, const region * r)
|
||||||
return SA_NO_COAST;
|
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) {
|
if (sh->type->flags & SFL_NOCOAST) {
|
||||||
sh->coast = NODIRECTION;
|
return sh->coast = NODIRECTION;
|
||||||
}
|
}
|
||||||
else if (!fval(rnext->terrain, SEA_REGION) && !flying_ship(sh)) {
|
else if (!fval(rnext->terrain, SEA_REGION) && !flying_ship(sh)) {
|
||||||
sh->coast = reldirection(rnext, r);
|
if (fval(r->terrain, SEA_REGION)) {
|
||||||
assert(fval(r->terrain, SEA_REGION));
|
return sh->coast = reldirection(rnext, r);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
sh->coast = NODIRECTION;
|
|
||||||
}
|
}
|
||||||
|
return sh->coast = NODIRECTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
static double overload_start(void) {
|
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);
|
replace_order(&u->orders, ord, norder);
|
||||||
free_order(norder);
|
free_order(norder);
|
||||||
}
|
}
|
||||||
set_order(&u->thisorder, NULL);
|
|
||||||
set_coast(sh, last_point, current_point);
|
set_coast(sh, last_point, current_point);
|
||||||
|
|
||||||
if (is_cursed(sh->attribs, &ct_flyingship)) {
|
if (is_cursed(sh->attribs, &ct_flyingship)) {
|
||||||
|
|
Loading…
Reference in New Issue