From de1861aa0f486f797a5e0a4342e05288a1d5f8ee Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 20 Dec 2018 18:28:57 -0800 Subject: [PATCH 1/3] fix #H6189 - Eyes of the Overworld database entry The phrasing of the data.base entry for the Eyes of the Overworld reads as if it is continuing some passage in a reference book, but that comes off strange when using '/' to see it. Rephrase it. data.base could stand to have an entry for 'lenses'.... --- dat/data.base | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/dat/data.base b/dat/data.base index ebb781af7..410912710 100644 --- a/dat/data.base +++ b/dat/data.base @@ -1,5 +1,5 @@ # NetHack 3.6 data.base -# $NHDT-Date: 1524683801 2018/04/25 19:16:41 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.84 $ +# $NHDT-Date: 1545359287 2018/12/21 02:28:07 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.87 $ # Copyright (c) 1994, 1995, 1996 by the NetHack Development Team # Copyright (c) 1994 by Boudewijn Wayers # NetHack may be freely redistributed. See license for details. @@ -1629,9 +1629,19 @@ eye of the aethiopica the power to instantly open a portal to any other area of the dungeon, allowing its invoker to travel quickly between areas. +# note: The Eyes of the Overworld is the title of Jack Vance's sequel +# to The Dying Earth and in it the 'Eyes' were separate "cusps" that +# needed to be worn like contact lenses, one on each eyeball. Wearing +# just one and attempting to look with both eyes caused instant stun. +# And when wearing two you couldn't see normal world, only a projection +# of it that had similar topology but where everything was "better". +# NetHack simplifies things: a pair of lenses is a single item like +# spectacles (eyeglasses), and the effect of wearing these lenses has +# been changed to be useful to game play (Xray vision). [The quote is +# not derived from the book.] eyes of the overworld - ... and finally there is "the Eyes of the Overworld". This - obscure artifact pushes the wearer's view sense into the + The Eyes of the Overworld is a rather obscure artifact. + These magical lenses push the wearer's view sense into the "overworld" -- another name for a segment of the Astral Plane. Usually, there is nothing to be seen. However, the wearer is also able to look back and see the area around herself, From 4e1eecc7fa20472fbecaced78a8e4687d1d432c0 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 20 Dec 2018 18:58:44 -0800 Subject: [PATCH 2/3] data.base lookup bit When testing the change to the Eyes of the Overworld wording and asking for information about inventory item k - a pair of lenses named The Eyes of the Overworld I got "I don't have any information on those things". Not because that item wasn't identified, but because the lookup was for "pair of lenses" (finding nothing) and then for "The Eyes of the Overworld" (and not finding it due to "The" which is stripped from the first attempt but wasn't from the second nor present in the data.base key). --- doc/fixes36.2 | 2 ++ src/pager.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index b4437d63a..b080b417d 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -293,6 +293,8 @@ vibrating square is not really a trap so monsters don't need to avoid it if hero kicks some embedded gold out of a wall while following vault gaurd away from vault, don't report "the guard _calms_down_and_ picks up the gold" unless he's on brink of going ballistic +for '/?' information lookup, "item named The Artifact" failed to find info + about "Artifact" due to presence of "The" Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/pager.c b/src/pager.c index 6982860c9..f15c40f59 100644 --- a/src/pager.c +++ b/src/pager.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 pager.c $NHDT-Date: 1545129848 2018/12/18 10:44:08 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.142 $ */ +/* NetHack 3.6 pager.c $NHDT-Date: 1545361111 2018/12/21 02:58:31 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.143 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2018. */ /* NetHack may be freely redistributed. See license for details. */ @@ -576,6 +576,8 @@ char *supplemental_name; if (*dbase_str == ' ') ++dbase_str; } + if (!strncmp(dbase_str, "pair of ", 8)) + dbase_str += 8; if (!strncmp(dbase_str, "tame ", 5)) dbase_str += 5; else if (!strncmp(dbase_str, "peaceful ", 9)) @@ -640,6 +642,14 @@ char *supplemental_name; ep = strstri(dbase_str, ", "); if (ep && ep > dbase_str) *ep = '\0'; + /* remove article from 'alt' name ("a pair of lenses named + The Eyes of the Overworld" simplified above to "lenses named + The Eyes of the Overworld", now reduced to "The Eyes of the + Overworld", skip "The" as with base name processing) */ + if (!strncmpi(alt, "a ", 2) + || !strncmpi(alt, "an ", 3) + || !strncmpi(alt, "the ", 4)) + alt = index(alt, ' ') + 1; /* remove charges or "(lit)" or wizmode "(N aum)" */ if ((ep = strstri(dbase_str, " (")) != 0 && ep > dbase_str) *ep = '\0'; From 0e583161094b417eb64e5c3b02fb91f854fe7ebb Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 21 Dec 2018 01:14:45 -0800 Subject: [PATCH 3/3] fix #H2680 - IDing unpaid gem should adjust price Another one from 6.5 years ago, identifying a type of gem should give a new price for any unpaid gems of that type and adjust shopping bill accordingly. Report was for rubbing with touchstone and learning worthless glass with price not changing until the learned 'gem' was dropped. Fix works for that and also other forms of identification (and for amnesia, raising prices of forgotten gems); no dropping is required for the price to change. Theoretically could apply to any type of item, but prices of gems are by far the most sensitive to whether or not they're identified. --- doc/fixes36.2 | 2 ++ include/extern.h | 3 ++- src/o_init.c | 10 ++++++++-- src/shk.c | 41 ++++++++++++++++++++++++++++++++++++++++- 4 files changed, 52 insertions(+), 4 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index b080b417d..e9484a622 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -295,6 +295,8 @@ if hero kicks some embedded gold out of a wall while following vault gaurd the gold" unless he's on brink of going ballistic for '/?' information lookup, "item named The Artifact" failed to find info about "Artifact" due to presence of "The" +identifying or forgetting gem types now adjusts prices for gems already on + shopping bill Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/include/extern.h b/include/extern.h index bd0255c2a..78c7647da 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* 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 $ */ +/* NetHack 3.6 extern.h $NHDT-Date: 1545383614 2018/12/21 09:13:34 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.675 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2220,6 +2220,7 @@ E long FDECL(contained_cost, (struct obj *, struct monst *, long, BOOLEAN_P, BOOLEAN_P)); E long FDECL(contained_gold, (struct obj *)); E void FDECL(picked_container, (struct obj *)); +E void FDECL(gem_learned, (int)); E void FDECL(alter_cost, (struct obj *, long)); E long FDECL(unpaid_cost, (struct obj *, BOOLEAN_P)); E boolean FDECL(billable, (struct monst **, struct obj *, CHAR_P, BOOLEAN_P)); diff --git a/src/o_init.c b/src/o_init.c index b4fc440ee..b2d28f50e 100644 --- a/src/o_init.c +++ b/src/o_init.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 o_init.c $NHDT-Date: 1528332336 2018/06/07 00:45:36 $ $NHDT-Branch: NetHack-3.6.2 $:$NHDT-Revision: 1.24 $ */ +/* NetHack 3.6 o_init.c $NHDT-Date: 1545383615 2018/12/21 09:13:35 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.25 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -362,8 +362,11 @@ boolean credit_hero; exercise(A_WIS, TRUE); } /* moves==1L => initial inventory, gameover => final disclosure */ - if (moves > 1L && !program_state.gameover) + if (moves > 1L && !program_state.gameover) { + if (objects[oindx].oc_class == GEM_CLASS) + gem_learned(oindx); /* could affect price of unpaid gems */ update_inventory(); + } } } @@ -390,6 +393,9 @@ register int oindx; disco[dindx - 1] = 0; else impossible("named object not in disco"); + + if (objects[oindx].oc_class == GEM_CLASS) + gem_learned(oindx); /* ok, it's actually been unlearned */ update_inventory(); } } diff --git a/src/shk.c b/src/shk.c index 1a50616e9..315de4c1d 100644 --- a/src/shk.c +++ b/src/shk.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 shk.c $NHDT-Date: 1545036290 2018/12/17 08:44:50 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.143 $ */ +/* NetHack 3.6 shk.c $NHDT-Date: 1545383616 2018/12/21 09:13:36 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.144 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2278,6 +2278,45 @@ register struct monst *shkp; return tmp; } +/* unlike alter_cost() which operates on a specific item, identifying or + forgetting a gem causes all unpaid gems of its type to change value */ +void +gem_learned(oindx) +int oindx; +{ + struct obj *obj; + struct monst *shkp; + struct bill_x *bp; + int ct; + + /* + * Unfortunately, shop bill doesn't have object type included, + * just obj->oid for each unpaid stack, so we have to go through + * every bill and every item on that bill and match up against + * every unpaid stack on the level.... + * + * Fortunately, there's no need to catch up when changing dungeon + * levels even if we ID'd or forget some gems while gone from a + * level. There won't be any shop bills when arriving; they were + * either paid before leaving or got treated as robbery and it's + * too late to adjust pricing. + */ + for (shkp = next_shkp(fmon, TRUE); shkp; + shkp = next_shkp(shkp->nmon, TRUE)) { + ct = ESHK(shkp)->billct; + bp = ESHK(shkp)->bill; + while (--ct >= 0) { + obj = find_oid(bp->bo_id); + if (!obj) /* shouldn't happen */ + continue; + if ((oindx != STRANGE_OBJECT) ? (obj->otyp == oindx) + : (obj->oclass == GEM_CLASS)) + bp->price = get_cost(obj, shkp); + ++bp; + } + } +} + /* called when an item's value has been enhanced; if it happens to be on any shop bill, update that bill to reflect the new higher price [if the new price drops for some reason, keep the old one in place] */