From: Eric S. Raymond Date: Wed, 7 Jun 2017 01:06:16 +0000 (-0400) Subject: Magic-number elimination. X-Git-Tag: 1.1~595 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=3b8122ae3a12281d8b8a8e10a6ffe49a5ba35154;p=open-adventure.git Magic-number elimination. --- diff --git a/actions2.c b/actions2.c index 295f188..08a6283 100644 --- a/actions2.c +++ b/actions2.c @@ -198,7 +198,7 @@ L9128: RSPEAK(SPK); RSPEAK(6); DSTROY(OGRE); K=0; - for (I=1; I<=5; I++) { + for (I=1; I < PIRATE; I++) { if(DLOC[I] == LOC) { K=K+1; DLOC[I]=61; diff --git a/advent.h b/advent.h index 13ad1e7..af9695a 100644 --- a/advent.h +++ b/advent.h @@ -3,6 +3,7 @@ #define LINESIZE 100 #define NDWARVES 6 +#define PIRATE NDWARVES /* must be NDWARVES-1 when zero-origin */ typedef struct lcg_state { diff --git a/init.c b/init.c index 53552f7..1220d88 100644 --- a/init.c +++ b/init.c @@ -330,8 +330,8 @@ L1106: /*etc*/ ; CHLOC=114; CHLOC2=140; - for (I=1; I<=6; I++) { - DSEEN[I]=false; + for (I=1; I<=NDWARVES; I++) { + DSEEN[I]=false; } /* end loop */ DFLAG=0; DLOC[1]=19;