diff --git a/src/lib/subs/unitsub.c b/src/lib/subs/unitsub.c index b1ead5ca..7b903d4d 100644 --- a/src/lib/subs/unitsub.c +++ b/src/lib/subs/unitsub.c @@ -406,8 +406,13 @@ unit_move(struct emp_qelem *list) */ if (!*cp) { cp = unit_move_getpath(list, suppress_map, path); - if (!cp) + if (!cp) { + if (type == EF_SHIP) + shp_nav_put(list, player->cnum); + else + lnd_mar_put(list, player->cnum); return RET_FAIL; + } cp = unit_move_route(leader, path, sizeof(path)); if (!cp || !*cp) cp = "h"; @@ -418,13 +423,17 @@ unit_move(struct emp_qelem *list) stopping = shp_nav_dir(list, dir, player->cnum) || shp_nav_gauntlet(list, 1, player->cnum); else { - if (!moved && !lnd_abandon_askyn(list)) + if (!moved && !lnd_abandon_askyn(list)) { + lnd_mar_put(list, player->cnum); return RET_FAIL; + } stopping = lnd_mar_dir(list, dir, player->cnum) || lnd_mar_gauntlet(list, 1, player->cnum); } - if (dir == DIR_STOP) + if (dir == DIR_STOP) { + CANT_HAPPEN(!QEMPTY(list)); return RET_OK; + } moved = 1; if (stopping) cp = ""; diff --git a/tests/navi-march/journal.log b/tests/navi-march/journal.log index 13985d96..78a87b7a 100644 --- a/tests/navi-march/journal.log +++ b/tests/navi-march/journal.log @@ -1013,6 +1013,8 @@ Play#1 output Play#1 1 Leader is cav cavalry #78 Play#1 output Play#1 4 Do you really want to abandon 3,7 [yn]? Play#1 input n + Play#1 output Play#1 1 cav cavalry #78 stopped at 3,7 + Play#1 output Play#1 1 cav cavalry #79 stopped at 3,7 Play#1 output Play#1 1 command failed Play#1 output Play#1 6 0 567 Play#1 input march 84/83/80/81/82