More structurization.
authorEric S. Raymond <esr@thyrsus.com>
Wed, 24 May 2017 00:59:21 +0000 (20:59 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 24 May 2017 00:59:21 +0000 (20:59 -0400)
actions1.c
actions2.c
init.c
main.c
main.h
score.c
share.h

index 0bbe90e071d9b33a8e0b3b0a280229ec8d277943..b84d62221b610d2291fb4283a75b32d49dce6476 100644 (file)
@@ -442,11 +442,11 @@ L8270:    for (I=1; I<=100; I++) {
 
 L9270: if(DARK(0)) goto L5190;
        if(OBJTXT[OBJ] == 0 || PROP[OBJ] < 0) return(2011);
-       if(OBJ == OYSTER && !CLSHNT) goto L9275;
+       if(OBJ == OYSTER && !game.clshint) goto L9275;
        PSPEAK(OBJ,OBJTXT[OBJ]+PROP[OBJ]);
         return(2012);
 
-L9275: CLSHNT=YES(input,192,193,54);
+L9275: game.clshint=YES(input,192,193,54);
         return(2012);
 
 /*  Break.  Only works for mirror in repository and, of course, the vase. */
@@ -500,11 +500,11 @@ L8305:    DATIME(I,K);
        SAVWDS(OBJ,game.oldlc2,game.oldloc,game.oldobj,game.panic,game.saved,game.setup);
        SAVWDS(game.spk,game.tally,game.thresh,game.trndex,game.trnluz,game.turns,OBJTXT[OYSTER]);
        SAVWDS(VERB,WD1,WD1X,WD2,game.wzdark,game.zzword,OBJSND[BIRD]);
-       SAVWDS(OBJTXT[SIGN],CLSHNT,game.novice,K,K,K,K);
+       SAVWDS(OBJTXT[SIGN],game.clshint,game.novice,K,K,K,K);
        SAVARR(ABB,LOCSIZ);
        SAVARR(ATLOC,LOCSIZ);
        SAVARR(DLOC,6);
-       SAVARR(DSEEN,6);
+       SAVARR(game.dseen,6);
        SAVARR(FIXED,100);
        SAVARR(HINTED,HNTSIZ);
        SAVARR(HINTLC,HNTSIZ);
index 23c85843cad51eff1f30ad7b5551af5408e00a1f..2c5f0c41020c4a7768c7efc46eb5177128f349bf 100644 (file)
@@ -203,7 +203,7 @@ L9128:      RSPEAK(game.spk);
        if(DLOC[I] != LOC) goto L9129;
        K=K+1;
        DLOC[I]=61;
-       DSEEN[I]=false;
+       game.dseen[I]=false;
 L9129: /*etc*/ ;
        } /* end loop */
        game.spk=game.spk+1+1/K;
@@ -234,7 +234,7 @@ int throw(FILE *cmdin) {
 
 L9172: game.spk=48;
        if(RAN(7) < game.dflag) goto L9175;
-       DSEEN[I]=false;
+       game.dseen[I]=false;
        DLOC[I]=0;
        game.spk=47;
        game.dkill=game.dkill+1;
diff --git a/init.c b/init.c
index eed89a41f4a1c0150c8fa59b1f19af223c943df4..bde05122f16cace6c633c33c9cce7b08a11e4525 100644 (file)
--- a/init.c
+++ b/init.c
@@ -532,7 +532,7 @@ L1106:      /*etc*/ ;
        CHLOC=114;
        CHLOC2=140;
        for (I=1; I<=6; I++) {
-       DSEEN[I]=false;
+       game.dseen[I]=false;
        } /* end loop */
        game.dflag=0;
        DLOC[1]=19;
@@ -591,7 +591,7 @@ L1106:      /*etc*/ ;
        game.closng=false;
        game.panic=false;
        game.closed=false;
-       CLSHNT=false;
+       game.clshint=false;
        game.novice=false;
        game.setup=1;
 
diff --git a/main.c b/main.c
index 8cce7c5247dce8549d74c0077767e8c937b91ba7..c0db18924314aa58b2fb258375191e8c5a6b2bd2 100644 (file)
--- a/main.c
+++ b/main.c
@@ -20,9 +20,9 @@ signed char INLINE[LINESIZE+1], MAP1[129], MAP2[129];
 
 long ACTVERB[36], AMBER, ATTACK, AXE, BACK, BATTER, BEAR, BIRD, BLOOD,
                 BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST, CHLOC, CHLOC2,
-               CLAM, CLSHNT, CLSMAX = 12, CLSSES,
+               CLAM, CLSMAX = 12, CLSSES,
                COINS, COND[186], CONDS, CTEXT[13], CVAL[13], DALTLC,
-               DOOR, DPRSSN, DRAGON, DSEEN[7], DWARF, EGGS,
+               DOOR, DPRSSN, DRAGON, DWARF, EGGS,
                EMRALD, ENTER, ENTRNC, FIND, FISSUR, FIXD[101], FOOD,
                GRATE, HINT, HINTED[21], HINTLC[21], HINTS[21][5], HNTMAX,
                HNTSIZ = 20, I, INVENT, IGO, J, JADE, K, K2, KEY[186], KEYS, KK,
@@ -84,7 +84,7 @@ int main(int argc, char *argv[]) {
  *
  *  game.closed says whether we're all the way closed
  *  game.closng says whether it's closing time yet
- *  CLSHNT says whether he's read the clue in the endgame
+ *  game.clshint says whether he's read the clue in the endgame
  *  game.lmwarn says whether he's been warned about lamp going dim
  *  game.novice says whether he asked for instructions at start-up
  *  game.panic says whether he's found out he's trapped in the cave
@@ -144,7 +144,7 @@ L2: if(!OUTSID(game.newloc) || game.newloc == 0 || !game.closng) goto L71;
 
 L71:   if(game.newloc == LOC || FORCED(LOC) || CNDBIT(LOC,3)) goto L74;
        /* 73 */ for (I=1; I<=5; I++) {
-       if(ODLOC[I] != game.newloc || !DSEEN[I]) goto L73;
+           if(ODLOC[I] != game.newloc || !game.dseen[I]) goto L73;
        game.newloc=LOC;
        RSPEAK(2);
         goto L74;
@@ -215,8 +215,8 @@ L6016:      TK[J]=ODLOC[I];
        J=1+RAN(J);
        ODLOC[I]=DLOC[I];
        DLOC[I]=TK[J];
-       DSEEN[I]=(DSEEN[I] && INDEEP(LOC)) || (DLOC[I] == LOC || ODLOC[I] == LOC);
-       if(!DSEEN[I]) goto L6030;
+       game.dseen[I]=(game.dseen[I] && INDEEP(LOC)) || (DLOC[I] == LOC || ODLOC[I] == LOC);
+       if(!game.dseen[I]) goto L6030;
        DLOC[I]=LOC;
        if(I != 6) goto L6027;
 
@@ -251,7 +251,7 @@ L6023:      /*etc*/ ;
        } /* end loop */
 L6024: DLOC[6]=CHLOC;
        ODLOC[6]=CHLOC;
-       DSEEN[6]=false;
+       game.dseen[6]=false;
         goto L6030;
 
 L6025: RSPEAK(186);
@@ -797,7 +797,7 @@ L41000: if(game.tally == 1 && PROP[JADE] < 0) goto L40010;
 L10000: PROP[GRATE]=0;
        PROP[FISSUR]=0;
        for (I=1; I<=6; I++) {
-       DSEEN[I]=false;
+       game.dseen[I]=false;
        DLOC[I]=0;
        } /* end loop */
        MOVE(TROLL,0);
diff --git a/main.h b/main.h
index 5af50f3a7625c62b1be79dc393dac80705c058fa..fd51876a2183f4e62bab1a79d2a585ca86a12927 100644 (file)
--- a/main.h
+++ b/main.h
@@ -50,6 +50,9 @@ struct game_t {
     long wzdark;
     long zzword;
     /* more state will go here */
+    long clshint;
     long novice;
+    /* more state will go here */
+    long dseen[7];
 };
 extern struct game_t game;
diff --git a/score.c b/score.c
index 1b3736efc52eac3773db1c8d1c95b0207e9be734..6e0fc5380a1f11920d4d27cac3463c67670836b7 100644 (file)
--- a/score.c
+++ b/score.c
@@ -84,7 +84,7 @@ L20020: MXSCOR=MXSCOR+45;
        if(HINTED[I])SCORE=SCORE-HINTS[I][2];
        } /* end loop */
        if(game.novice)SCORE=SCORE-5;
-       if(CLSHNT)SCORE=SCORE-10;
+       if(game.clshint)SCORE=SCORE-10;
        SCORE=SCORE-game.trnluz-game.saved;
 
 /*  Return to score command if that's where we came from. */
diff --git a/share.h b/share.h
index a30719152c88998b372aa976c816449941c16a59..cf8693b7eb8e25c8e6a9c3c01ecc61251c24ba6c 100644 (file)
--- a/share.h
+++ b/share.h
@@ -2,9 +2,8 @@ extern void score(long);
 extern long ACTVERB[], AMBER, ATTACK, AXE, BACK, BATTER, BEAR,
    BIRD, BLOOD,
    BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST, CHLOC, CHLOC2,
-   CLAM, CLSHNT, CLSMAX, CLSSES,
-   COINS, COND[], CONDS, CTEXT[], CVAL[], DALTLC,
-   DOOR, DPRSSN, DRAGON, DSEEN[], DWARF, EGGS,
+   CLAM, CLSMAX, CLSSES, COINS, COND[], CONDS, CTEXT[], CVAL[], DALTLC,
+   DOOR, DPRSSN, DRAGON, DWARF, EGGS,
    EMRALD, ENTER, ENTRNC, FIND, FISSUR, FIXD[], FOOD,
    GRATE, HINT, HINTED[], HINTLC[], HINTS[][5], HNTMAX,
    HNTSIZ, I, INVENT, IGO, J, JADE, K, K2, KEY[], KEYS, KK,