Simplify getpath()

This commit is contained in:
Markus Armbruster 2008-07-19 15:54:29 -04:00
parent 052d514bfe
commit 0b0612ea04

View file

@ -169,13 +169,13 @@ getpath(char *buf, char *arg, coord x, coord y, int onlyown,
xyas(x, y, player->cnum)); xyas(x, y, player->cnum));
} }
bp = getstring(prompt, buf2); bp = getstring(prompt, buf2);
if (bp && p + strlen(bp) + 1 >= buf + MAX_PATH_LEN) { if (!bp)
return NULL;
if (p + strlen(bp) + 1 >= buf + MAX_PATH_LEN) {
pr("Path length may not exceed %d.\n", MAX_PATH_LEN); pr("Path length may not exceed %d.\n", MAX_PATH_LEN);
pr("Aborting...\n"); pr("Aborting...\n");
bp = NULL; bp = NULL;
} }
if (!bp)
return NULL;
strcpy(p, bp); strcpy(p, bp);
if (*bp) if (*bp)
goto more; goto more;