From 74dc97866b102f650c06436569b2a207927f96ce Mon Sep 17 00:00:00 2001 From: nhmall Date: Thu, 17 Oct 2019 21:26:59 -0400 Subject: [PATCH 1/4] spelling mistake in comment in recent commit --- src/files.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/files.c b/src/files.c index 77b279077..f9d5be795 100644 --- a/src/files.c +++ b/src/files.c @@ -3066,7 +3066,7 @@ boolean FDECL((*proc), (char *)); while (*ep == ' ' || *ep == '\t') ++ep; - /* ingore empty lines and full-line comment lines */ + /* ignore empty lines and full-line comment lines */ if (!*ep || *ep == '#') ignoreline = TRUE; From 4b87e858aa422beff83020f6fa00bee451d1d85e Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 17 Oct 2019 18:45:56 -0700 Subject: [PATCH 2/4] fix #H9312 - partly eaten food in bones shop Dying in a shop while carrying partly eaten food would place that food on the floor without marking it no_charge. But marking it that way wouldn't have helped because as bones data gets saved, every object on the level has its no_charge flag cleared. So 'no_charge' needs to be explicitly set for partly eaten food in tended shops as a bones level gets loaded. Most of the shk.c diff is reformatting, but it does change the get_pricing_units() routine to lie that the quantity is zero for partly eaten food so that when multiplying with price it won't matter whether the price has been forced to zero or been left non-zero. --- doc/fixes36.3 | 5 ++++- src/bones.c | 20 +++++++++++++++++++- src/shk.c | 28 +++++++++++++--------------- 3 files changed, 36 insertions(+), 17 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index b1b3b3e2c..756d69da9 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.140 $ $NHDT-Date: 1571352531 2019/10/17 22:48:51 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.141 $ $NHDT-Date: 1571363147 2019/10/18 01:45:47 $ This fixes36.3 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.2 in May 2019. Please note, however, @@ -188,6 +188,9 @@ fix monster stepping on a land mine code accessing deleted trap revise 'O' to show symbol sets in the same order they appear in the symbols file and order the sets in dat/symbols to yield a sensible symset menu yellow dragons had green breath +partly eaten food in a bones level shop would show a non-zero sale price + while on the floor but not be placed on shop bill if picked up; + sale price should have been "no charge" Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/src/bones.c b/src/bones.c index 0a7b81793..d5623fcde 100644 --- a/src/bones.c +++ b/src/bones.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 bones.c $NHDT-Date: 1557092711 2019/05/05 21:45:11 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.75 $ */ +/* NetHack 3.6 bones.c $NHDT-Date: 1571363147 2019/10/18 01:45:47 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.76 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985,1993. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -85,6 +85,24 @@ boolean restore; } else if (has_oname(otmp)) { sanitize_name(ONAME(otmp)); } + /* 3.6.3: set no_charge for partly eaten food in shop; + all other items become goods for sale if in a shop */ + if (otmp->oclass == FOOD_CLASS && otmp->oeaten) { + struct obj *top; + char *p; + xchar ox, oy; + + for (top = otmp; top->where == OBJ_CONTAINED; + top = top->ocontainer) + continue; + otmp->no_charge = (top->where == OBJ_FLOOR + && get_obj_location(top, &ox, &oy, 0) + /* can't use costly_spot() since its + result depends upon hero's location */ + && inside_shop(ox, oy) + && *(p = in_rooms(ox, oy, SHOPBASE)) + && tended_shop(&rooms[*p - ROOMOFFSET])); + } } else { /* saving */ /* do not zero out o_ids for ghost levels anymore */ diff --git a/src/shk.c b/src/shk.c index 5fcc70c99..a3a84d64b 100644 --- a/src/shk.c +++ b/src/shk.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 shk.c $NHDT-Date: 1570236762 2019/10/05 00:52:42 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.168 $ */ +/* NetHack 3.6 shk.c $NHDT-Date: 1571363148 2019/10/18 01:45:48 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.169 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -55,9 +55,10 @@ STATIC_DCL long FDECL(stolen_container, (struct obj *, struct monst *, STATIC_DCL long FDECL(getprice, (struct obj *, BOOLEAN_P)); STATIC_DCL void FDECL(shk_names_obj, (struct monst *, struct obj *, const char *, long, const char *)); -STATIC_DCL struct obj *FDECL(bp_to_obj, (struct bill_x *)); STATIC_DCL boolean FDECL(inherits, (struct monst *, int, int, BOOLEAN_P)); STATIC_DCL void FDECL(set_repo_loc, (struct monst *)); +STATIC_DCL struct obj *FDECL(bp_to_obj, (struct bill_x *)); +STATIC_DCL long FDECL(get_pricing_units, (struct obj *)); STATIC_DCL boolean NDECL(angry_shk_exists); STATIC_DCL void FDECL(rile_shk, (struct monst *)); STATIC_DCL void FDECL(rouse_shk, (struct monst *, BOOLEAN_P)); @@ -75,7 +76,6 @@ STATIC_DCL void FDECL(deserted_shop, (char *)); STATIC_DCL boolean FDECL(special_stock, (struct obj *, struct monst *, BOOLEAN_P)); STATIC_DCL const char *FDECL(cad, (BOOLEAN_P)); -STATIC_DCL long FDECL(get_pricing_units, (struct obj *obj)); /* invariants: obj->unpaid iff onbill(obj) [unless bp->useup] @@ -2033,7 +2033,9 @@ struct obj *obj; { long units = obj->quan; - if (obj->globby) { + if (obj->oclass == FOOD_CLASS && obj->oeaten) { + units = 0L; + } else if (obj->globby) { /* globs must be sold by weight not by volume */ long unit_weight = (long) objects[obj->otyp].oc_weight, wt = (obj->owt > 0) ? (long) obj->owt : (long) weight(obj); @@ -4866,7 +4868,7 @@ struct obj *obj_absorber, *obj_absorbed; * Scenario 1. Shop-owned glob absorbing into shop-owned glob **************************************************************/ if (bp && (!obj_absorber->no_charge - || billable(&shkp, obj_absorber, eshkp->shoproom, FALSE))) { + || billable(&shkp, obj_absorber, eshkp->shoproom, FALSE))) { /* the glob being absorbed has a billing record */ amount = bp->price; eshkp->billct--; @@ -4939,18 +4941,14 @@ struct obj *obj_absorber, *obj_absorbed; /************************************************************** * Scenario 3. shop_owned glob merging into player_owned glob **************************************************************/ - if (bp && - (obj_absorber->no_charge - || (floor_absorber && !costly_spot(x, y)))) { + if (bp && (obj_absorber->no_charge + || (floor_absorber && !costly_spot(x, y)))) { amount = bp->price; bill_dummy_object(obj_absorbed); - verbalize( - "You owe me %ld %s for my %s that you %s with your%s", - amount, currency(amount), obj_typename(obj_absorbed->otyp), - ANGRY(shkp) ? "had the audacity to mix" : - "just mixed", - ANGRY(shkp) ? " stinking batch!" : - "s."); + verbalize("You owe me %ld %s for my %s that you %s with your%s", + amount, currency(amount), obj_typename(obj_absorbed->otyp), + ANGRY(shkp) ? "had the audacity to mix" : "just mixed", + ANGRY(shkp) ? " stinking batch!" : "s."); return; } /************************************************************** From 1086f137de278979e6eb7cb8806b60c036d53846 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 17 Oct 2019 18:55:35 -0700 Subject: [PATCH 3/4] revert part of 4b87e858aa - partly eaten food Partly eaten globs is seems to be can'o'worms and the hack I just added to get_pricing_units() made things worse, so back that out. --- src/shk.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/shk.c b/src/shk.c index a3a84d64b..0cb7e2ab1 100644 --- a/src/shk.c +++ b/src/shk.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 shk.c $NHDT-Date: 1571363148 2019/10/18 01:45:48 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.169 $ */ +/* NetHack 3.6 shk.c $NHDT-Date: 1571363715 2019/10/18 01:55:15 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.170 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2033,9 +2033,7 @@ struct obj *obj; { long units = obj->quan; - if (obj->oclass == FOOD_CLASS && obj->oeaten) { - units = 0L; - } else if (obj->globby) { + if (obj->globby) { /* globs must be sold by weight not by volume */ long unit_weight = (long) objects[obj->otyp].oc_weight, wt = (obj->owt > 0) ? (long) obj->owt : (long) weight(obj); From a0d57d0a74449c47ea149360f572e37ede06ea27 Mon Sep 17 00:00:00 2001 From: k21971 Date: Thu, 17 Oct 2019 08:49:22 -0400 Subject: [PATCH 4/4] curses - remove unused variable in curses_str_remainder() and remove incorrect use of 'count' which could result in messages being repeated indefiitely. --- win/curses/cursmisc.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/win/curses/cursmisc.c b/win/curses/cursmisc.c index 75e127332..a158b221c 100644 --- a/win/curses/cursmisc.c +++ b/win/curses/cursmisc.c @@ -377,7 +377,6 @@ curses_str_remainder(const char *str, int width, int line_num) int strsize = strlen(str) + 1; #if __STDC_VERSION__ >= 199901L char substr[strsize]; - char curstr[strsize]; char tmpstr[strsize]; strcpy(substr, str); @@ -386,7 +385,6 @@ curses_str_remainder(const char *str, int width, int line_num) #define BUFSZ 256 #endif char substr[BUFSZ * 2]; - char curstr[BUFSZ * 2]; char tmpstr[BUFSZ * 2]; if (strsize > (BUFSZ * 2) - 1) { @@ -414,11 +412,7 @@ curses_str_remainder(const char *str, int width, int line_num) if (last_space == 0) { /* No spaces found */ last_space = count - 1; } - for (count = 0; count < last_space; count++) { - curstr[count] = substr[count]; - } - curstr[count] = '\0'; - if (substr[count] == '\0') { + if (substr[last_space] == '\0') { break; } for (count = (last_space + 1); count < (int) strlen(substr); count++) {