From d53f1255559f00d3662be93e17fd4c9ccba8f299 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 27 Jun 2017 21:55:29 -0400 Subject: [PATCH] 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. --- main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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; -- 2.31.1