forked from github/server
re-enable disabled tests for E2, add test for FOLLOW.
This commit is contained in:
parent
f06e3371a0
commit
d2fbdec831
|
@ -1,4 +1,4 @@
|
||||||
-- require 'tests.e2.shiplanding'
|
require 'tests.e2.shiplanding'
|
||||||
-- require 'tests.e2.e2features'
|
require 'tests.e2.e2features'
|
||||||
-- require 'tests.e2.movement'
|
require 'tests.e2.movement'
|
||||||
require 'tests.e2.guard'
|
require 'tests.e2.guard'
|
||||||
|
|
|
@ -44,3 +44,18 @@ function test_dolphin_in_ocean()
|
||||||
process_orders()
|
process_orders()
|
||||||
assert_equal(r2, u1.region)
|
assert_equal(r2, u1.region)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function test_follow()
|
||||||
|
local r1 = region.create(0, 0, "plain")
|
||||||
|
local r2 = region.create(1, 0, "plain")
|
||||||
|
local f = faction.create("test@example.com", "human", "de")
|
||||||
|
local u1 = unit.create(f, r1, 1)
|
||||||
|
local u2 = unit.create(f, r1, 1)
|
||||||
|
u1:clear_orders()
|
||||||
|
u2:clear_orders()
|
||||||
|
u1:add_order("NACH O")
|
||||||
|
u2:add_order("FOLGE EINHEIT " .. itoa36(u1.id))
|
||||||
|
process_orders()
|
||||||
|
assert_equal(u1.region, r2)
|
||||||
|
assert_equal(u2.region, r2)
|
||||||
|
end
|
||||||
|
|
|
@ -305,6 +305,7 @@ order *create_order(keyword_t kwd, const struct locale * lang,
|
||||||
switch (*params) {
|
switch (*params) {
|
||||||
case 's':
|
case 's':
|
||||||
s = va_arg(marker, const char *);
|
s = va_arg(marker, const char *);
|
||||||
|
assert(s);
|
||||||
bytes = (int)strlcpy(bufp, s, size);
|
bytes = (int)strlcpy(bufp, s, size);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
|
|
|
@ -2313,10 +2313,11 @@ static void travel(unit * u, region_list ** routep)
|
||||||
if (uf->region == r) {
|
if (uf->region == r) {
|
||||||
order *follow_order;
|
order *follow_order;
|
||||||
const struct locale *lang = u->faction->locale;
|
const struct locale *lang = u->faction->locale;
|
||||||
|
const char *s = LOC(uf->faction->locale, parameters[P_UNIT]);
|
||||||
/* construct an order */
|
/* construct an order */
|
||||||
|
assert(s || !"missing translation for UNIT keyword");
|
||||||
follow_order = create_order(K_FOLLOW, lang, "%s %i",
|
follow_order = create_order(K_FOLLOW, lang, "%s %i",
|
||||||
LOC(uf->faction->locale, parameters[P_UNIT]), ut->no);
|
s, ut->no);
|
||||||
|
|
||||||
route_end = reroute(uf, route_begin, route_end);
|
route_end = reroute(uf, route_begin, route_end);
|
||||||
travel_i(uf, route_begin, route_end, follow_order, TRAVEL_FOLLOWING,
|
travel_i(uf, route_begin, route_end, follow_order, TRAVEL_FOLLOWING,
|
||||||
|
|
Loading…
Reference in New Issue