]> granicus.if.org Git - nethack/commitdiff
oracle tidbit
authornethack.rankin <nethack.rankin>
Fri, 11 May 2012 22:36:33 +0000 (22:36 +0000)
committernethack.rankin <nethack.rankin>
Fri, 11 May 2012 22:36:33 +0000 (22:36 +0000)
     From the newsgroup, while rehashing our bug page entries someone
mentioned that buying a minor consultation from the oracle exercizes
wisdom twice.  First when getrumor() chooses one, then again when
outrumor(BY_ORACLE) delivers it.

     This also simplifies some #if GOLDOBJ conditional code.

doc/fixes35.0
src/rumors.c

index 4cfeab1f029e6fa173ab630ac105f7d5b88502c6..1d52652e612d18869d46a7fbb03468f7584a8e29 100644 (file)
@@ -361,6 +361,7 @@ properly handle destruction of equipment carried by monsters hit by
        disintegration breath; life-saving retained conferred properties of
        formerly worn items (loss of steed's saddle caused much confusion)
 don't exercize or abuse wisdom when rumors get used for random graffiti
+don't exercize wisdom twice for each minor oracle consultation
 don't welcome the hero to Delphi if the Oracle was angered before first entry
 create_object() created lizard corpses without timers and troll corpses with
        their revive timers, then changed the corpsenm field
index 62ff2c8b3c6a6762d36211bcf4d747d123cb393d..5993a8ead1c12773d201289d7c6b3d22f2d85e05 100644 (file)
@@ -300,7 +300,7 @@ int mechanism;
                  (!rn2(4) ? "offhandedly " : (!rn2(3) ? "casually " :
                  (rn2(2) ? "nonchalantly " : ""))));
                verbalize1(line);
-               exercise(A_WIS, TRUE);
+               /* [WIS exercized by getrumor()] */
                return;
            case BY_COOKIE:
                pline(fortune_msg);
@@ -422,14 +422,17 @@ int
 doconsult(oracl)
 register struct monst *oracl;
 {
-#ifdef GOLDOBJ
-        long umoney = money_cnt(invent);
-#endif
+       long umoney;
        int u_pay, minor_cost = 50, major_cost = 500 + 50 * u.ulevel;
        int add_xpts;
        char qbuf[QBUFSZ];
 
        multi = 0;
+#ifndef GOLDOBJ
+       umoney = u.ugold;
+#else
+       umoney = money_cnt(invent);
+#endif
 
        if (!oracl) {
                There("is no one here to consult.");
@@ -437,11 +440,7 @@ register struct monst *oracl;
        } else if (!oracl->mpeaceful) {
                pline("%s is in no mood for consultations.", Monnam(oracl));
                return 0;
-#ifndef GOLDOBJ
-       } else if (!u.ugold) {
-#else
        } else if (!umoney) {
-#endif
                You("have no money.");
                return 0;
        }
@@ -454,41 +453,27 @@ register struct monst *oracl;
            case 'q':
                return 0;
            case 'y':
-#ifndef GOLDOBJ
-               if (u.ugold < (long)minor_cost) {
-#else
                if (umoney < (long)minor_cost) {
-#endif
                    You("don't even have enough money for that!");
                    return 0;
                }
                u_pay = minor_cost;
                break;
            case 'n':
-#ifndef GOLDOBJ
-               if (u.ugold <= (long)minor_cost ||      /* don't even ask */
-#else
                if (umoney <= (long)minor_cost ||       /* don't even ask */
-#endif
                    (oracle_cnt == 1 || oracle_flg < 0)) return 0;
                Sprintf(qbuf,
                        "\"Then dost thou desire a major one?\" (%d %s)",
                        major_cost, currency((long)major_cost));
                if (yn(qbuf) != 'y') return 0;
-#ifndef GOLDOBJ
-               u_pay = (u.ugold < (long)major_cost ? (int)u.ugold
-                                                   : major_cost);
-#else
-               u_pay = (umoney < (long)major_cost ? (int)umoney
-                                                   : major_cost);
-#endif
+               u_pay = (umoney < (long)major_cost) ? (int)umoney : major_cost;
                break;
        }
 #ifndef GOLDOBJ
        u.ugold -= (long)u_pay;
        oracl->mgold += (long)u_pay;
 #else
-        money2mon(oracl, (long)u_pay);
+       money2mon(oracl, (long)u_pay);
 #endif
        context.botl = 1;
        add_xpts = 0;   /* first oracle of each type gives experience points */