From: Eric S. Raymond Date: Wed, 28 Jun 2017 01:55:29 +0000 (-0400) Subject: All travel[] references are now wrapped in extractor/predicate macros. X-Git-Tag: 1.1~64 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=d53f1255559f00d3662be93e17fd4c9ccba8f299;p=open-adventure.git All travel[] references are now wrapped in extractor/predicate macros. This is a step toward pulling the magic numbers apart into data structures so there will be fewer magic numbers in the code. --- diff --git a/main.c b/main.c index e8ee600..5ad7d90 100644 --- a/main.c +++ b/main.c @@ -38,6 +38,7 @@ #define L_SPEAK(loc) ((loc) - 500) #define T_TERMINATE(entry) (T_MOTION(entry) == 1) #define T_STOP(entry) ((entry) < 0) +#define T_OPCODE(entry) (entry) struct game_t game; @@ -618,7 +619,7 @@ static bool playermove(token_t verb, int motion) } ++kk; } - scratchloc = labs(travel[kk]) / 1000; + scratchloc = labs(T_OPCODE(travel[kk])) / 1000; do { /* @@ -647,7 +648,7 @@ static bool playermove(token_t verb, int motion) if (T_STOP(travel[kk])) BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION); ++kk; - game.newloc = labs(travel[kk]) / 1000; + game.newloc = labs(T_OPCODE(travel[kk])) / 1000; } while (game.newloc == scratchloc); scratchloc = game.newloc; @@ -688,7 +689,7 @@ static bool playermove(token_t verb, int motion) if (T_STOP(travel[kk])) BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION); ++kk; - game.newloc = labs(travel[kk]) / 1000; + game.newloc = labs(T_OPCODE(travel[kk])) / 1000; } while (game.newloc == scratchloc); scratchloc = game.newloc;