X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=main.c;h=579ecfcecc294160c7dcfcb99a517eba1a886782;hb=fb35c34171b0e5b46c217b19bea5d808fb61853b;hp=e8ee600aaef331ba59c2b826c094f8c886e54f1d;hpb=f6cd34f77887ba3c988c7b2b52ac13e049a10965;p=open-adventure.git diff --git a/main.c b/main.c index e8ee600..579ecfc 100644 --- a/main.c +++ b/main.c @@ -32,12 +32,13 @@ * inherited from FORTRAN, someday. To understand these, read the * encoding description for travel. */ -#define T_DESTINATION(entry) MOD(labs(entry) / 1000, 1000) -#define T_NODWARVES(entry) labs(entry) / 1000000 == 100 -#define T_MOTION(entry) MOD(labs(entry), 1000) -#define L_SPEAK(loc) ((loc) - 500) +#define T_DESTINATION(entry) MOD((entry).opcode / 1000, 1000) +#define T_NODWARVES(entry) ((entry).opcode / 1000000 == 100) +#define T_MOTION(entry) MOD((entry).opcode, 1000) #define T_TERMINATE(entry) (T_MOTION(entry) == 1) -#define T_STOP(entry) ((entry) < 0) +#define T_STOP(entry) ((entry).stop) +#define T_OPCODE(entry) ((entry).opcode) +#define L_SPEAK(loc) ((loc) - 500) struct game_t game; @@ -618,7 +619,7 @@ static bool playermove(token_t verb, int motion) } ++kk; } - scratchloc = labs(travel[kk]) / 1000; + scratchloc = 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 = 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 = T_OPCODE(travel[kk]) / 1000; } while (game.newloc == scratchloc); scratchloc = game.newloc;