Magic-number elimination.
This commit is contained in:
parent
73278b1a3c
commit
346bcf9458
4 changed files with 6 additions and 5 deletions
|
@ -825,7 +825,7 @@ static int lock(token_t verb, token_t obj)
|
|||
return bivalve(verb, obj);
|
||||
if (obj == DOOR)
|
||||
spk = RUSTY_DOOR;
|
||||
if (obj == DOOR && game.prop[DOOR] == 1)
|
||||
if (obj == DOOR && game.prop[DOOR] == DOOR_UNRUSTED)
|
||||
spk = OK_MAN;
|
||||
if (obj == CAGE)
|
||||
spk = NO_LOCK;
|
||||
|
@ -869,7 +869,7 @@ static int pour(token_t verb, token_t obj)
|
|||
rspeak(spk);
|
||||
return GO_CLEAROBJ;
|
||||
}
|
||||
if (HERE(URN) && game.prop[URN] == 0)
|
||||
if (HERE(URN) && game.prop[URN] == URN_EMPTY)
|
||||
return fill(verb, URN);
|
||||
game.prop[BOTTLE] = EMPTY_BOTTLE;
|
||||
game.place[obj] = LOC_NOWHERE;
|
||||
|
@ -952,7 +952,7 @@ static int rub(token_t verb, token_t obj)
|
|||
int spk = actions[verb].message;
|
||||
if (obj != LAMP)
|
||||
spk = PECULIAR_NOTHING;
|
||||
if (obj == URN && game.prop[URN] == 2) {
|
||||
if (obj == URN && game.prop[URN] == URN_LIT) {
|
||||
DESTROY(URN);
|
||||
drop(AMBER, game.loc);
|
||||
game.prop[AMBER] = 1;
|
||||
|
|
1
advent.h
1
advent.h
|
@ -19,6 +19,7 @@
|
|||
#define PANICTIME 15 // time left after closing
|
||||
#define BATTERYLIFE 2500 // turn limit increment from batteries
|
||||
#define WORD_NOT_FOUND -1 // "Word not found" flag value for the vocab hash functions.
|
||||
#define NOT_YET_FOUND -1 // 'Not found" state of treasures */
|
||||
#define CARRIED -1 // Player is toting it
|
||||
#define READ_MODE "rb" // b is not needed for POSIX but harmless
|
||||
#define WRITE_MODE "wb" // b is not needed for POSIX but harmless
|
||||
|
|
2
init.c
2
init.c
|
@ -92,7 +92,7 @@ long initialise(void)
|
|||
for (int treasure = 1; treasure <= NOBJECTS; treasure++) {
|
||||
if (objects[treasure].is_treasure) {
|
||||
if (objects[treasure].inventory != 0)
|
||||
game.prop[treasure] = -1;
|
||||
game.prop[treasure] = NOT_YET_FOUND;
|
||||
game.tally = game.tally - game.prop[treasure];
|
||||
}
|
||||
}
|
||||
|
|
2
main.c
2
main.c
|
@ -185,7 +185,7 @@ static void checkhints(void)
|
|||
game.hintlc[hint] = 0;
|
||||
return;
|
||||
case 4: /* dark */
|
||||
if (game.prop[EMERALD] != -1 && game.prop[PYRAMID] == -1)
|
||||
if (game.prop[EMERALD] != NOT_YET_FOUND && game.prop[PYRAMID] == NOT_YET_FOUND)
|
||||
break;
|
||||
game.hintlc[hint] = 0;
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue