retreat: Rewrite automatic retreat code to fix its many bugs
[empserver] / src / lib / subs / unitsub.c
index 5441624150dd51abd7bd177b4c11f7bbbbf95db2..7b1d3f0b8dd9ce9a62a0d65c8dcf8b02663014ad 100644 (file)
@@ -415,11 +415,13 @@ unit_move(struct emp_qelem *list)
        } else if ((dir = chkdir(*cp, DIR_STOP, DIR_LAST)) >= 0) {
            cp++;
            if (type == EF_SHIP)
-               stopping = shp_nav_one_sector(list, dir, player->cnum);
+               stopping = shp_nav_dir(list, dir, player->cnum)
+                   || shp_nav_gauntlet(list, 1, player->cnum);
            else {
                if (!moved && !lnd_abandon_askyn(list))
                    return RET_FAIL;
-               stopping = lnd_mar_one_sector(list, dir, player->cnum);
+               stopping = lnd_mar_dir(list, dir, player->cnum)
+                   || lnd_mar_gauntlet(list, 1, player->cnum);
            }
            if (dir == DIR_STOP)
                return RET_OK;