]> granicus.if.org Git - nethack/commitdiff
luck artifact dependencies
authornethack.rankin <nethack.rankin>
Wed, 9 Oct 2002 07:06:08 +0000 (07:06 +0000)
committernethack.rankin <nethack.rankin>
Wed, 9 Oct 2002 07:06:08 +0000 (07:06 +0000)
     Instead of adding a new artifact.h to pray.c, remove the existing
ones from attrib.c, invent.c, and mkobj.c.  This also updates the Unix
and VMS editions of Makefile.src; having stale dependencies in those
for other ports could cause unnecessary recompilation but can't break
anything in this case.

include/extern.h
src/artifact.c
src/attrib.c
src/invent.c
src/mkobj.c
src/pray.c
sys/unix/Makefile.src
sys/vms/Makefile.src

index 53b4ffbc335d9b88bec7d77b5dca85597b9b7dff..94191039d93039f985b22bc26ea2d0f71f789e2f 100644 (file)
@@ -62,6 +62,7 @@ E boolean FDECL(exist_artifact, (int,const char *));
 E void FDECL(artifact_exists, (struct obj *,const char *,BOOLEAN_P));
 E int NDECL(nartifact_exist);
 E boolean FDECL(spec_ability, (struct obj *,unsigned long));
+E boolean FDECL(confers_luck, (struct obj *));
 E boolean FDECL(restrict_name, (struct obj *,const char *));
 E boolean FDECL(defends, (int,struct obj *));
 E boolean FDECL(protects, (int,struct obj *));
index 5d69656e73670802cb113b8d5917f0030a4ebbbc..aa2378ff71c1fe7d0a41d11f8058bb0f513db170 100644 (file)
@@ -248,6 +248,17 @@ unsigned long abil;
        return((boolean)(arti && (arti->spfx & abil)));
 }
 
+/* used so that callers don't need to known about SPFX_ codes */
+boolean
+confers_luck(obj)
+struct obj *obj;
+{
+    /* might as well check for this too */
+    if (obj->otyp == LUCKSTONE) return TRUE;
+
+    return (obj->oartifact && spec_ability(obj, SPFX_LUCK));
+}
+
 #endif /* OVL0 */
 #ifdef OVLB
 
index 8e4ac530821ce04e1cf97c70854d0edfec0e2069..12945c57b267e24174da93f57dd4a0fa580bf79f 100644 (file)
@@ -1,11 +1,10 @@
-/*     SCCS Id: @(#)attrib.c   3.4     2002/07/17      */
+/*     SCCS Id: @(#)attrib.c   3.4     2002/10/07      */
 /*     Copyright 1988, 1989, 1990, 1992, M. Stephenson           */
 /* NetHack may be freely redistributed.  See license for details. */
 
 /*  attribute modification routines. */
 
 #include "hack.h"
-#include "artifact.h"
 
 /* #define DEBUG */    /* uncomment for debugging info */
 
@@ -211,9 +210,8 @@ boolean parameter; /* So I can't think up of a good name.  So sue me. --KAA */
        register struct obj *otmp;
        register long bonchance = 0;
 
