]> granicus.if.org Git - nethack/commitdiff
selling candelabrum in lighting store
authornethack.allison <nethack.allison>
Wed, 10 May 2006 03:31:53 +0000 (03:31 +0000)
committernethack.allison <nethack.allison>
Wed, 10 May 2006 03:31:53 +0000 (03:31 +0000)
<email deleted> wrote:
> * You can't sell a candelabrum (with candles attached) to a lighting store.

You still can't sell the candelabrum after this, but acknowledge
the situation by having Izchak say something unique.

src/shk.c

index cff645b8390cf9bc2ad307cc8ba729aa8bc441e3..2354299a785a1c43bf072a450c93f5d70f9fdcb4 100644 (file)
--- a/src/shk.c
+++ b/src/shk.c
@@ -65,6 +65,7 @@ STATIC_DCL void FDECL(add_to_billobjs, (struct obj *));
 STATIC_DCL void FDECL(bill_box_content, (struct obj *, BOOLEAN_P, BOOLEAN_P,
                                     struct monst *));
 STATIC_DCL boolean FDECL(rob_shop, (struct monst *));
+STATIC_DCL boolean FDECL(special_stock, (struct obj *, struct monst *, BOOLEAN_P));
 
 /*
        invariants: obj->unpaid iff onbill(obj) [unless bp->useup]
@@ -1971,6 +1972,27 @@ register struct obj *obj;
        }
 }
 
+STATIC_OVL boolean
+special_stock(obj, shkp, quietly)
+struct obj *obj;
+struct monst *shkp;
+boolean quietly;
+{
+       /* for unique situations */
+       if ((strcmp(shkname(shkp), "Izchak") == 0) &&
+            obj->otyp == CANDELABRUM_OF_INVOCATION) {
+               if (!quietly) {
+                   if (!u.uevent.invoked)
+                       verbalize(
+                           "No thanks, I'd hang onto that if I were you.");
+                   else
+                       verbalize("Take that out of here!");
+               }
+               return TRUE;
+       }
+       return FALSE;
+}
+
 /* calculate how much the shk will pay when buying [all of] an object */
 STATIC_OVL long
 set_cost(obj, shkp)
@@ -2558,7 +2580,8 @@ xchar x, y;
                            subfrombill(obj, shkp);
                } else obj->no_charge = 1;
 
-               if(!unpaid && (sell_how != SELL_DONTSELL))
+               if(!unpaid && (sell_how != SELL_DONTSELL) &&
+                  !special_stock(obj, shkp, FALSE))
                    pline("%s seems uninterested.", Monnam(shkp));
                return;
        }