delivers the cheapest item on the list */
| 1519 | |
| 1520 | /* delivers the cheapest item on the list */ |
| 1521 | staticfn long |
| 1522 | cheapest_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 |