Abolish unclean operation on OBJSOUND - it's now static.

Save/Restore no longer needs to treat it specially.
This commit is contained in:
Eric S. Raymond 2017-06-23 15:13:47 -04:00
parent ecff53d3a8
commit 15b7c00e0a
3 changed files with 7 additions and 4 deletions

View file

@ -410,7 +410,7 @@ static int drink(token_t verb, token_t obj)
} else { } else {
DESTROY(BLOOD); DESTROY(BLOOD);
game.prop[DRAGON] = 2; game.prop[DRAGON] = 2;
OBJSND[BIRD] = OBJSND[BIRD] + 3; game.blooded = true;
spk = HEAD_BUZZES; spk = HEAD_BUZZES;
} }
rspeak(spk); rspeak(spk);
@ -687,7 +687,11 @@ static int listen(void)
for (int i = 1; i <= NOBJECTS; i++) { for (int i = 1; i <= NOBJECTS; i++) {
if (!HERE(i) || OBJSND[i] == 0 || game.prop[i] < 0) if (!HERE(i) || OBJSND[i] == 0 || game.prop[i] < 0)
continue; 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; spk = NO_MESSAGE;
if (i == BIRD && OBJSND[i] + game.prop[i] == 8) if (i == BIRD && OBJSND[i] + game.prop[i] == 8)
DESTROY(BIRD); DESTROY(BIRD);

View file

@ -63,6 +63,7 @@ struct game_t {
long turns; long turns;
bool wzdark; /* whether the loc he's leaving was dark */ bool wzdark; /* whether the loc he's leaving was dark */
long zzword; long zzword;
bool blooded; /* has player drunk of dragon's blood? */
long abbrev[LOCSIZ + 1]; long abbrev[LOCSIZ + 1];
long atloc[LOCSIZ + 1]; long atloc[LOCSIZ + 1];
long dseen[NDWARVES + 1]; long dseen[NDWARVES + 1];

View file

@ -63,7 +63,6 @@ int suspend(void)
save.mode = -1; save.mode = -1;
save.version = VRSION; save.version = VRSION;
memcpy(&save.game, &game, sizeof(struct game_t)); memcpy(&save.game, &game, sizeof(struct game_t));
save.bird = OBJSND[BIRD];
save.bivalve = OBJTXT[OYSTER]; save.bivalve = OBJTXT[OYSTER];
IGNORE(fwrite(&save, sizeof(struct save_t), 1, fp)); IGNORE(fwrite(&save, sizeof(struct save_t), 1, fp));
fclose(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)); rspeak(VERSION_SKEW, save.version / 10, MOD(save.version, 10), VRSION / 10, MOD(VRSION, 10));
} else { } else {
memcpy(&game, &save.game, sizeof(struct game_t)); memcpy(&game, &save.game, sizeof(struct game_t));
OBJSND[BIRD] = save.bird;
OBJTXT[OYSTER] = save.bivalve; OBJTXT[OYSTER] = save.bivalve;
game.zzword = RNDVOC(3, game.zzword); game.zzword = RNDVOC(3, game.zzword);
} }