]> granicus.if.org Git - nethack/commitdiff
attribute check timer (trunk only)
authornethack.allison <nethack.allison>
Tue, 25 May 2004 02:16:22 +0000 (02:16 +0000)
committernethack.allison <nethack.allison>
Tue, 25 May 2004 02:16:22 +0000 (02:16 +0000)
Move the counter for the next attribute check to the context
structure.

This increments patchlevel so previous save and bones
files are unuseable after applying.

include/context.h
include/extern.h
include/patchlevel.h
src/allmain.c
src/attrib.c
src/restore.c

index 7bd39978f4cd34e08e5823adfbece5069c33e37d..dc16cfe13f34363019d08b1cd4057db195ddf1ac 100644 (file)
@@ -75,6 +75,7 @@ struct context_info {
        unsigned startingpet_mid;
        int      warnlevel;
        int      djinni_count, ghost_count;     /* potion effect tuning */
+       long next_attrib_check; /* next attribute check */
        long stethoscope_move;
        short stethoscope_movement;
        boolean  travel;        /* find way automatically to u.tx,u.ty */
index 2639e73a360f9a9e1087efc08d24068ee99b3b43..2b4904c280c43a135000f3b229bf3881bb1cf95b 100644 (file)
@@ -95,7 +95,6 @@ E void NDECL(set_moreluck);
 E void NDECL(restore_attrib);
 E void FDECL(exercise, (int,BOOLEAN_P));
 E void NDECL(exerchk);
-E void NDECL(reset_attribute_clock);
 E void FDECL(init_attr, (int));
 E void NDECL(redist_attr);
 E void FDECL(adjabil, (int,int));
index 93222eda355ebe8f4484e489ebdfe7a8bbef93d8..02d94a12678ae5692fb7a6d881d9bd4d5a4d14f7 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)patchlevel.h       3.4     2004/01/10      */
+/*     SCCS Id: @(#)patchlevel.h       3.4     2004/05/24      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -13,7 +13,7 @@
  * Incrementing EDITLEVEL can be used to force invalidation of old bones
  * and save files.
  */
-#define EDITLEVEL      9
+#define EDITLEVEL      10
 
 #define COPYRIGHT_BANNER_A \
 "NetHack, Copyright 1985-2004"
index c0183612b5f62290efbee0320b184d56677ef5a8..80591b5573849a7c0b7eeb36b01f618ca67bad9c 100644 (file)
@@ -489,6 +489,7 @@ newgame()
        context.ident = 1;
        context.stethoscope_move = -1L;
        context.warnlevel = 1;
+       context.next_attrib_check = 600L; /* arbitrary first setting */
 
        for (i = 0; i < NUMMONS; i++)
                mvitals[i].mvflags = mons[i].geno & G_NOCORPSE;
index e868edaf95559d98726f665f031a4aa1701dfa7a..a2019840bac25837785e07861c80f46da8a58fd3 100644 (file)
@@ -95,7 +95,6 @@ const struct innate {
        orc_abil[] = { {        1, &(HPoison_resistance), "", "" },
                     {   0, 0, 0, 0 } };
 
-static long next_check = 600L; /* arbitrary first setting */
 STATIC_DCL void NDECL(exerper);
 STATIC_DCL void FDECL(postadjabil, (long *));
 
@@ -449,11 +448,11 @@ exerchk()
        exerper();
 
 #ifdef DEBUG
-       if(moves >= next_check)
+       if(moves >= context.next_attrib_check)
                pline("exerchk: ready to test. multi = %d.", multi);
 #endif
        /*      Are we ready for a test?        */
-       if(moves >= next_check && !multi) {
+       if(moves >= context.next_attrib_check && !multi) {
 #ifdef DEBUG
            pline("exerchk: testing.");
 #endif
@@ -515,21 +514,13 @@ exerchk()
                    }
                }
            }
-           next_check += rn1(200,800);
+           context.next_attrib_check += rn1(200,800);
 #ifdef DEBUG
-           pline("exerchk: next check at %ld.", next_check);
+           pline("exerchk: next check at %ld.", context.next_attrib_check);
 #endif
        }
 }
 
-/* next_check will otherwise have its initial 600L after a game restore */
-void
-reset_attribute_clock()
-{
-       if (moves > 600L) next_check = moves + rn1(50,800);
-}
-
-
 void
 init_attr(np)
        register int    np;
index bebd01f7d9b67682b7a4d1c069668af8f4b20bd7..76fcbd3b2f5cd37b07ec6096f50e6673ccae462d 100644 (file)
@@ -678,7 +678,6 @@ register int fd;
        inven_inuse(FALSE);
 
        load_qtlist();  /* re-load the quest text info */
-       reset_attribute_clock();
        /* Set up the vision internals, after levl[] data is loaded */
        /* but before docrt().                                      */
        vision_reset();