SPK is no longer global.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 12 Jun 2017 02:04:14 +0000 (22:04 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 12 Jun 2017 02:04:14 +0000 (22:04 -0400)
TODO
actions.c
main.c

diff --git a/TODO b/TODO
index 37857feb7015fb6501f11ad3eb43fb59b26389d1..c4102f2bb274abe0f5ef523cd9284eac17c8a815 100644 (file)
--- a/TODO
+++ b/TODO
@@ -3,9 +3,9 @@
 The FORTRANish mess that once was is now mostly idiomatic C. Some issues
 remain to be cleaned up:
 
 The FORTRANish mess that once was is now mostly idiomatic C. Some issues
 remain to be cleaned up:
 
-* The remaining shared globals: K, SPK, WD1, WD1X, WD2, WD2X. These are used
+* The remaining shared globals: K, WD1, WD1X, WD2, WD2X. These are used
   rather promiscuously to pass around information that ought to be function
   rather promiscuously to pass around information that ought to be function
-  arguments in a modern language. K and SPK are particular offenders
+  arguments in a modern language. K is a particular offender
 
 * Remaining unstructured gotos in playermove() and do_command(). The goto L12
   in playermove() is particularly horrible, jumping backwards into the
 
 * Remaining unstructured gotos in playermove() and do_command(). The goto L12
   in playermove() is particularly horrible, jumping backwards into the
index 01a373bad99e36ad0b35fa1745fd2afaf97c575c..de5f83004f828ee86d0d422819c06b536e3ca2d3 100644 (file)
--- a/actions.c
+++ b/actions.c
@@ -4,7 +4,9 @@
 #include "database.h"
 
 /* Limit visibility of ugly globals.  Eventually these should go away. */
 #include "database.h"
 
 /* Limit visibility of ugly globals.  Eventually these should go away. */
-extern long K, SPK, WD1, WD1X, WD2, WD2X;
+extern long K, WD1, WD1X, WD2, WD2X;
+
+static long SPK;       /* This should go away too */
 
 /*
  * Action handlers.  Eventually we'll do lookup through a method table
 
 /*
  * Action handlers.  Eventually we'll do lookup through a method table
diff --git a/main.c b/main.c
index 06d43679760594dc3cf15aa289c35b6ed43a3e97..e10239833a1f72c6156294ef3d5faf21364d09fd 100644 (file)
--- a/main.c
+++ b/main.c
@@ -39,7 +39,7 @@ long AMBER, AXE, BACK, BATTER, BEAR, BIRD, BLOOD,
                RUBY, RUG, SAPPH, SAY, SIGN, SNAKE,
                STEPS, STREAM, THROW, TRIDNT, TROLL, TROLL2,
                URN, VASE, VEND, VOLCAN, WATER;
                RUBY, RUG, SAPPH, SAY, SIGN, SNAKE,
                STEPS, STREAM, THROW, TRIDNT, TROLL, TROLL2,
                URN, VASE, VEND, VOLCAN, WATER;
-long K, SPK, WD1, WD1X, WD2, WD2X;
+long K, WD1, WD1X, WD2, WD2X;
 
 FILE  *logfp;
 bool oldstyle = false;
 
 FILE  *logfp;
 bool oldstyle = false;
@@ -567,15 +567,15 @@ static bool playermove(FILE *cmdin, token_t verb)
        if (TRAVEL[KK] < 0) {
            /*  Non-applicable motion.  Various messages depending on
             *  word given. */
        if (TRAVEL[KK] < 0) {
            /*  Non-applicable motion.  Various messages depending on
             *  word given. */
-           SPK=12;
-           if (K >= 43 && K <= 50)SPK=52;
-           if (K == 29 || K == 30)SPK=52;
-           if (K == 7 || K == 36 || K == 37)SPK=10;
-           if (K == 11 || K == 19)SPK=11;
-           if (verb == FIND || verb == INVENT)SPK=59;
-           if (K == 62 || K == 65)SPK=42;
-           if (K == 17)SPK=80;
-           RSPEAK(SPK);
+           int spk=12;
+           if (K >= 43 && K <= 50)spk=52;
+           if (K == 29 || K == 30)spk=52;
+           if (K == 7 || K == 36 || K == 37)spk=10;
+           if (K == 11 || K == 19)spk=11;
+           if (verb == FIND || verb == INVENT)spk=59;
+           if (K == 62 || K == 65)spk=42;
+           if (K == 17)spk=80;
+           RSPEAK(spk);
            return true;
        }
        ++KK;
            return true;
        }
        ++KK;
@@ -961,10 +961,10 @@ L2607:    game.foobar=(game.foobar>0 ? -game.foobar : 0);
        } else if (game.limit <= 30) {
            if (!game.lmwarn && HERE(LAMP)) {
                game.lmwarn=true;
        } else if (game.limit <= 30) {
            if (!game.lmwarn && HERE(LAMP)) {
                game.lmwarn=true;
-               SPK=187;
-               if (game.place[BATTER] == 0)SPK=183;
-               if (game.prop[BATTER] == 1)SPK=189;
-               RSPEAK(SPK);
+               int spk=187;
+               if (game.place[BATTER] == 0)spk=183;
+               if (game.prop[BATTER] == 1)spk=189;
+               RSPEAK(spk);
            }
        }
 L19999: K=43;
            }
        }
 L19999: K=43;