Bring SETUP variable into game state block
authorEric S. Raymond <esr@thyrsus.com>
Wed, 7 Jun 2017 09:24:48 +0000 (05:24 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 7 Jun 2017 09:24:48 +0000 (05:24 -0400)
Saved separately because the kogic around this variable looks
a bit dubious and may need review.

actions1.c
advent.h
init.c
main.c

index 3fabfbdefd91b792c222e91cb633ca7e2f581de6..7f00bdabb1462da9152f9dab1684657149811bb6 100644 (file)
@@ -536,7 +536,7 @@ L8305:      DATIME(&I,&K);
        SAVWDS(game.abbnum,game.blklin,game.bonus,game.clock1,game.clock2,game.closed,game.closng);
        SAVWDS(game.detail,game.dflag,game.dkill,game.dtotal,game.foobar,game.holdng,game.iwest);
        SAVWDS(game.knfloc,game.limit,LL,game.lmwarn,LOC,game.newloc,game.numdie);
-       SAVWDS(OBJ,game.oldlc2,game.oldloc,game.oldobj,game.panic,game.saved,SETUP);
+       SAVWDS(OBJ,game.oldlc2,game.oldloc,game.oldobj,game.panic,game.saved,game.setup);
        SAVWDS(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],game.clshnt,game.novice,K,K,K,K);
index 85d9026881e6cfc9d7d80f65dfd7b8885582f77a..0f06ccc3d8cf5d836b00ab5b2c05d2cb9495581b 100644 (file)
--- a/advent.h
+++ b/advent.h
@@ -43,6 +43,7 @@ struct game_t {
     long oldobj;
     long panic;
     long saved;
+    long setup;
     long tally;
     long thresh;
     long trndex;
@@ -133,7 +134,7 @@ extern long AMBER, ATTACK, AXE, BACK, BATTER, BEAR,
    OGRE, OIL, OLDOBJ, OYSTER,
    PANIC, PEARL, PILLOW, PLANT, PLANT2, PROP[], PYRAM,
    RESER, ROD, ROD2, RUBY, RUG, SAPPH, SAY,
-   SCORE, SECT, SETUP, SIGN, SNAKE, SPK, STEPS, STICK,
+   SCORE, SECT, SIGN, SNAKE, SPK, STEPS, STICK,
    STREAM, THROW, TK[], TRIDNT, TROLL, TROLL2,
    URN, V1, V2, VASE, VEND, VERB,
    VOLCAN, VRSION, WATER, WD1, WD1X, WD2, WD2X;
diff --git a/init.c b/init.c
index 12d3ad1a71986be32b16f486ef66465334db75ec..5425b7a0a15a4d615f1a08be86fec4b498e9b74d 100644 (file)
--- a/init.c
+++ b/init.c
@@ -392,7 +392,7 @@ L1106:      /*etc*/ ;
        game.closed=false;
        game.clshnt=false;
        game.novice=false;
-       SETUP=1;
+       game.setup=1;
        game.blklin=true;
 
        /* if we can ever think of how, we should save it at this point */
diff --git a/main.c b/main.c
index 8a58c5770035dfa8815d1c28ccb41c26a198f260..21a8fa8fa56b0c3a3c70cc12bb112c69cb3aa485 100644 (file)
--- a/main.c
+++ b/main.c
@@ -16,8 +16,7 @@ struct game_t game;
 
 long ATLOC[186], FIXED[NOBJECTS+1],
                LINK[NOBJECTS*2 + 1], LNLENG, LNPOSN,
-               PARMS[26], PLACE[NOBJECTS+1],
-               SETUP = 0;
+               PARMS[26], PLACE[NOBJECTS+1];
 char rawbuf[LINESIZE], INLINE[LINESIZE+1], MAP1[129], MAP2[129];
 
 long AMBER, ATTACK, AXE, BACK, BATTER, BEAR, BIRD, BLOOD,
@@ -110,8 +109,8 @@ int main(int argc, char *argv[]) {
 /*  Read the database if we have not yet done so */
 
        MAP2[1] = 0;
-       if(!SETUP)initialise();
-       if(SETUP > 0) goto L1;
+       if (!game.setup)initialise();
+       if(game.setup > 0) goto L1;
 
 /*  Unlike earlier versions, adventure is no longer restartable.  (This
  *  lets us get away with modifying things such as OBJSND(BIRD) without
@@ -123,7 +122,7 @@ int main(int argc, char *argv[]) {
 
 /*  Start-up, dwarf stuff */
 
-L1:    SETUP= -1;
+L1:    game.setup= -1;
        I=0;
        game.zzword=RNDVOC(3,0);
        game.novice=YES(stdin, 65,1,0);