From d000bf92960ba5b6fc7252d2e80c103285f8c41f Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 19 Jul 2008 10:05:25 -0400 Subject: [PATCH] Fix bdes and designate to always write updated bmap to disk bdes() failed to do that when the player aborted at the prompt for the new designation. desi() failed to do it when it failed the command because the new designation was bad. --- src/lib/commands/bdes.c | 11 +++++++---- src/lib/commands/desi.c | 6 ++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/lib/commands/bdes.c b/src/lib/commands/bdes.c index a276f39d..ce1dd857 100644 --- a/src/lib/commands/bdes.c +++ b/src/lib/commands/bdes.c @@ -47,18 +47,21 @@ bdes(void) char prompt[128]; char buf[1024]; int changed = 0; + int rc = RET_OK; if (!snxtsct(&nstr, player->argp[1])) return RET_SYN; - while (!player->aborted && nxtsct(&nstr, §)) { + while (nxtsct(&nstr, §)) { if ((nstr.ncond > 0) && (sect.sct_own != player->cnum)) continue; d = player->map[sect.sct_uid]; sprintf(prompt, "%s '%c' desig? ", xyas(nstr.x, nstr.y, player->cnum), d ? d : ' '); - if ((p = getstarg(player->argp[2], prompt, buf)) == 0) - continue; + if ((p = getstarg(player->argp[2], prompt, buf)) == 0) { + rc = RET_SYN; + break; + } if (!isprint(*p)) { if (*p) pr("Bad character. Must be printable!\n"); @@ -68,5 +71,5 @@ bdes(void) } if (changed) writebmap(player->cnum); - return RET_OK; + return rc; } diff --git a/src/lib/commands/desi.c b/src/lib/commands/desi.c index fc9e4d71..f012d44b 100644 --- a/src/lib/commands/desi.c +++ b/src/lib/commands/desi.c @@ -53,6 +53,7 @@ desi(void) char prompt[128]; char buf[1024]; int changed = 0; + int rc = RET_OK; if (!snxtsct(&nstr, player->argp[1])) return RET_SYN; @@ -78,7 +79,8 @@ desi(void) !player->god)) { pr("No such designation\n" "See \"info Sector-types\" for possible designations\n"); - return RET_FAIL; + rc = RET_FAIL; + break; } if (!player->god) { if (des == SCT_WASTE) { @@ -133,5 +135,5 @@ desi(void) } if (changed) writemap(player->cnum); - return RET_OK; + return rc; }