| 1700 | } |
| 1701 | |
| 1702 | staticfn void |
| 1703 | light_cocktail(struct obj **optr) |
| 1704 | { |
| 1705 | struct obj *obj = *optr; /* obj is a potion of oil */ |
| 1706 | char buf[BUFSZ]; |
| 1707 | boolean split1off; |
| 1708 | |
| 1709 | if (u.uswallow) { |
| 1710 | You(no_elbow_room); |
| 1711 | return; |
| 1712 | } |
| 1713 | |
| 1714 | if (obj->lamplit) { |
| 1715 | You("snuff the lit potion."); |
| 1716 | end_burn(obj, TRUE); |
| 1717 | /* |
| 1718 | * Free & add to re-merge potion. This will average the |
| 1719 | * age of the potions. Not exactly the best solution, |
| 1720 | * but its easy. Don't do that unless obj is not worn (uwep, |
| 1721 | * uswapwep, or uquiver) because if wielded and other oil is |
| 1722 | * quivered a "null obj after quiver merge" panic will occur. |
| 1723 | */ |
| 1724 | if (!obj->owornmask) { |
| 1725 | freeinv(obj); |
| 1726 | *optr = addinv(obj); |
| 1727 | } |
| 1728 | return; |
| 1729 | } else if (Underwater) { |
| 1730 | There("is not enough oxygen to sustain a fire."); |
| 1731 | return; |
| 1732 | } |
| 1733 | |
| 1734 | split1off = (obj->quan > 1L); |
| 1735 | if (split1off) |
| 1736 | obj = splitobj(obj, 1L); |
| 1737 | |
| 1738 | You("light %spotion.%s", shk_your(buf, obj), |
| 1739 | Blind ? "" : " It gives off a dim light."); |
| 1740 | |
| 1741 | if (obj->unpaid && costly_spot(u.ux, u.uy)) { |
| 1742 | struct monst *shkp VOICEONLY = shop_keeper(*in_rooms(u.ux, u.uy, |
| 1743 | SHOPBASE)); |
| 1744 | |
| 1745 | /* Normally, we shouldn't both partially and fully charge |
| 1746 | * for an item, but (Yendorian Fuel) Taxes are inevitable... |
| 1747 | */ |
| 1748 | check_unpaid(obj); |
| 1749 | SetVoice(shkp, 0, 80, 0); |
| 1750 | verbalize("That's in addition to the cost of the potion, of course."); |
| 1751 | bill_dummy_object(obj); |
| 1752 | } |
| 1753 | makeknown(obj->otyp); |
| 1754 | |
| 1755 | begin_burn(obj, FALSE); /* after shop billing */ |
| 1756 | if (split1off) { |
| 1757 | obj_extract_self(obj); /* free from inv */ |
| 1758 | obj->nomerge = 1; |
| 1759 | obj = hold_another_object(obj, "You drop %s!", doname(obj), |
no test coverage detected