Move MAXDIE computation to dungeonmaker.
authorEric S. Raymond <esr@thyrsus.com>
Wed, 7 Jun 2017 19:33:22 +0000 (15:33 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 7 Jun 2017 19:33:22 +0000 (15:33 -0400)
advent.h
adventure.text
dungeon.c
init.c
main.c

index 328847db83da71112db0b14363919ea3f0c652db..36cf3456a712d8b399d3ecbb44634829f5fa6f8f 100644 (file)
--- a/advent.h
+++ b/advent.h
@@ -145,5 +145,5 @@ extern long AMBER, ATTACK, AXE, BACK, BATTER, BEAR,
    STEPS, STICK, STREAM, THROW, TRIDNT, TROLL, TROLL2,
    URN, VASE, VEND, VOLCAN, WATER;
 /* evrything else */
    STEPS, STICK, STREAM, THROW, TRIDNT, TROLL, TROLL2,
    URN, VASE, VEND, VOLCAN, WATER;
 /* evrything else */
-extern long I, J, K, L, MAXDIE, SPK, V1, V2, VRSION, WD1, WD1X, WD2, WD2X;
+extern long I, J, K, L, SPK, V1, V2, VRSION, WD1, WD1X, WD2, WD2X;
 
 
index 936a1b00b860cec14e2dccc4d8e0fe9d8421adab..10fd20d38aa5b29dead1c1d0f3ce63b5bfc25c6e 100644 (file)
 78     You can't pour that.
 79     Watch it!
 80     Which way?
 78     You can't pour that.
 79     Watch it!
 80     Which way?
+# Sequence of the death & reincarnation messages must not be altered
 81     Oh dear, you seem to have gotten yourself killed.  I might be able to
 81     help you out, but I've never really done this before.  Do you want me
 81     to try to reincarnate you?
 81     Oh dear, you seem to have gotten yourself killed.  I might be able to
 81     help you out, but I've never really done this before.  Do you want me
 81     to try to reincarnate you?
 85     me to do a decent reincarnation without any orange smoke, do you?
 86     Okay, if you're so smart, do it yourself!  I'm leaving!
 90     >>> messages 81 thru 90 are reserved for "obituaries". <<<
 85     me to do a decent reincarnation without any orange smoke, do you?
 86     Okay, if you're so smart, do it yourself!  I'm leaving!
 90     >>> messages 81 thru 90 are reserved for "obituaries". <<<
+# Death & reincarnation messages end here
 91     Sorry, but I no longer seem to remember how it was you got here.
 92     You can't carry anything more.  You'll have to drop something first.
 93     You can't go through a locked steel grate!
 91     Sorry, but I no longer seem to remember how it was you got here.
 92     You can't carry anything more.  You'll have to drop something first.
 93     You can't go through a locked steel grate!
index 62c077272e6b6b06725b13b5a44dd7a2ac8521d5..73f14764ca588aa1be2dc7cdc67914efa9085115 100644 (file)
--- a/dungeon.c
+++ b/dungeon.c
@@ -33,6 +33,7 @@ static long LNLENG;
 static long LNPOSN;
 static char INLINE[LINESIZE+1];
 static long OLDLOC;
 static long LNPOSN;
 static char INLINE[LINESIZE+1];
 static long OLDLOC;
+static long MAXDIE;
 
 // Storage for what comes out of the database
 long LINUSE;
 
 // Storage for what comes out of the database
 long LINUSE;
@@ -556,6 +557,13 @@ void write_hints(FILE* c_file, FILE* header_file, long matrix[][HINTLEN], long d
 
 void write_files(FILE* c_file, FILE* header_file)
 {
 
 void write_files(FILE* c_file, FILE* header_file)
 {
+  int i, MAXDIE;
+  for (i=0; i<=4; i++) {
+      long x = 2*i+81;
+      if(RTEXT[x] != 0)
+         MAXDIE=i+1;
+  }
+
   // preprocessor defines for the header
   fprintf(header_file, "#include \"sizes.h\"\n");
   fprintf(header_file, "#define RTXSIZ 277\n");
   // preprocessor defines for the header
   fprintf(header_file, "#include \"sizes.h\"\n");
   fprintf(header_file, "#define RTXSIZ 277\n");
@@ -568,6 +576,7 @@ void write_files(FILE* c_file, FILE* header_file)
   fprintf(header_file, "#define TRVSIZ 885\n");
   fprintf(header_file, "#define TOKLEN %d\n", TOKLEN);
   fprintf(header_file, "#define HINTLEN %d\n", HINTLEN);
   fprintf(header_file, "#define TRVSIZ 885\n");
   fprintf(header_file, "#define TOKLEN %d\n", TOKLEN);
   fprintf(header_file, "#define HINTLEN %d\n", HINTLEN);
+  fprintf(header_file, "#define MAXDIE %d\n", MAXDIE);
   fprintf(header_file, "\n");
 
   // include the header in the C file
   fprintf(header_file, "\n");
 
   // include the header in the C file
diff --git a/init.c b/init.c
index 5d44be5c8fe37cd7d8fcb21cc8f4a72ed4942caf..a0d8f1cc6cc9a00d832d543b032245157e2b7e37 100644 (file)
--- a/init.c
+++ b/init.c
@@ -369,11 +369,6 @@ void initialise(void)
     game.knfloc=0;
     game.detail=0;
     game.abbnum=5;
     game.knfloc=0;
     game.detail=0;
     game.abbnum=5;
-    for (i=0; i<=4; i++) {
-       long x = 2*i+81;
-       if(RTEXT[x] != 0)
-           MAXDIE=i+1;
-    }
     game.numdie=0;
     game.holdng=0;
     game.dkill=0;
     game.numdie=0;
     game.holdng=0;
     game.dkill=0;
diff --git a/main.c b/main.c
index 3f6db0da358451f54330b923ca1d61f19d2042fa..28f171200a04c73e0ec8da1aca3d02606e094d9c 100644 (file)
--- a/main.c
+++ b/main.c
@@ -22,7 +22,7 @@ long AMBER, ATTACK, AXE, BACK, BATTER, BEAR, BIRD, BLOOD,
                CLAM, COINS, DOOR, DPRSSN, DRAGON, DWARF, EGGS,
                EMRALD, ENTER, ENTRNC, FIND, FISSUR, FOOD,
                GRATE, HINT, I, INVENT, J, JADE, K, KEYS,
                CLAM, COINS, DOOR, DPRSSN, DRAGON, DWARF, EGGS,
                EMRALD, ENTER, ENTRNC, FIND, FISSUR, FOOD,
                GRATE, HINT, I, INVENT, J, JADE, K, KEYS,
-               KNIFE, L, LAMP, LOCK, LOOK, MAGZIN, MAXDIE,
+               KNIFE, L, LAMP, LOCK, LOOK, MAGZIN,
                MESSAG, MIRROR, NUGGET, NUL, OGRE, OIL, OYSTER,
                PEARL, PILLOW, PLANT, PLANT2, PYRAM, RESER, ROD, ROD2,
                RUBY, RUG, SAPPH, SAY, SECT, SIGN, SNAKE, SPK,
                MESSAG, MIRROR, NUGGET, NUL, OGRE, OIL, OYSTER,
                PEARL, PILLOW, PLANT, PLANT2, PYRAM, RESER, ROD, ROD2,
                RUBY, RUG, SAPPH, SAY, SECT, SIGN, SNAKE, SPK,