Abolish unclean operation on OBJSOUND - it's now static.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 23 Jun 2017 19:13:47 +0000 (15:13 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 23 Jun 2017 19:13:47 +0000 (15:13 -0400)
Save/Restore no longer needs to treat it specially.

actions.c
advent.h
saveresume.c

index 4cfcbdcd4f2b709ba538ef8a36aa51dcc02b1c79..e3a6cafea001aa144930182f7397dec107dca5e5 100644 (file)
--- a/actions.c
+++ b/actions.c
@@ -410,7 +410,7 @@ static int drink(token_t verb, token_t obj)
     } else {
         DESTROY(BLOOD);
         game.prop[DRAGON] = 2;
-        OBJSND[BIRD] = OBJSND[BIRD] + 3;
+        game.blooded = true;
         spk = HEAD_BUZZES;
     }
     rspeak(spk);
@@ -687,7 +687,11 @@ static int listen(void)
     for (int i = 1; i <= NOBJECTS; i++) {
         if (!HERE(i) || OBJSND[i] == 0 || game.prop[i] < 0)
             continue;
-        pspeak(i, OBJSND[i] + game.prop[i], game.zzword);
+       int mi =  OBJSND[i] + game.prop[i];
+       if (i == BIRD)
+           /* FIXME: Arithmetic on state values */
+           mi += 3 * game.blooded;
+        pspeak(i, mi, game.zzword);
         spk = NO_MESSAGE;
         if (i == BIRD && OBJSND[i] + game.prop[i] == 8)
             DESTROY(BIRD);
index b642fbf6dccf26441cfd053d2ae91060f495f800..ce39df18f617129f0f0c8a036e1ac386f416a3a6 100644 (file)
--- a/advent.h
+++ b/advent.h
@@ -63,6 +63,7 @@ struct game_t {
     long turns;
     bool wzdark;       /* whether the loc he's leaving was dark */
     long zzword;
+    bool blooded;      /* has player drunk of dragon's blood? */
     long abbrev[LOCSIZ + 1];
     long atloc[LOCSIZ + 1];
     long dseen[NDWARVES + 1];
index c8ba37abb59a11b268d31790f010a768616e0d83..1f052e241bd9f5b9ff7f982e2e2edc916feb71a6 100644 (file)
@@ -63,7 +63,6 @@ int suspend(void)
     save.mode = -1;
     save.version = VRSION;
     memcpy(&save.game, &game, sizeof(struct game_t));
-    save.bird = OBJSND[BIRD];
     save.bivalve = OBJTXT[OYSTER];
     IGNORE(fwrite(&save, sizeof(struct save_t), 1, fp));
     fclose(fp);
@@ -114,7 +113,6 @@ int restore(FILE* fp)
         rspeak(VERSION_SKEW, save.version / 10, MOD(save.version, 10), VRSION / 10, MOD(VRSION, 10));
     } else {
         memcpy(&game, &save.game, sizeof(struct game_t));
-        OBJSND[BIRD] = save.bird;
         OBJTXT[OYSTER] = save.bivalve;
         game.zzword = RNDVOC(3, game.zzword);
     }