From 4af03d8ef8896110fc618d9c28c20b1103d28d0a Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 8 Mar 2024 23:34:12 -0800 Subject: [PATCH] fix garbled comment The prolog comment for hurtle() ends with * dx and dy should be the direction of the hurtle, not of the original * kick or throw and be only. The clause "and be only" is incomplete and was added sometime between 3.3.0 and 3.4.0. I suspect it was meant to say "and be only -1 or 0 or +1" but the code enforces that with sgn(dx) and sgn(dy) so if that's the case, it isn't necessary. Whether that guess is right or wrong, remove the clause since as it stands now, it makes no sense. --- src/dothrow.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/dothrow.c b/src/dothrow.c index 702af8dac..4fe668e96 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 dothrow.c $NHDT-Date: 1695159620 2023/09/19 21:40:20 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.269 $ */ +/* NetHack 3.7 dothrow.c $NHDT-Date: 1709969638 2024/03/09 07:33:58 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.285 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2013. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1075,7 +1075,7 @@ mhurtle_step(genericptr_t arg, coordxy x, coordxy y) * throwing or kicking something. * * dx and dy should be the direction of the hurtle, not of the original - * kick or throw and be only. + * kick or throw. */ void hurtle(int dx, int dy, int range, boolean verbose) @@ -1096,14 +1096,11 @@ hurtle(int dx, int dy, int range, boolean verbose) return; } else if (u.utrap) { You("are anchored by the %s.", - u.utraptype == TT_WEB - ? "web" - : u.utraptype == TT_LAVA - ? hliquid("lava") - : u.utraptype == TT_INFLOOR - ? surface(u.ux, u.uy) - : u.utraptype == TT_BURIEDBALL ? "buried ball" - : "trap"); + (u.utraptype == TT_WEB) ? "web" + : (u.utraptype == TT_LAVA) ? hliquid("lava") + : (u.utraptype == TT_INFLOOR) ? surface(u.ux, u.uy) + : (u.utraptype == TT_BURIEDBALL) ? "buried ball" + : "trap"); nomul(0); return; } @@ -1119,7 +1116,8 @@ hurtle(int dx, int dy, int range, boolean verbose) gm.multi_reason = "moving through the air"; gn.nomovemsg = ""; /* it just happens */ if (verbose) - You("%s in the opposite direction.", range > 1 ? "hurtle" : "float"); + You("%s in the opposite direction.", + (range > 1) ? "hurtle" : "float"); /* if we're in the midst of shooting multiple projectiles, stop */ endmultishot(TRUE); uc.x = u.ux;