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
- 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
#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
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;
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;
} 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;