From 15b7c00e0a9427b88e20cf814b8904030ca06d9e Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Fri, 23 Jun 2017 15:13:47 -0400 Subject: [PATCH] Abolish unclean operation on OBJSOUND - it's now static. Save/Restore no longer needs to treat it specially. --- actions.c | 8 ++++++-- advent.h | 1 + saveresume.c | 2 -- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/actions.c b/actions.c index 4cfcbdc..e3a6caf 100644 --- 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); diff --git a/advent.h b/advent.h index b642fbf..ce39df1 100644 --- 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]; diff --git a/saveresume.c b/saveresume.c index c8ba37a..1f052e2 100644 --- a/saveresume.c +++ b/saveresume.c @@ -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); } -- 2.31.1