stack merging vs shop pricing
When merging one stack into another and they have different obj->o_id price adjustments, keep the o_id of whichever one commands the higher shop price.
This commit is contained in:
@@ -312,8 +312,11 @@ looking into an applied container with ':' showed prices of unpaid items but
|
||||
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)
|
||||
when splitting a stack of gems where internal ID is used to make adjustment to
|
||||
when splitting a stack where internal ID is used to make adjustment to
|
||||
shop prices, pick an ID for new stack that yields same prices as old
|
||||
when merging a stack where internal ID is used to adjust shop prices, always
|
||||
keep the ID which induces the higher price (only matters when buying
|
||||
from shop, not when selling; doesn't affect items already on bill)
|
||||
|
||||
|
||||
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository
|
||||
|
||||
13
src/shk.c
13
src/shk.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 shk.c $NHDT-Date: 1545951668 2018/12/27 23:01:08 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.149 $ */
|
||||
/* NetHack 3.6 shk.c $NHDT-Date: 1545953813 2018/12/27 23:36:53 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.150 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -958,6 +958,17 @@ register struct obj *obj, *merge;
|
||||
*bp = ESHK(shkp)->bill_p[ESHK(shkp)->billct];
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
/* not on bill; if the item is being merged away rather than
|
||||
just deleted and has a higher price adjustment than the stack
|
||||
being merged into, give the latter the former's obj->o_id so
|
||||
that the merged stack takes on higher price; matters if hero
|
||||
eventually buys them from a shop, but doesn't matter if hero
|
||||
owns them and intends to sell (unless he subsequently buys
|
||||
them back) or if no shopping activity ever involves them */
|
||||
if (merge && (oid_price_adjustment(obj, obj->o_id)
|
||||
> oid_price_adjustment(merge, merge->o_id)))
|
||||
merge->o_id = obj->o_id;
|
||||
}
|
||||
if (obj->owornmask) {
|
||||
impossible("obfree: deleting worn obj (%d: %ld)", obj->otyp,
|
||||
|
||||
Reference in New Issue
Block a user