From: nhmall Date: Wed, 8 Feb 2023 17:44:14 +0000 (-0500) Subject: suppress some warnings if SND_SPEECH is not defined X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=da71e22faccadf9441c2272089bb6e27997ef79f;p=nethack suppress some warnings if SND_SPEECH is not defined apply.c:1413:27: warning: unused variable 'shkp' [-Wunused-variable] struct monst *shkp = shop_keeper(*in_rooms(u.ux, u.uy, SHOPBASE)); ^ apply.c:1570:27: warning: unused variable 'shkp' [-Wunused-variable] struct monst *shkp = shop_keeper(*in_rooms(u.ux, u.uy, SHOPBASE)); ^ apply.c:1650:31: warning: unused variable 'shkp' [-Wunused-variable] struct monst *shkp = shop_keeper(*in_rooms(u.ux, u.uy, SHOPBASE)); ^ apply.c:1697:23: warning: unused variable 'shkp' [-Wunused-variable] struct monst *shkp = shop_keeper(*in_rooms(u.ux, u.uy, SHOPBASE)); ^ apply.c:2157:31: warning: unused variable 'shkp' [-Wunused-variable] struct monst *shkp = shop_keeper(*in_rooms(u.ux, u.uy, SHOPBASE)); ^ apply.c:2165:31: warning: unused variable 'shkp' [-Wunused-variable] struct monst *shkp = shop_keeper(*in_rooms(corpse->ox, --- diff --git a/include/sndprocs.h b/include/sndprocs.h index a095d7f75..f6e8dca67 100755 --- a/include/sndprocs.h +++ b/include/sndprocs.h @@ -447,7 +447,14 @@ SoundAchievement(0, sa2_xpleveldown, level); #undef SOUNDLIBONLY #endif #define SOUNDLIBONLY -#else /* NO SOUNDLIB SELECTED AFTER THIS */ +#ifdef SND_SPEECH +#define VOICEONLY +#else +#define VOICEONLY UNUSED +#endif + +#else /* NO SOUNDLIB IS INTEGRATED AFTER THIS */ + #ifdef SND_LIB_INTEGRATED #undef SND_LIB_INTEGRATED #endif @@ -461,7 +468,15 @@ SoundAchievement(0, sa2_xpleveldown, level); #undef SOUNDLIBONLY #endif #define SOUNDLIBONLY UNUSED +#ifdef SND_SPEECH +#undef SND_SPEECH #endif +#ifdef VOICEONLY +#undef VOICEONLY +#endif +#define VOICEONLY UNUSED + +#endif /* No SOUNDLIB */ enum findsound_approaches { findsound_embedded, diff --git a/src/apply.c b/src/apply.c index 7d8c93b5d..5d381f490 100644 --- a/src/apply.c +++ b/src/apply.c @@ -1410,7 +1410,7 @@ use_candle(struct obj **optr) else if (!otmp->lamplit && was_lamplit) pline("%s out.", (obj->quan > 1L) ? "They go" : "It goes"); if (obj->unpaid) { - struct monst *shkp = shop_keeper(*in_rooms(u.ux, u.uy, SHOPBASE)); + struct monst *shkp VOICEONLY = shop_keeper(*in_rooms(u.ux, u.uy, SHOPBASE)); SetVoice(shkp, 0, 80, 0); verbalize("You %s %s, you bought %s!", @@ -1567,7 +1567,7 @@ catch_lit(struct obj *obj) if (obj->otyp == POT_OIL) makeknown(obj->otyp); if (carried(obj) && obj->unpaid && costly_spot(u.ux, u.uy)) { - struct monst *shkp = shop_keeper(*in_rooms(u.ux, u.uy, SHOPBASE)); + struct monst *shkp VOICEONLY = shop_keeper(*in_rooms(u.ux, u.uy, SHOPBASE)); /* if it catches while you have it, then it's your tough luck */ check_unpaid(obj); @@ -1647,7 +1647,7 @@ use_lamp(struct obj *obj) if (obj->unpaid && costly_spot(u.ux, u.uy) && obj->age == 20L * (long) objects[obj->otyp].oc_cost) { const char *ithem = (obj->quan > 1L) ? "them" : "it"; - struct monst *shkp = shop_keeper(*in_rooms(u.ux, u.uy, SHOPBASE)); + struct monst *shkp VOICEONLY = shop_keeper(*in_rooms(u.ux, u.uy, SHOPBASE)); SetVoice(shkp, 0, 80, 0); verbalize("You burn %s, you bought %s!", ithem, ithem); @@ -1694,7 +1694,7 @@ light_cocktail(struct obj **optr) Blind ? "" : " It gives off a dim light."); if (obj->unpaid && costly_spot(u.ux, u.uy)) { - struct monst *shkp = shop_keeper(*in_rooms(u.ux, u.uy, SHOPBASE)); + struct monst *shkp VOICEONLY = shop_keeper(*in_rooms(u.ux, u.uy, SHOPBASE)); /* Normally, we shouldn't both partially and fully charge * for an item, but (Yendorian Fuel) Taxes are inevitable... @@ -2154,7 +2154,8 @@ use_tinning_kit(struct obj *obj) set_tin_variety(can, HOMEMADE_TIN); if (carried(corpse)) { if (corpse->unpaid) { - struct monst *shkp = shop_keeper(*in_rooms(u.ux, u.uy, SHOPBASE)); + struct monst *shkp VOICEONLY = shop_keeper(*in_rooms( + u.ux, u.uy, SHOPBASE)); SetVoice(shkp, 0, 80, 0); verbalize(you_buy_it); @@ -2162,7 +2163,7 @@ use_tinning_kit(struct obj *obj) useup(corpse); } else { if (costly_spot(corpse->ox, corpse->oy) && !corpse->no_charge) { - struct monst *shkp = shop_keeper(*in_rooms(corpse->ox, + struct monst *shkp VOICEONLY = shop_keeper(*in_rooms(corpse->ox, corpse->oy, SHOPBASE)); SetVoice(shkp, 0, 80, 0); verbalize(you_buy_it);