Make extended commands return defined flags

Instead of returning 0 or 1, we'll now use ECMD_OK or ECMD_TURN.
These have the same meaning as the hardcoded numbers; ECMD_TURN
means the command uses a turn.

In future, could add eg. a flag denoting "user cancelled command"
or "command failed", and should clear eg. the cmdq.

Mostly this was simply replacing return values with the defines
in the extended commands, so hopefully I didn't break anything.
This commit is contained in:
Pasi Kallinen
2021-12-30 18:46:30 +02:00
parent 511ce70309
commit d53cd28d46
46 changed files with 821 additions and 793 deletions

View File

@@ -2431,7 +2431,7 @@ donamelevel(void)
char nbuf[BUFSZ]; /* Buffer for response */
if (!(mptr = find_mapseen(&u.uz)))
return 0;
return ECMD_OK;
nbuf[0] = '\0';
#ifdef EDIT_GETLIN
@@ -2453,7 +2453,7 @@ donamelevel(void)
/* empty input or ESC means don't add or change annotation;
space-only means discard current annotation without adding new one */
if (!*nbuf || *nbuf == '\033')
return 0;
return ECMD_OK;
/* strip leading and trailing spaces, compress out consecutive spaces */
(void) mungspaces(nbuf);
@@ -2469,7 +2469,7 @@ donamelevel(void)
mptr->custom = dupstr(nbuf);
mptr->custom_lth = strlen(mptr->custom);
}
return 0;
return ECMD_OK;
}
/* find the particular mapseen object in the chain; may return null */
@@ -3088,7 +3088,7 @@ int
dooverview(void)
{
show_overview(0, 0);
return 0;
return ECMD_OK;
}
/* called for #overview or for end of game disclosure */