Magic-number elimination.

This commit is contained in:
Eric S. Raymond 2023-04-06 10:03:24 -04:00
parent e1a528a4c5
commit f5ff25f52a
2 changed files with 3 additions and 6 deletions

3
main.c
View file

@ -463,8 +463,7 @@ static void describe_location(void)
{ {
const char* msg = locations[game.loc].description.small; const char* msg = locations[game.loc].description.small;
if (MOD(game.abbrev[game.loc], game.abbnum) == 0 || if (MOD(game.abbrev[game.loc], game.abbnum) == 0 || msg == NO_MESSAGE)
msg == NO_MESSAGE)
msg = locations[game.loc].description.big; msg = locations[game.loc].description.big;
if (!FORCED(game.loc) && DARK(game.loc)) { if (!FORCED(game.loc) && DARK(game.loc)) {

View file

@ -29,8 +29,7 @@
/* /*
* If you change the first three members, the resume function may not properly * If you change the first three members, the resume function may not properly
* reject saves from older versions. Yes, this glues us to a hardware- * reject saves from older versions. Later members can change, but bump the version
* dependent length of int. Later members can change, but bump the version
* when you do that. * when you do that.
*/ */
struct save_t { struct save_t {
@ -123,8 +122,7 @@ int resume(void)
#endif #endif
FILE *fp = NULL; FILE *fp = NULL;
if (game.loc != 1 || if (game.loc != LOC_START || game.abbrev[LOC_START] != 1) {
game.abbrev[1] != 1) {
rspeak(RESUME_ABANDON); rspeak(RESUME_ABANDON);
if (!yes_or_no(arbitrary_messages[THIS_ACCEPTABLE], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN])) if (!yes_or_no(arbitrary_messages[THIS_ACCEPTABLE], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN]))
return GO_CLEAROBJ; return GO_CLEAROBJ;