From: PatR Date: Thu, 27 Dec 2018 21:31:42 +0000 (-0800) Subject: mines luckstone as achievement marker X-Git-Tag: NetHack-3.6.2_Released~117^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f8b4ad3fdc682e8e70633d761383121e7aa41e27;p=nethack mines luckstone as achievement marker It was possible to have the guaranteed luckstone at Mines' End become merged with a random one and lose its specialness for achievement tracking. Mark it 'nomerge' when created and clear that if/when the achievement is recorded. --- diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 120e67360..34da7b77b 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -309,6 +309,9 @@ bag of holding explosion inside shop billed hero for unpaid contents if it happened when applied while carried but not when looted while on floor looking into an applied container with ':' showed prices of unpaid items but looking into a looted one with ':' did not show prices for shop items +prevent achievement luckstone from merging with other luckstones if kicked or + dropped by monster (not applicable for dropped by player; achievement + would have been recorded and luckstone reverted to normal if picked up) Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/invent.c b/src/invent.c index 21fdcdf4b..7b1c15378 100644 --- a/src/invent.c +++ b/src/invent.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 invent.c $NHDT-Date: 1545785120 2018/12/26 00:45:20 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.246 $ */ +/* NetHack 3.6 invent.c $NHDT-Date: 1545946249 2018/12/27 21:30:49 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.247 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -816,9 +816,11 @@ struct obj *obj; if (is_mines_prize(obj)) { u.uachieve.mines_luckstone = 1; obj->record_achieve_special = NON_PM; + obj->nomerge = 0; } else if (is_soko_prize(obj)) { u.uachieve.finish_sokoban = 1; obj->record_achieve_special = NON_PM; + obj->nomerge = 0; } } @@ -3534,11 +3536,10 @@ 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 */ + /* fail if already the same object, if different types, if either is + explicitly marked to prevent merge, or if not mergable in general */ + if (obj == otmp || obj->otyp != otmp->otyp + || obj->nomerge || otmp->nomerge || !objects[obj->otyp].oc_merge) return FALSE; /* coins of the same kind will always merge */ diff --git a/src/sp_lev.c b/src/sp_lev.c index 6ebf7e9df..43492a0fa 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 sp_lev.c $NHDT-Date: 1524287226 2018/04/21 05:07:06 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.98 $ */ +/* NetHack 3.6 sp_lev.c $NHDT-Date: 1545946257 2018/12/27 21:30:57 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.109 $ */ /* Copyright (c) 1989 by Jean-Christophe Collet */ /* NetHack may be freely redistributed. See license for details. */ @@ -2045,16 +2045,20 @@ struct mkroom *croom; if (Is_mineend_level(&u.uz)) { if (otmp->otyp == iflags.mines_prize_type) { otmp->record_achieve_special = MINES_PRIZE; + /* prevent stacking; cleared when achievement is recorded */ + otmp->nomerge = 1; if (++mines_prize_count > 1) impossible(prize_warning, "mines end"); } } else if (Is_sokoend_level(&u.uz)) { if (otmp->otyp == iflags.soko_prize_type1) { otmp->record_achieve_special = SOKO_PRIZE1; + otmp->nomerge = 1; /* redundant; Sokoban prizes don't stack */ if (++soko_prize_count > 1) impossible(prize_warning, "sokoban end"); } else if (otmp->otyp == iflags.soko_prize_type2) { otmp->record_achieve_special = SOKO_PRIZE2; + otmp->nomerge = 1; /* redundant; Sokoban prizes don't stack */ if (++soko_prize_count > 1) impossible(prize_warning, "sokoban end"); }