From: nethack.rankin Date: Mon, 25 Mar 2002 08:05:27 +0000 (+0000) Subject: warning bit X-Git-Tag: MOVE2GIT~2881 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e848030571a7875d46cebce8d7ab07d6c6d1af7a;p=nethack warning bit Avoid gcc's inaccurate warning about mattk possibly being used before being set in do_breathe(). --- diff --git a/include/monattk.h b/include/monattk.h index 996a765e5..02ee881ab 100644 --- a/include/monattk.h +++ b/include/monattk.h @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)monattk.h 3.4 1995/01/28 */ +/* SCCS Id: @(#)monattk.h 3.4 2002/03/24 */ /* NetHack may be freely redistributed. See license for details. */ /* Copyright 1988, M. Stephenson */ @@ -8,6 +8,7 @@ /* Add new attack types below - ordering affects experience (exper.c). * Attacks > AT_BUTT are worth extra experience. */ +#define AT_ANY (-1) /* fake attack; dmgtype_fromattack wildcard */ #define AT_NONE 0 /* passive monster (ex. acid blob) */ #define AT_CLAW 1 /* claw (punch, hit, etc.) */ #define AT_BITE 2 /* bite */ @@ -32,6 +33,7 @@ * Note that 1-10 correspond to the types of attack used in buzz(). * Please don't disturb the order unless you rewrite the buzz() code. */ +#define AD_ANY (-1) /* fake damage; attacktype_fordmg wildcard */ #define AD_PHYS 0 /* ordinary physical */ #define AD_MAGM 1 /* magic missiles */ #define AD_FIRE 2 /* fire damage */ diff --git a/src/mondata.c b/src/mondata.c index 026184f5c..a51722c99 100644 --- a/src/mondata.c +++ b/src/mondata.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)mondata.c 3.4 2001/12/05 */ +/* SCCS Id: @(#)mondata.c 3.4 2002/03/24 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -6,10 +6,6 @@ #include "eshk.h" #include "epri.h" -/* fake attack and damage types */ -#define AT_ANY (-1) -#define AD_ANY (-1) - /* These routines provide basic data for any type of monster. */ #ifdef OVLB diff --git a/src/polyself.c b/src/polyself.c index 019c846c6..abcd7e9f3 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)polyself.c 3.4 2002/01/15 */ +/* SCCS Id: @(#)polyself.c 3.4 2002/03/24 */ /* Copyright (C) 1987, 1988, 1989 by Ken Arromdee */ /* NetHack may be freely redistributed. See license for details. */ @@ -705,6 +705,8 @@ rehumanize() int dobreathe() { + struct attack *mattk; + if (Strangled) { You_cant("breathe. Sorry."); return(0); @@ -717,17 +719,13 @@ dobreathe() flags.botl = 1; if (!getdir((char *)0)) return(0); - else { - register struct attack *mattk; - register int i; - for(i = 0; i < NATTK; i++) { - mattk = &(youmonst.data->mattk[i]); - if(mattk->aatyp == AT_BREA) break; - } + mattk = attacktype_fordmg(youmonst.data, AT_BREA, AD_ANY); + if (!mattk) + impossible("bad breath attack?"); /* mouthwash needed... */ + else buzz((int) (20 + mattk->adtyp-1), (int)mattk->damn, u.ux, u.uy, u.dx, u.dy); - } return(1); }