From 0903df974f5e0b30c592dbc648cd691fbc0a7d05 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Mon, 27 Apr 2015 21:31:25 +0300 Subject: [PATCH] Unify guards yelling --- include/extern.h | 1 + src/dokick.c | 14 +++----------- src/monmove.c | 18 ++++++++++++++---- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/include/extern.h b/include/extern.h index 4bf8dbbf3..eb736303a 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1373,6 +1373,7 @@ E void FDECL(mon_regen, (struct monst *,BOOLEAN_P)); E int FDECL(dochugw, (struct monst *)); E boolean FDECL(onscary, (int,int,struct monst *)); E void FDECL(monflee, (struct monst *, int, BOOLEAN_P, BOOLEAN_P)); +E void FDECL(mon_yells, (struct monst *, const char *)); E int FDECL(dochug, (struct monst *)); E int FDECL(m_move, (struct monst *,int)); E void FDECL(dissolve_bars, (int,int)); diff --git a/src/dokick.c b/src/dokick.c index 6626c601c..5a380fc91 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -1201,11 +1201,7 @@ dumb: if (is_watch(mtmp->data) && couldsee(mtmp->mx, mtmp->my) && mtmp->mpeaceful) { - if (canspotmon(mtmp)) - pline("%s yells:", Amonnam(mtmp)); - else - You_hear("someone yell:"); - verbalize("Halt, thief! You're under arrest!"); + mon_yells(mtmp, "Halt, thief! You're under arrest!"); (void) angry_guards(FALSE); break; } @@ -1219,15 +1215,11 @@ dumb: if (DEADMONSTER(mtmp)) continue; if (is_watch(mtmp->data) && mtmp->mpeaceful && couldsee(mtmp->mx, mtmp->my)) { - if (canspotmon(mtmp)) - pline("%s yells:", Amonnam(mtmp)); - else - You_hear("someone yell:"); if(levl[x][y].looted & D_WARNED) { - verbalize("Halt, vandal! You're under arrest!"); + mon_yells(mtmp, "Halt, vandal! You're under arrest!"); (void) angry_guards(FALSE); } else { - verbalize("Hey, stop damaging that door!"); + mon_yells(mtmp, "Hey, stop damaging that door!"); levl[x][y].looted |= D_WARNED; } break; diff --git a/src/monmove.c b/src/monmove.c index 990955861..f98a58aca 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -50,6 +50,18 @@ boolean for_unlocking; /* true => credit card ok, false => not ok */ return m_carrying(mon, SKELETON_KEY) || m_carrying(mon, LOCK_PICK); } +void +mon_yells(mon, shout) +struct monst *mon; +const char *shout; +{ + if (canspotmon(mon)) + pline("%s yells:", Amonnam(mon)); + else + You_hear("someone yell:"); + verbalize(shout); +} + STATIC_OVL void watch_on_duty(mtmp) register struct monst *mtmp; @@ -63,13 +75,11 @@ register struct monst *mtmp; (levl[x][y].doormask & D_LOCKED)) { if(couldsee(mtmp->mx, mtmp->my)) { - - pline("%s yells:", Amonnam(mtmp)); if(levl[x][y].looted & D_WARNED) { - verbalize("Halt, thief! You're under arrest!"); + mon_yells(mtmp, "Halt, thief! You're under arrest!"); (void) angry_guards(!!Deaf); } else { - verbalize("Hey, stop picking that lock!"); + mon_yells(mtmp, "Hey, stop picking that lock!"); levl[x][y].looted |= D_WARNED; } stop_occupation();