-       for(otmp = invent; otmp; otmp=otmp->nobj)
-           if (otmp->otyp == LUCKSTONE
-               || (otmp->oartifact && spec_ability(otmp, SPFX_LUCK))) {
+       for (otmp = invent; otmp; otmp = otmp->nobj)
+           if (confers_luck(otmp)) {
                if (otmp->cursed) bonchance -= otmp->quan;
                else if (otmp->blessed) bonchance += otmp->quan;
                else if (parameter) bonchance += otmp->quan;
index b759667094ca3c12f4db2f0bae887db149b3a458..52aa17889ff04939097ef947c42d1a27426d6500 100644 (file)
@@ -1,9 +1,8 @@
-/*     SCCS Id: @(#)invent.c   3.4     2002/09/30      */
+/*     SCCS Id: @(#)invent.c   3.4     2002/10/07      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
 #include "hack.h"
-#include "artifact.h"
 
 #define NOINVSYM       '#'
 #define CONTAINED_SYM  '>'     /* designator for inside a container */
@@ -287,8 +286,7 @@ void
 addinv_core2(obj)
 struct obj *obj;
 {
-       if (obj->otyp == LUCKSTONE ||
-           (obj->oartifact && spec_ability(obj, SPFX_LUCK))) {
+       if (confers_luck(obj)) {
                /* new luckstone must be in inventory by this point
                 * for correct calculation */
                set_moreluck();
@@ -514,8 +512,7 @@ struct obj *obj;
 
        if (obj->otyp == LOADSTONE) {
                curse(obj);
-       } else if (obj->otyp == LUCKSTONE ||
-                   (obj->oartifact && spec_ability(obj, SPFX_LUCK))) {
+       } else if (confers_luck(obj)) {
                set_moreluck();
                flags.botl = 1;
        } else if (obj->otyp == FIGURINE && obj->timed) {
index cf4da5daf754e7ef5249c93052708536b3534110..2068104bbbcc8ada825dc897352d55ffdd1c5f1d 100644 (file)
@@ -1,9 +1,8 @@
-/*     SCCS Id: @(#)mkobj.c    3.4     2002/09/21      */
+/*     SCCS Id: @(#)mkobj.c    3.4     2002/10/07      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
 #include "hack.h"
-#include "artifact.h"
 #include "prop.h"
 
 STATIC_DCL void FDECL(mkbox_cnts,(struct obj *));
@@ -684,8 +683,7 @@ register struct obj *otmp;
 #endif
        otmp->cursed = 0;
        otmp->blessed = 1;
-       if (otmp->otyp == LUCKSTONE
-               || (otmp->oartifact && spec_ability(otmp, SPFX_LUCK)))
+       if (carried(otmp) && confers_luck(otmp))
            set_moreluck();
        else if (otmp->otyp == BAG_OF_HOLDING)
            otmp->owt = weight(otmp);
@@ -699,8 +697,7 @@ unbless(otmp)
 register struct obj *otmp;
 {
        otmp->blessed = 0;
-       if (otmp->otyp == LUCKSTONE
-               || (otmp->oartifact && spec_ability(otmp, SPFX_LUCK)))
+       if (carried(otmp) && confers_luck(otmp))
            set_moreluck();
        else if (otmp->otyp == BAG_OF_HOLDING)
            otmp->owt = weight(otmp);
@@ -718,8 +715,7 @@ register struct obj *otmp;
        /* welded two-handed weapon interferes with some armor removal */
        if (otmp == uwep && bimanual(uwep)) reset_remarm();
        /* some cursed items need immediate updating */
-       if (carried(otmp) && (otmp->otyp == LUCKSTONE ||
-               (otmp->oartifact && spec_ability(otmp, SPFX_LUCK))))
+       if (carried(otmp) && confers_luck(otmp))
            set_moreluck();
        else if (otmp->otyp == BAG_OF_HOLDING)
            otmp->owt = weight(otmp);
@@ -737,13 +733,12 @@ uncurse(otmp)
 register struct obj *otmp;
 {
        otmp->cursed = 0;
-       if (otmp->otyp == LUCKSTONE
-               || (otmp->oartifact && spec_ability(otmp, SPFX_LUCK)))
+       if (carried(otmp) && confers_luck(otmp))
            set_moreluck();
        else if (otmp->otyp == BAG_OF_HOLDING)
-               otmp->owt = weight(otmp);
+           otmp->owt = weight(otmp);
        else if (otmp->otyp == FIGURINE && otmp->timed)
-               (void) stop_timer(FIG_TRANSFORM, (genericptr_t) otmp);
+           (void) stop_timer(FIG_TRANSFORM, (genericptr_t) otmp);
        return;
 }
 
index 80de42d0b29af0fd40433bc746bd4fd66e92563f..01d1077a2b68ec3bfcdb3b43cac36fc2073b4b18 100644 (file)
@@ -4,7 +4,6 @@
 
 #include "hack.h"
 #include "epri.h"
-#include "artifact.h"
 
 STATIC_PTR int NDECL(prayer_done);
 STATIC_DCL struct obj *NDECL(worst_cursed_item);
@@ -242,8 +241,7 @@ worst_cursed_item()
     } else {
        for (otmp = invent; otmp; otmp = otmp->nobj) {
            if (!otmp->cursed) continue;
-           if (otmp->otyp == LOADSTONE || otmp->otyp == LUCKSTONE ||
-                   (otmp->oartifact && spec_ability(otmp, SPFX_LUCK)))
+           if (otmp->otyp == LOADSTONE || confers_luck(otmp))
                break;
        }
     }
index f471d46eaad18a0ac0092de85cb58171c4adbfe3..a5b10ce0004c9e9151ee1d075b9bac3baf6f69ac 100644 (file)
@@ -688,7 +688,7 @@ allmain.o: allmain.c $(HACK_H)
 alloc.o: alloc.c $(CONFIG_H)
 apply.o: apply.c $(HACK_H) ../include/edog.h
 artifact.o: artifact.c $(HACK_H) ../include/artifact.h ../include/artilist.h
-attrib.o: attrib.c $(HACK_H) ../include/artifact.h
+attrib.o: attrib.c $(HACK_H)
 ball.o: ball.c $(HACK_H)
 bones.o: bones.c $(HACK_H) ../include/lev.h
 botl.o: botl.c $(HACK_H)
@@ -718,7 +718,7 @@ files.o: files.c $(HACK_H) ../include/dlb.h
 fountain.o: fountain.c $(HACK_H)
 hack.o: hack.c $(HACK_H)
 hacklib.o: hacklib.c $(HACK_H)
-invent.o: invent.c $(HACK_H) ../include/artifact.h
+invent.o: invent.c $(HACK_H)
 light.o: light.c $(HACK_H) ../include/lev.h
 lock.o: lock.c $(HACK_H)
 mail.o: mail.c $(HACK_H) ../include/mail.h
@@ -732,7 +732,7 @@ minion.o: minion.c $(HACK_H) ../include/emin.h ../include/epri.h
 mklev.o: mklev.c $(HACK_H)
 mkmap.o: mkmap.c $(HACK_H) ../include/sp_lev.h
 mkmaze.o: mkmaze.c $(HACK_H) ../include/sp_lev.h ../include/lev.h
-mkobj.o: mkobj.c $(HACK_H) ../include/artifact.h
+mkobj.o: mkobj.c $(HACK_H)
 mkroom.o: mkroom.c $(HACK_H)
 mon.o: mon.c $(HACK_H) ../include/mfndpos.h ../include/edog.h
 mondata.o: mondata.c $(HACK_H) ../include/eshk.h ../include/epri.h
index 6fb987a3ddcf227f8132de391dc60d56b9dd015e..7c7c3abdc9ce7e3b3e660d9b56f70ee3c22a5a27 100644 (file)
@@ -351,7 +351,7 @@ allmain.obj :       allmain.c $(HACK_H)
 alloc.obj :    alloc.c $(CONFIG_H)
 apply.obj :    apply.c $(HACK_H) $(INC)edog.h
 artifact.obj : artifact.c $(HACK_H) $(INC)artifact.h $(INC)artilist.h
-attrib.obj :   attrib.c $(HACK_H) $(INC)artifact.h
+attrib.obj :   attrib.c $(HACK_H)
 ball.obj :     ball.c $(HACK_H)
 bones.obj :    bones.c $(HACK_H) $(INC)lev.h
 botl.obj :     botl.c $(HACK_H)
@@ -381,7 +381,7 @@ files.obj : files.c $(HACK_H) $(INC)dlb.h
 fountain.obj : fountain.c $(HACK_H)
 hack.obj :     hack.c $(HACK_H)
 hacklib.obj :  hacklib.c $(HACK_H)
-invent.obj :   invent.c $(HACK_H) $(INC)artifact.h
+invent.obj :   invent.c $(HACK_H)
 light.obj :    light.c $(HACK_H) $(INC)lev.h
 lock.obj :     lock.c $(HACK_H)
 mail.obj :     mail.c $(HACK_H) $(INC)mail.h
@@ -394,7 +394,7 @@ minion.obj :        minion.c $(HACK_H) $(INC)emin.h $(INC)epri.h
 mklev.obj :    mklev.c $(HACK_H)
 mkmap.obj :    mkmap.c $(HACK_H) $(INC)sp_lev.h
 mkmaze.obj :   mkmaze.c $(HACK_H) $(INC)sp_lev.h $(INC)lev.h
-mkobj.obj :    mkobj.c $(HACK_H) $(INC)artifact.h
+mkobj.obj :    mkobj.c $(HACK_H)
 mkroom.obj :   mkroom.c $(HACK_H)
 mon.obj :      mon.c $(HACK_H) $(INC)mfndpos.h $(INC)edog.h
 mondata.obj :  mondata.c $(HACK_H) $(INC)eshk.h $(INC)epri.h