From: Jason S. Ninneman Date: Sat, 1 Jul 2017 13:15:54 +0000 (-0700) Subject: Interim magic number replacement. X-Git-Tag: takebird~159 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=2328739e5141cfa9ede4c94f89571266a96bb5c0;p=open-adventure.git Interim magic number replacement. --- diff --git a/actions.c b/actions.c index 0f17bea..a30d7c0 100644 --- a/actions.c +++ b/actions.c @@ -967,7 +967,7 @@ static int say(struct command_t *command) packed_to_token(command->wd1, word1); int wd = (int) get_vocab_id(word1); /* FIXME: magic numbers */ - if (wd == XYZZY || wd == PLUGH || wd == PLOVER || wd == 2000 + GIANTWORDS || wd == 2000 + PART) { + if (wd == XYZZY || wd == PLUGH || wd == PLOVER || wd == ACTION_WORD(GIANTWORDS) || wd == ACTION_WORD(PART)) { /* FIXME: scribbles on the interpreter's command block */ wordclear(&command->wd2); return GO_LOOKUP; diff --git a/advent.h b/advent.h index 6f66d1e..670d7e9 100644 --- a/advent.h +++ b/advent.h @@ -54,6 +54,11 @@ #define OUTSID(LOC) (CNDBIT(LOC, COND_ABOVE) || FOREST(LOC)) #define INDEEP(LOC) ((LOC) >= LOC_MISTHALL && !OUTSID(LOC)) #define BUG(x) bug(x, #x) +#define MOTION_WORD(n) ((n) + 0) +#define OBJECT_WORD(n) ((n) + 1000) +#define ACTION_WORD(n) ((n) + 2000) +#define SPECIAL_WORD(n) ((n) + 3000) +#define PROMOTE_WORD(n) ((n) + 1000) enum bugtype { SPECIAL_TRAVEL_500_GT_L_GT_300_EXCEEDS_GOTO_LIST, diff --git a/main.c b/main.c index 077e3a9..3c4d448 100644 --- a/main.c +++ b/main.c @@ -1113,12 +1113,12 @@ L2607: wordclear(&command.wd2); } else { /* FIXME: Magic numbers related to vocabulary */ - if (!((V1 != 1000 + WATER && V1 != 1000 + OIL) || - (V2 != 1000 + PLANT && V2 != 1000 + DOOR))) { + if (!((V1 != PROMOTE_WORD(WATER) && V1 != PROMOTE_WORD(OIL)) || + (V2 != PROMOTE_WORD(PLANT) && V2 != PROMOTE_WORD(DOOR)))) { if (AT(V2 - 1000)) command.wd2 = token_to_packed("POUR"); } - if (V1 == 1000 + CAGE && V2 == 1000 + BIRD && HERE(CAGE) && HERE(BIRD)) + if (V1 == PROMOTE_WORD(CAGE) && V2 == PROMOTE_WORD(BIRD) && HERE(CAGE) && HERE(BIRD)) command.wd1 = token_to_packed("CATCH"); } L2620: