From: Markus Armbruster Date: Thu, 23 Mar 2006 19:50:25 +0000 (+0000) Subject: (marc, navi): Permit any whitespace between route and optional X-Git-Tag: v4.3.1~86 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=bddb20c7f0552c2e948ba2406ae6c1bec411d740 (marc, navi): Permit any whitespace between route and optional argument for radar, lookout, sonar, not just spaces. --- diff --git a/src/lib/commands/marc.c b/src/lib/commands/marc.c index 7b34d1c58..3baa6e442 100644 --- a/src/lib/commands/marc.c +++ b/src/lib/commands/marc.c @@ -80,7 +80,7 @@ march(void) } while (!QEMPTY(&land_list)) { - s_char *bp, dp[80]; + char *bp, dp[80]; if (cp == 0 || *cp == '\0' || stopping) { stopping = 0; @@ -140,18 +140,15 @@ march(void) } continue; } else if (*cp == 'r' || *cp == 'l') { - bp = ++cp; - while ((*bp != ' ') && (*bp)) - bp++; - while ((*bp == ' ') && (*bp)) - bp++; - if ((bp != (s_char *)0) && (*bp)) + for (bp = cp + 1; *bp && !isspace(bp); bp++) ; + for (; *bp && isspace(bp); bp++) ; + if (*bp) player->argp[1] = bp; else { sprintf(dp, "%d", lnd->lnd_uid); player->argp[1] = dp; } - if (cp[-1] == 'r') { + if (*cp++ == 'r') { player->argp[0] = "lradar"; rada(); skip = 1; diff --git a/src/lib/commands/navi.c b/src/lib/commands/navi.c index 785f8a99d..9eaad1361 100644 --- a/src/lib/commands/navi.c +++ b/src/lib/commands/navi.c @@ -86,7 +86,7 @@ navi(void) *pt = '\0'; while (!QEMPTY(&ship_list)) { - s_char *bp, dp[80]; + char *bp, dp[80]; if (cp == 0 || *cp == '\0' || stopping) { stopping = 0; @@ -161,18 +161,15 @@ navi(void) } continue; } else if (*cp == 'r' || *cp == 'l' || *cp == 's') { - bp = ++cp; - while ((*bp != ' ') && (*bp)) - bp++; - while ((*bp == ' ') && (*bp)) - bp++; - if ((bp != (s_char *)0) && (*bp)) + for (bp = cp + 1; *bp && !isspace(*bp); bp++) ; + for (; *bp && isspace(*bp); bp++) ; + if (*bp) player->argp[1] = bp; else { sprintf(dp, "%d", shp->shp_uid); player->argp[1] = dp; } - if (cp[-1] == 'r') { + if (*cp++ == 'r') { rada(); skip = 1; } else if (cp[-1] == 'l')