MCPcopy Create free account
hub / github.com/NetHack/NetHack / cheapest_item

Function cheapest_item

src/shk.c:1521–1539  ·  view source on GitHub ↗

delivers the cheapest item on the list */

Source from the content-addressed store, hash-verified

1519
1520/* delivers the cheapest item on the list */
1521staticfn long
1522cheapest_item(int ibillct, Bill *ibill)
1523{
1524 int i;
1525 long gmin = ibill[0].cost;
1526
1527 /*
1528 * 5.0: old version didn't determine cheapest item correctly if it
1529 * was either the partly used or partly intact portion of a partially
1530 * used stack. Rather than modify it to use bp_to_obj() in order to
1531 * obtain quanities for every entry on eshkp->bill_p[], switch to
1532 * ibill[] which has already split such items into separate entries.
1533 */
1534
1535 for (i = 1; i < ibillct; ++i)
1536 if (ibill[i].cost < gmin)
1537 gmin = ibill[i].cost;
1538 return gmin;
1539}
1540
1541
1542/* for itemized purchasing, create an alternate shop bill that hides

Callers 1

pay_billed_itemsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected