diff --git a/src/lib/commands/navi.c b/src/lib/commands/navi.c index 8b4ba6bd..0223823b 100644 --- a/src/lib/commands/navi.c +++ b/src/lib/commands/navi.c @@ -29,6 +29,7 @@ * Known contributors to this file: * Ken Stevens, 1995 (rewritten) * Ron Koenderink, 2006-2007 + * Markus Armbruster, 2006-2011 */ #include @@ -92,8 +93,7 @@ do_unit_move(struct emp_qelem *ulist, int *together, if (player->argp[2]) { strcpy(buf, player->argp[2]); - if (!(cp = unit_path(*together, leader, buf))) - cp = player->argp[2]; + cp = unit_path(*together, leader, buf); } *pt = '\0'; @@ -152,8 +152,8 @@ do_unit_move(struct emp_qelem *ulist, int *together, stopping = 1; continue; } - if (!(cp = unit_path(*together, leader, buf))) - cp = buf; + if (cp) + cp = unit_path(*together, leader, cp); } if (type == EF_SHIP) { rad_map_set(player->cnum, leader->x, leader->y, leader->effic, diff --git a/src/lib/subs/unitsub.c b/src/lib/subs/unitsub.c index ee8376bf..e2a2f9f7 100644 --- a/src/lib/subs/unitsub.c +++ b/src/lib/subs/unitsub.c @@ -147,7 +147,7 @@ unit_path(int together, struct empobj *unit, char *buf) return NULL; if (!sarg_xy(buf, &destx, &desty)) - return NULL; + return buf; if (!together) { pr("Cannot go to a destination sector if not all starting in the same sector\n"); return NULL; @@ -172,7 +172,6 @@ unit_path(int together, struct empobj *unit, char *buf) */ c = path_find(unit->x, unit->y, destx, desty, sect.sct_own, mtype); if (c < 0) { - buf[0] = 0; pr("No owned %s from %s to %s!\n", mtype == MOB_RAIL ? "railway" : "path", xyas(unit->x, unit->y, player->cnum),