From: PatR Date: Sat, 9 Jan 2016 23:28:25 +0000 (-0800) Subject: fix #H4083 - globs preID'd as "uncursed" X-Git-Tag: NetHack-3.6.1_RC01~1050 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3a8ce3ff981bca3e60135c0fe94e33b9175dda3c;p=nethack fix #H4083 - globs preID'd as "uncursed" I think there was also a report about this during beta testing. Killing an ooze, slime, or pudding left a glob of same which had its bknown flag pre-set so was immediately shown as "uncursed" even to non-priests. Use another way to maximize glob mergability: allow globs to merge even when one has bknown set and the other doesn't. --- diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 49dc28c48..174c21b95 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -104,6 +104,10 @@ covetous monsters may choose to teleport to downstairs or ladders doppelganger posing as Rider would never change shape since doppelganger posing as Rider could never revert to innate form, protection from shape changers turned it into genuine Rider +don't create globs of ooze/slime/pudding with bknown flag set so pre-known to + be "uncursed" +do allow globs with same curse/bless state to merge even when that state is + known for one and unknown for the other; result will have bknown clear Platform- and/or Interface-Specific Fixes diff --git a/src/invent.c b/src/invent.c index a79c7d46b..94ae77d7c 100644 --- a/src/invent.c +++ b/src/invent.c @@ -2880,24 +2880,46 @@ mergable(otmp, obj) register struct obj *otmp, *obj; { int objnamelth = 0, otmpnamelth = 0; + if (obj == otmp) return FALSE; /* already the same object */ if (obj->otyp != otmp->otyp) + return FALSE; /* different types */ + if (obj->nomerge) /* explicitly marked to prevent merge */ return FALSE; + /* coins of the same kind will always merge */ if (obj->oclass == COIN_CLASS) return TRUE; + if (obj->unpaid != otmp->unpaid || obj->spe != otmp->spe || obj->dknown != otmp->dknown - || (obj->bknown != otmp->bknown && !Role_if(PM_PRIEST)) || obj->cursed != otmp->cursed || obj->blessed != otmp->blessed || obj->no_charge != otmp->no_charge || obj->obroken != otmp->obroken || obj->otrapped != otmp->otrapped || obj->lamplit != otmp->lamplit - || obj->greased != otmp->greased || obj->oeroded != otmp->oeroded - || obj->oeroded2 != otmp->oeroded2 || obj->bypass != otmp->bypass) + || obj->bypass != otmp->bypass) return FALSE; - if (obj->nomerge) /* explicitly marked to prevent merge */ + if (obj->oclass == FOOD_CLASS + && (obj->oeaten != otmp->oeaten || obj->orotten != otmp->orotten)) + return FALSE; + + if (obj->globby) { + /* globs won't merge if they have different bless/curse + state, but will merge non-bknown with bknown */ + if (obj->bknown != otmp->bknown) + obj->bknown = otmp->bknown = 0; + if (obj->rknown != otmp->rknown) + obj->rknown = otmp->rknown = 0; + if (obj->greased != otmp->greased) + obj->greased = otmp->greased = 0; + /* checks beyond this point aren't applicable to globs */ + return TRUE; + } + + if ((obj->bknown != otmp->bknown && !Role_if(PM_PRIEST)) + || obj->oeroded != otmp->oeroded || obj->oeroded2 != otmp->oeroded2 + || obj->greased != otmp->greased) return FALSE; if ((obj->oclass == WEAPON_CLASS || obj->oclass == ARMOR_CLASS) @@ -2905,10 +2927,6 @@ register struct obj *otmp, *obj; || obj->rknown != otmp->rknown)) return FALSE; - if (obj->oclass == FOOD_CLASS - && (obj->oeaten != otmp->oeaten || obj->orotten != otmp->orotten)) - return FALSE; - if (obj->otyp == CORPSE || obj->otyp == EGG || obj->otyp == TIN) { if (obj->corpsenm != otmp->corpsenm) return FALSE; @@ -3413,6 +3431,7 @@ doorganize() /* inventory organizer by Del Lamb */ names, strip off the name of the one being moved */ if (olth && !obj->oartifact && !mergable(otmp, obj)) { char *holdname = ONAME(obj); + ONAME(obj) = (char *) 0; /* restore name iff merging is still not possible */ if (!mergable(otmp, obj)) { diff --git a/src/mkobj.c b/src/mkobj.c index 9a1023117..a6f8bfd29 100644 --- a/src/mkobj.c +++ b/src/mkobj.c @@ -819,11 +819,9 @@ boolean artif; } if (Is_pudding(otmp)) { otmp->globby = 1; - otmp->known = otmp->bknown = otmp->rknown = otmp->dknown = 1; - otmp->corpsenm = - PM_GRAY_OOZE + (otmp->otyp - GLOB_OF_GRAY_OOZE); - /* this ensures that they don't fail merging because of - * BUC status or other irrelevancies */ + otmp->known = otmp->dknown = 1; + otmp->corpsenm = PM_GRAY_OOZE + + (otmp->otyp - GLOB_OF_GRAY_OOZE); } else { if (otmp->otyp != CORPSE && otmp->otyp != MEAT_RING && otmp->otyp != KELP_FROND && !rn2(6)) {