From 8443f73265c296c551ae26610c5e61ac794021e6 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 4 Oct 2019 17:53:01 -0700 Subject: [PATCH] glob pricing get_pricing_units() returns a long, so use long for intermediate steps of the calculation. Part of github issue 229, about mixing signed and unsigned. --- src/shk.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/shk.c b/src/shk.c index f5c42bacd..5fcc70c99 100644 --- a/src/shk.c +++ b/src/shk.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 shk.c $NHDT-Date: 1558124088 2019/05/17 20:14:48 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.163 $ */ +/* NetHack 3.6 shk.c $NHDT-Date: 1570236762 2019/10/05 00:52:42 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.168 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2035,11 +2035,11 @@ struct obj *obj; if (obj->globby) { /* globs must be sold by weight not by volume */ - int unit_weight = (int) objects[obj->otyp].oc_weight, - wt = (obj->owt > 0) ? obj->owt : weight(obj); + long unit_weight = (long) objects[obj->otyp].oc_weight, + wt = (obj->owt > 0) ? (long) obj->owt : (long) weight(obj); if (unit_weight) - units = wt / unit_weight; + units = (wt + unit_weight - 1L) / unit_weight; } return units; }