From 1df88e4c65337e2a6de469d8a3c5958dfbf81b39 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 9 Sep 2022 11:45:30 -0700 Subject: [PATCH] fix #H3820 - vault guard's "I repeat" message Reported seven and a half years ago: if you are in a vault but not carrying any gold and the guard arrives, you're told "Follow me." Then if you pick up gold while the guard is still in the wall breach rather than out in the corridor, you would be told "I repeat, drop that gold and follow me!" "Repeat" refers to the follow part but sounds as if it refers to the drop-gold part which isn't actually being repeated. Keep track of whether the guard has issued a drop gold demand and use that to vary the wording of subsequent "I repeat" message. Modifies monst->mextra->egd so save and bones files are invalidated. --- include/mextra.h | 3 ++- include/patchlevel.h | 2 +- src/vault.c | 21 +++++++++++++++------ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/include/mextra.h b/include/mextra.h index 177d21446..e8c15bd3e 100644 --- a/include/mextra.h +++ b/include/mextra.h @@ -80,7 +80,8 @@ struct egd { coordxy gdx, gdy; /* goal of guard's walk */ coordxy ogx, ogy; /* guard's last position */ d_level gdlevel; /* level (& dungeon) guard was created in */ - xint16 warncnt; /* number of warnings to follow */ + xint8 warncnt; /* number of warnings to follow */ + xint8 dropgoldcnt; /* number of demands to drop gold */ Bitfield(gddone, 1); /* true iff guard has released player */ Bitfield(witness, 2); /* the guard saw you do something */ Bitfield(unused, 5); diff --git a/include/patchlevel.h b/include/patchlevel.h index bbc96bdad..7f9f6fd33 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -17,7 +17,7 @@ * Incrementing EDITLEVEL can be used to force invalidation of old bones * and save files. */ -#define EDITLEVEL 63 +#define EDITLEVEL 64 /* * Development status possibilities. diff --git a/src/vault.c b/src/vault.c index c4ef28df1..f86a4b5e2 100644 --- a/src/vault.c +++ b/src/vault.c @@ -553,6 +553,7 @@ invault(void) "Most likely all your gold was stolen from this vault."); verbalize("Please drop that gold and follow me."); } + EGD(guard)->dropgoldcnt++; } EGD(guard)->gdx = gx; EGD(guard)->gdy = gy; @@ -908,12 +909,20 @@ gd_move(struct monst *grd) u_carry_gold = (umoney > 0L || hidden_gold(TRUE) > 0L); if (egrd->fcend == 1) { if (u_in_vault && (u_carry_gold || um_dist(grd->mx, grd->my, 1))) { - if (egrd->warncnt == 3 && !Deaf) - verbalize("I repeat, %sfollow me!", - u_carry_gold - ? (!umoney ? "drop that hidden gold and " - : "drop that gold and ") - : ""); + if (egrd->warncnt == 3 && !Deaf) { + char buf[BUFSZ]; + + Sprintf(buf, "%sfollow me!", + u_carry_gold ? (!umoney ? "drop that hidden gold and " + : "drop that gold and ") + : ""); + if (egrd->dropgoldcnt || !u_carry_gold) + verbalize("I repeat, %s", buf); + else + verbalize("%s", upstart(buf)); + if (u_carry_gold) + egrd->dropgoldcnt++; + } if (egrd->warncnt == 7) { m = grd->mx; n = grd->my;