unpaid shop goods in inventory (trunk only)
Inventory display adds "(unpaid, N zorkmids)" to carried unpaid items, but it didn't show anything comparable for indirect unpaid ones (hero-owned containers holding shop-owned objects). Now it will include "(contents, N zorkmids)" in such cases.
This commit is contained in:
@@ -166,6 +166,8 @@ pad shortest rumors to improve distribution of delivered rumors
|
||||
wake up sleeping steed when putting on saddle or mounting
|
||||
stop wielding cockatrice corpse which triggered own death followed by life-save
|
||||
format various prompts to avoid "Query truncated" entries in paniclog
|
||||
for inventory display, include cost info on hero-owned containers holding
|
||||
shop goods
|
||||
|
||||
|
||||
Platform- and/or Interface-Specific Fixes
|
||||
|
||||
@@ -1988,7 +1988,7 @@ E long FDECL(contained_cost, (struct obj *,struct monst *,long,BOOLEAN_P, BOOLEA
|
||||
E long FDECL(contained_gold, (struct obj *));
|
||||
E void FDECL(picked_container, (struct obj *));
|
||||
E void FDECL(alter_cost, (struct obj *,long));
|
||||
E long FDECL(unpaid_cost, (struct obj *));
|
||||
E long FDECL(unpaid_cost, (struct obj *,BOOLEAN_P));
|
||||
E boolean FDECL(billable, (struct monst **,struct obj *,CHAR_P,BOOLEAN_P));
|
||||
E void FDECL(addtobill, (struct obj *,BOOLEAN_P,BOOLEAN_P,BOOLEAN_P));
|
||||
E void FDECL(splitbill, (struct obj *,struct obj *));
|
||||
|
||||
@@ -160,6 +160,7 @@ struct instance_flags {
|
||||
int in_lava_effects; /* hack for Boots_off() */
|
||||
int purge_monsters; /* # of dead monsters still on fmon list */
|
||||
int override_ID; /* true to force full identification of objects */
|
||||
int suppress_price; /* controls doname() for unpaid objects */
|
||||
coord travelcc; /* coordinates for travel_cache */
|
||||
boolean window_inited; /* true if init_nhwindows() completed */
|
||||
boolean vision_inited; /* true if vision is ready */
|
||||
|
||||
18
src/invent.c
18
src/invent.c
@@ -1986,12 +1986,12 @@ dounpaid()
|
||||
if (count == 1) {
|
||||
marker = (struct obj *) 0;
|
||||
otmp = find_unpaid(invent, &marker);
|
||||
cost = unpaid_cost(otmp);
|
||||
otmp->unpaid = 0; /* suppress "(unpaid)" suffix */
|
||||
cost = unpaid_cost(otmp, FALSE);
|
||||
iflags.suppress_price++; /* suppress "(unpaid)" suffix */
|
||||
pline("%s", xprname(otmp, distant_name(otmp, doname),
|
||||
carried(otmp) ? otmp->invlet : CONTAINED_SYM,
|
||||
TRUE, cost, 0L));
|
||||
otmp->unpaid = 1; /*(wouldn't be here if this wasn't true)*/
|
||||
iflags.suppress_price--;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2011,11 +2011,11 @@ dounpaid()
|
||||
classcount++;
|
||||
}
|
||||
|
||||
totcost += cost = unpaid_cost(otmp);
|
||||
otmp->unpaid = 0; /* suppress "(unpaid)" suffix */
|
||||
totcost += cost = unpaid_cost(otmp, FALSE);
|
||||
iflags.suppress_price++; /* suppress "(unpaid)" suffix */
|
||||
putstr(win, 0, xprname(otmp, distant_name(otmp, doname),
|
||||
ilet, TRUE, cost, 0L));
|
||||
otmp->unpaid = 1;
|
||||
iflags.suppress_price--;
|
||||
num_so_far++;
|
||||
}
|
||||
}
|
||||
@@ -2037,14 +2037,14 @@ dounpaid()
|
||||
|
||||
marker = (struct obj *) 0; /* haven't found any */
|
||||
while (find_unpaid(otmp->cobj, &marker)) {
|
||||
totcost += cost = unpaid_cost(marker);
|
||||
totcost += cost = unpaid_cost(marker, FALSE);
|
||||
contcost += cost;
|
||||
if (otmp->cknown) {
|
||||
marker->unpaid = 0; /* suppress "(unpaid)" suffix */
|
||||
iflags.suppress_price++; /* suppress "(unpaid)" sfx */
|
||||
putstr(win, 0,
|
||||
xprname(marker, distant_name(marker, doname),
|
||||
CONTAINED_SYM, TRUE, cost, 0L));
|
||||
marker->unpaid = 1;
|
||||
iflags.suppress_price--;
|
||||
}
|
||||
}
|
||||
if (!otmp->cknown) {
|
||||
|
||||
14
src/objnam.c
14
src/objnam.c
@@ -827,17 +827,11 @@ ring:
|
||||
Strcat(bp, " (alternate weapon; not wielded)");
|
||||
}
|
||||
if(obj->owornmask & W_QUIVER) Strcat(bp, " (in quiver)");
|
||||
if(obj->unpaid) {
|
||||
xchar ox, oy;
|
||||
long quotedprice = unpaid_cost(obj);
|
||||
struct monst *shkp = (struct monst *)0;
|
||||
if (!iflags.suppress_price && count_unpaid(obj)) {
|
||||
long quotedprice = unpaid_cost(obj, TRUE);
|
||||
|
||||
if (Has_contents(obj) &&
|
||||
get_obj_location(obj, &ox, &oy, BURIED_TOO|CONTAINED_TOO) &&
|
||||
costly_spot(ox, oy) &&
|
||||
(shkp = shop_keeper(*in_rooms(ox, oy, SHOPBASE))))
|
||||
quotedprice += contained_cost(obj, shkp, 0L, FALSE, TRUE);
|
||||
Sprintf(eos(bp), " (unpaid, %ld %s)",
|
||||
Sprintf(eos(bp), " (%s, %ld %s)",
|
||||
obj->unpaid ? "unpaid" : "contents",
|
||||
quotedprice, currency(quotedprice));
|
||||
}
|
||||
if (!strncmp(prefix, "a ", 2) &&
|
||||
|
||||
47
src/shk.c
47
src/shk.c
@@ -1456,6 +1456,7 @@ boolean itemize;
|
||||
}
|
||||
obj->quan = quan; /* to be used by doname() */
|
||||
obj->unpaid = 0; /* ditto */
|
||||
iflags.suppress_price++; /* affects containers */
|
||||
ltmp = bp->price * quan;
|
||||
buy = PAY_BUY; /* flag; if changed then return early */
|
||||
|
||||
@@ -1489,6 +1490,7 @@ boolean itemize;
|
||||
/* restore unpaid object to original state */
|
||||
obj->quan = save_quan;
|
||||
obj->unpaid = 1;
|
||||
iflags.suppress_price--;
|
||||
return buy;
|
||||
}
|
||||
|
||||
@@ -1513,6 +1515,7 @@ boolean itemize;
|
||||
}
|
||||
} else if (itemize)
|
||||
update_inventory(); /* Done just once in dopay() if !itemize. */
|
||||
iflags.suppress_price--;
|
||||
return buy;
|
||||
}
|
||||
|
||||
@@ -2032,20 +2035,35 @@ long amt; /* if 0, use regular shop pricing, otherwise force amount;
|
||||
|
||||
/* called from doinv(invent.c) for inventory of unpaid objects */
|
||||
long
|
||||
unpaid_cost(unp_obj)
|
||||
register struct obj *unp_obj; /* known to be unpaid */
|
||||
unpaid_cost(unp_obj, include_contents)
|
||||
struct obj *unp_obj; /* known to be unpaid or contain unpaid */
|
||||
boolean include_contents;
|
||||
{
|
||||
register struct bill_x *bp = (struct bill_x *)0;
|
||||
register struct monst *shkp;
|
||||
struct bill_x *bp = (struct bill_x *)0;
|
||||
struct monst *shkp;
|
||||
long amt = 0L;
|
||||
xchar ox, oy;
|
||||
|
||||
for(shkp = next_shkp(fmon, TRUE); shkp;
|
||||
if (!get_obj_location(unp_obj, &ox, &oy, BURIED_TOO|CONTAINED_TOO))
|
||||
ox = u.ux, oy = u.uy; /* (shouldn't happen) */
|
||||
if ((shkp = shop_keeper(*in_rooms(ox, oy, SHOPBASE))) != 0) {
|
||||
bp = onbill(unp_obj, shkp, TRUE);
|
||||
} else {
|
||||
/* didn't find shk? try searching bills */
|
||||
for (shkp = next_shkp(fmon, TRUE); shkp;
|
||||
shkp = next_shkp(shkp->nmon, TRUE))
|
||||
if ((bp = onbill(unp_obj, shkp, TRUE)) != 0) break;
|
||||
if ((bp = onbill(unp_obj, shkp, TRUE)) != 0) break;
|
||||
}
|
||||
|
||||
/* onbill() gave no message if unexpected problem occurred */
|
||||
if(!bp) impossible("unpaid_cost: object wasn't on any bill!");
|
||||
|
||||
return bp ? unp_obj->quan * bp->price : 0L;
|
||||
if (!shkp || (unp_obj->unpaid && !bp)) {
|
||||
impossible("unpaid_cost: object wasn't on any bill.");
|
||||
} else {
|
||||
if (bp) amt = unp_obj->quan * bp->price;
|
||||
if (include_contents && Has_contents(unp_obj))
|
||||
amt = contained_cost(unp_obj, shkp, amt, FALSE, TRUE);
|
||||
}
|
||||
return amt;
|
||||
}
|
||||
|
||||
STATIC_OVL void
|
||||
@@ -2833,22 +2851,15 @@ int mode; /* 0: deliver count 1: paged */
|
||||
}
|
||||
if(bp->useup || bp->bquan > obj->quan) {
|
||||
long oquan, uquan, thisused;
|
||||
unsigned save_unpaid;
|
||||
|
||||
save_unpaid = obj->unpaid;
|
||||
oquan = obj->quan;
|
||||
uquan = (bp->useup ? bp->bquan : bp->bquan - oquan);
|
||||
thisused = bp->price * uquan;
|
||||
totused += thisused;
|
||||
obj->unpaid = 0; /* ditto */
|
||||
iflags.suppress_price++; /* suppress "(unpaid)" suffix */
|
||||
/* Why 'x'? To match `I x', more or less. */
|
||||
buf_p = xprname(obj, (char *)0, 'x', FALSE, thisused, uquan);
|
||||
#ifdef __SASC
|
||||
/* SAS/C 6.2 can't cope for some reason */
|
||||
sasc_bug(obj,save_unpaid);
|
||||
#else
|
||||
obj->unpaid = save_unpaid;
|
||||
#endif
|
||||
iflags.suppress_price--;
|
||||
putstr(datawin, 0, buf_p);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user