From: Pasi Kallinen Date: Fri, 4 Aug 2017 19:41:26 +0000 (+0300) Subject: Using a cursed tin whistle in a vault summons the guard X-Git-Tag: NetHack-3.6.1_RC01~437 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b6d1ee3320777b6569f7ca9b93f1edc5e80bc2f2;p=nethack Using a cursed tin whistle in a vault summons the guard ...since guards respond to shrill whistles. Based on a patch by Leon Arnott. --- diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 73803752a..c29309ad3 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -405,6 +405,7 @@ fix the 'A' command to have the 'D' command's fix for C331-1 (quirk for response, to operate on applicable all items, there would still be a followup menu asking to choose specific items) eating 1 tin from stack of N (for N >= 2) on shop's floor forced hero to buy 2 +using a cursed whistle in a vault will summon the guard immediately Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository diff --git a/include/extern.h b/include/extern.h index c65148d27..7d49b29d1 100644 --- a/include/extern.h +++ b/include/extern.h @@ -2510,6 +2510,7 @@ E int FDECL(hide_privileges, (BOOLEAN_P)); E void FDECL(newegd, (struct monst *)); E void FDECL(free_egd, (struct monst *)); E boolean FDECL(grddead, (struct monst *)); +E void NDECL(vault_summon_gd); E char FDECL(vault_occupied, (char *)); E void NDECL(invault); E int FDECL(gd_move, (struct monst *)); diff --git a/include/hack.h b/include/hack.h index dffb26c5c..c4691ae26 100644 --- a/include/hack.h +++ b/include/hack.h @@ -34,6 +34,9 @@ enum encumbrance_types { /* weight increment of heavy iron ball */ #define IRON_BALL_W_INCR 160 +/* number of turns it takes for vault guard to show up */ +#define VAULT_GUARD_TIME 30 + /* hunger states - see hu_stat in eat.c */ enum hunger_state_types { SATIATED = 0, diff --git a/src/apply.c b/src/apply.c index fca3f8e36..6337eb49d 100644 --- a/src/apply.c +++ b/src/apply.c @@ -445,6 +445,8 @@ struct obj *obj; } else { You(whistle_str, obj->cursed ? "shrill" : "high"); wake_nearby(); + if (obj->cursed) + vault_summon_gd(); } } diff --git a/src/vault.c b/src/vault.c index f076986f5..296116c53 100644 --- a/src/vault.c +++ b/src/vault.c @@ -191,6 +191,13 @@ findgd() return (struct monst *) 0; } +void +vault_summon_gd() +{ + if (vault_occupied(u.urooms) && !findgd()) + u.uinvault = (VAULT_GUARD_TIME - 1); +} + char vault_occupied(array) char *array; @@ -221,7 +228,8 @@ invault() vaultroom -= ROOMOFFSET; guard = findgd(); - if (++u.uinvault % 30 == 0 && !guard) { /* if time ok and no guard now. */ + if (++u.uinvault % VAULT_GUARD_TIME == 0 && !guard) { + /* if time ok and no guard now. */ char buf[BUFSZ]; register int x, y, dd, gx, gy; int lx = 0, ly = 0;