From 1813865dc8d0fddc2b6ebcab6cac08e8492ba22e Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 18 Dec 2018 14:30:31 -0800 Subject: [PATCH 1/2] warn_unused_result in end.c There is only one warn_unused_result warning from gcc in end.c; change the code a little to use it. --- src/end.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/end.c b/src/end.c index 353469a5d..b89eee7e9 100644 --- a/src/end.c +++ b/src/end.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 end.c $NHDT-Date: 1544917598 2018/12/15 23:46:38 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.158 $ */ +/* NetHack 3.6 end.c $NHDT-Date: 1545172226 2018/12/18 22:30:26 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.159 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -128,14 +128,17 @@ static boolean NDECL(NH_panictrace_libc); static boolean NDECL(NH_panictrace_gdb); #ifndef NO_SIGNAL -/*ARGSUSED*/ -void panictrace_handler( - sig_unused) /* called as signal() handler, so sent at least one arg */ +/* called as signal() handler, so sent at least one arg */ +/*ARGUSED*/ +void +panictrace_handler(sig_unused) int sig_unused UNUSED; { #define SIG_MSG "\nSignal received.\n" - (void) write(2, SIG_MSG, sizeof(SIG_MSG) - 1); - NH_abort(); + int f2 = (int) write(2, SIG_MSG, sizeof SIG_MSG - 1); + + nhUse(f2); /* what could we do if write to fd#2 (stderr) fails */ + NH_abort(); /* ... and we're already in the process of quitting? */ } void @@ -201,7 +204,7 @@ NH_abort() traceback and exit; 2 = show traceback and stay in debugger */ /* if (wizard && gdb_prio == 1) gdb_prio = 2; */ vms_traceback(gdb_prio); - (void) libc_prio; /* half-hearted attempt at lint suppression */ + nhUse(libc_prio); #endif /* ?VMS */ From 011181a6ed86888c9de27e0d3308d97cc8eedee1 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 18 Dec 2018 17:16:05 -0800 Subject: [PATCH 2/2] make diluted oil less effective than normal oil Suggested 6.5 years ago... --- doc/fixes36.2 | 2 ++ include/extern.h | 4 ++-- src/explode.c | 13 +++++++++---- src/potion.c | 7 +++++-- src/timeout.c | 4 +++- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 9cd67bc38..f499a6351 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -284,6 +284,8 @@ while levitating inside a shop, throwing an unpaid item and having recoil move leave the item unpaid on shop floor and also on the shop's bill but not visible via 'Iu' or 'Ix'; leaving the shop after that would anger the shopkeeper and summon kops +diluted potion of oil is less effective when filling lamps (adds less fuel) + or burning (lasts less long) or exploding (inflicts less damage) Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/include/extern.h b/include/extern.h index f8a81c7b7..bd0255c2a 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 extern.h $NHDT-Date: 1545043771 2018/12/17 10:49:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.673 $ */ +/* NetHack 3.6 extern.h $NHDT-Date: 1545182146 2018/12/19 01:15:46 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.674 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -739,7 +739,7 @@ E long FDECL(rndexp, (BOOLEAN_P)); E void FDECL(explode, (int, int, int, int, CHAR_P, int)); E long FDECL(scatter, (int, int, int, unsigned int, struct obj *)); -E void FDECL(splatter_burning_oil, (int, int)); +E void FDECL(splatter_burning_oil, (int, int, BOOLEAN_P)); E void FDECL(explode_oil, (struct obj *, int, int)); /* ### extralev.c ### */ diff --git a/src/explode.c b/src/explode.c index 46d3b327f..941d22201 100644 --- a/src/explode.c +++ b/src/explode.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 explode.c $NHDT-Date: 1543101719 2018/11/24 23:21:59 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.59 $ */ +/* NetHack 3.6 explode.c $NHDT-Date: 1545182146 2018/12/19 01:15:46 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.60 $ */ /* Copyright (C) 1990 by Ken Arromdee */ /* NetHack may be freely redistributed. See license for details. */ @@ -780,12 +780,15 @@ struct obj *obj; /* only scatter this obj */ * For now, just perform a "regular" explosion. */ void -splatter_burning_oil(x, y) +splatter_burning_oil(x, y, diluted_oil) int x, y; +boolean diluted_oil; { + int dmg = d(diluted_oil ? 3 : 4, 4); + /* ZT_SPELL(ZT_FIRE) = ZT_SPELL(AD_FIRE-1) = 10+(2-1) = 11 */ #define ZT_SPELL_O_FIRE 11 /* value kludge, see zap.c */ - explode(x, y, ZT_SPELL_O_FIRE, d(4, 4), BURNING_OIL, EXPL_FIERY); + explode(x, y, ZT_SPELL_O_FIRE, dmg, BURNING_OIL, EXPL_FIERY); } /* lit potion of oil is exploding; extinguish it as a light source before @@ -795,10 +798,12 @@ explode_oil(obj, x, y) struct obj *obj; int x, y; { + boolean diluted_oil = obj->odiluted; + if (!obj->lamplit) impossible("exploding unlit oil"); end_burn(obj, TRUE); - splatter_burning_oil(x, y); + splatter_burning_oil(x, y, diluted_oil); } /*explode.c*/ diff --git a/src/potion.c b/src/potion.c index dc96331e6..a6bf5f656 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 potion.c $NHDT-Date: 1543745356 2018/12/02 10:09:16 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.155 $ */ +/* NetHack 3.6 potion.c $NHDT-Date: 1545182147 2018/12/19 01:15:47 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.156 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2169,7 +2169,10 @@ more_dips: } else { You("fill %s with oil.", yname(obj)); check_unpaid(potion); /* Yendorian Fuel Tax */ - obj->age += 2 * potion->age; /* burns more efficiently */ + /* burns more efficiently in a lamp than in a bottle; + diluted potion provides less benefit but we don't attempt + to track that the lamp now also has some non-oil in it */ + obj->age += (!potion->odiluted ? 4L : 3L) * potion->age / 2L; if (obj->age > 1500L) obj->age = 1500L; useup(potion); diff --git a/src/timeout.c b/src/timeout.c index 29b740fcc..a4408de5c 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 timeout.c $NHDT-Date: 1544050558 2018/12/05 22:55:58 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.88 $ */ +/* NetHack 3.6 timeout.c $NHDT-Date: 1545182148 2018/12/19 01:15:48 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.89 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1423,6 +1423,8 @@ boolean already_lit; case POT_OIL: turns = obj->age; + if (obj->odiluted) + turns = (3L * turns + 2L) / 4L; radius = 1; /* very dim light */ break;