Magic-number elimination.

This commit is contained in:
Eric S. Raymond 2022-04-19 17:07:46 -04:00
parent 00c2182d9b
commit 67a887f432
3 changed files with 2 additions and 9 deletions

2
init.c
View file

@ -60,7 +60,7 @@ int initialise(void)
if (!(locations[i].description.big == 0 || if (!(locations[i].description.big == 0 ||
tkey[i] == 0)) { tkey[i] == 0)) {
int k = tkey[i]; int k = tkey[i];
if (T_TERMINATE(travel[k])) if (travel[k].motion == HERE)
conditions[i] |= (1 << COND_FORCED); conditions[i] |= (1 << COND_FORCED);
} }
} }

2
main.c
View file

@ -656,7 +656,7 @@ static void playermove(int motion)
/* Look for a way to fulfil the motion verb passed in - travel_entry indexes /* Look for a way to fulfil the motion verb passed in - travel_entry indexes
* the beginning of the motion entries for here (game.loc). */ * the beginning of the motion entries for here (game.loc). */
for (;;) { for (;;) {
if (T_TERMINATE(travel[travel_entry]) || if ((travel[travel_entry].motion == HERE) ||
travel[travel_entry].motion == motion) travel[travel_entry].motion == motion)
break; break;
if (travel[travel_entry].stop) { if (travel[travel_entry].stop) {

View file

@ -104,13 +104,6 @@ typedef struct {{
const bool stop; const bool stop;
}} travelop_t; }} travelop_t;
/* Abstract out the encoding of words in the travel array. Gives us
* some hope of getting to a less cryptic representation than we
* inherited from FORTRAN, someday. To understand these, read the
* encoding description for travel.
*/
#define T_TERMINATE(entry) ((entry).motion == 1)
extern const location_t locations[]; extern const location_t locations[];
extern const object_t objects[]; extern const object_t objects[];
extern const char* arbitrary_messages[]; extern const char* arbitrary_messages[];