]> granicus.if.org Git - nethack/commitdiff
patch: #defines
authorarromdee <arromdee>
Thu, 9 Feb 2006 03:26:59 +0000 (03:26 +0000)
committerarromdee <arromdee>
Thu, 9 Feb 2006 03:26:59 +0000 (03:26 +0000)
This is a fairly trivial code change but should have been done long ago...

doc/fixes35.0
include/hack.h
src/muse.c
src/potion.c
src/zap.c

index dacace43ff50ea962ef3910a9e7c8de346501d2d..009ff1edddadeeb69c0969aff3724c78b6dacf0b 100644 (file)
@@ -118,6 +118,7 @@ don't see objects or read engraving when hero changes location (random
 polymorphed spellbooks may turn blank or be too faint to read
 avoid inappropriate message when using a cursed lamp while blind
 player polymorphed as a guardian naga spit the wrong kind of venom
+put #define for potion occupant chance and cursed wand zap chance in one place
 
 
 Platform- and/or Interface-Specific Fixes
index 61be33621d9b7c099dd24d68af6ceecf17f436e9..d3e18222350defc1331c11dba0621e03b42425ac 100644 (file)
@@ -306,6 +306,10 @@ NEARDATA extern coord bhitpos;     /* place where throw or zap hits or stops */
 #define RANDOM_TIN  (-2)
 #define HEALTHY_TIN (-3)
 
+/* Some misc definitions */
+#define POTION_OCCUPANT_CHANCE(n) (13 + 2*(n))
+#define WAND_BACKFIRE_CHANCE 100
+
 /* Flags to control menus */
 #define MENUTYPELEN sizeof("traditional ")
 #define MENU_TRADITIONAL 0
index c07c028d09330666b7bf6c39691523681c22dafd..27e111addffaac413264a6e4671df07bae8681fd 100644 (file)
@@ -67,7 +67,6 @@ struct obj *obj;
            static const char *empty = "The potion turns out to be empty.";
            const char *potion_descr;
            struct monst *mtmp;
-#define POTION_OCCUPANT_CHANCE(n) (13 + 2*(n)) /* also in potion.c */
 
            potion_descr = OBJ_DESCR(objects[obj->otyp]);
            if (potion_descr && !strcmp(potion_descr, "milky")) {
@@ -121,7 +120,7 @@ struct obj *obj;
                return 2;
            }
        }
-       if (obj->oclass == WAND_CLASS && obj->cursed && !rn2(100)) {
+       if (obj->oclass == WAND_CLASS && obj->cursed && !rn2(WAND_BACKFIRE_CHANCE)) {
            int dam = d(obj->spe+2, 6);
 
            if (!Deaf) {
index ee5fbfe8b66d7c18ef2c8fecfcea3142399b5477..8fb596bec072a53b4e6a18b86de3cfd9a04460bf 100644 (file)
@@ -400,8 +400,6 @@ dodrink()
        if(!otmp) return(0);
        otmp->in_use = TRUE;            /* you've opened the stopper */
 
-#define POTION_OCCUPANT_CHANCE(n) (13 + 2*(n)) /* also in muse.c */
-
        potion_descr = OBJ_DESCR(objects[otmp->otyp]);
        if (potion_descr) {
            if (!strcmp(potion_descr, "milky") &&
index e1ad88622d6a1e6dfc491a19fbad7208c9ef3614..8e49eb24d062c168b10efafe016c9a04db4900da 100644 (file)
--- a/src/zap.c
+++ b/src/zap.c
@@ -1932,7 +1932,7 @@ dozap()
 
        /* zappable addition done by GAN 11/03/86 */
        if(!zappable(obj)) pline(nothing_happens);
-       else if(obj->cursed && !rn2(100)) {
+       else if(obj->cursed && !rn2(WAND_BACKFIRE_CHANCE)) {
                backfire(obj);  /* the wand blows up in your face! */
                exercise(A_STR, FALSE);
                return(1);