Simple counter become ints.
return GO_CLEAROBJ;
}
-static int bigwords(long id)
+static int bigwords(vocab_t id)
/* FEE FIE FOE FOO (AND FUM). Advance to next state if given in proper order.
* Look up foo in special section of vocab to determine which word we've got.
* Last word zips the eggs back to the giant room (unless already there). */
static int listen(void)
/* Listen. Intransitive only. Print stuff based on object sound proprties. */
{
- long sound = locations[game.loc].sound;
+ vocab_t sound = locations[game.loc].sound;
if (sound != SILENT) {
rspeak(sound);
if (!locations[game.loc].loud)
return GO_CLEAROBJ;
}
-static int throw_support(long spk)
+static int throw_support(vocab_t spk)
{
rspeak(spk);
drop(AXE, game.loc);
if (randrange(NDWARVES + 1) < game.dflag) {
return throw_support(DWARF_DODGES);
} else {
- long i = atdwrf(game.loc);
+ int i = atdwrf(game.loc);
game.dseen[i] = false;
game.dloc[i] = LOC_NOWHERE;
return throw_support((++game.dkill == 1) ?
typedef long verb_t; // index into an actions array */
typedef long obj_t; // index into the object array */
typedef long loc_t; // index into the locations array */
+typedef long turn_t; // turn counter or threshold */
struct game_t {
unsigned long lcg_a, lcg_c, lcg_m, lcg_x;
long saved; // point penalty for saves
long tally; // count of treasures gained
long thresh; // current threshold for endgame scoring tier
- long trndex; // FIXME: not used, remove on next format bump
- long trnluz; // # points lost so far due to turns used
- long turns; // counts commands given (ignores yes/no)
+ turn_t trndex; // FIXME: not used, remove on next format bump
+ turn_t trnluz; // # points lost so far due to turns used
+ turn_t turns; // counts commands given (ignores yes/no)
bool wzdark; // whether the loc he's leaving was dark
char zzword[TOKLEN + 1]; // randomly generated magic word from bird
bool blooded; // has player drunk of dragon's blood?
extern bool get_command_input(struct command_t *);
extern void wordclear(token_t *);
extern void speak(const char*, ...);
-extern void sspeak(long msg, ...);
+extern void sspeak(int msg, ...);
extern void pspeak(vocab_t, enum speaktype, int, bool, ...);
extern void rspeak(vocab_t, ...);
extern void echo_input(FILE*, const char*, const char*);
extern bool yes(const char*, const char*, const char*);
extern void juggle(obj_t);
extern void move(obj_t, loc_t);
-extern long put(obj_t, long, long);
+extern loc_t put(obj_t, long, long);
extern void carry(obj_t, loc_t);
extern void drop(obj_t, loc_t);
extern long atdwrf(loc_t);
{
int ch;
char *savefilename = NULL;
- long version = 0;
+ int version = 0;
FILE *fp = NULL;
// Initialize game variables
printf("cheat: game.numdie = %ld\n", game.numdie);
break;
case 'l':
- game.limit = (long)atoi(optarg);
+ game.limit = (turn_t)atoi(optarg);
printf("cheat: game.limit = %ld\n", game.limit);
break;
case 's':
printf("cheat: game.saved = %ld\n", game.saved);
break;
case 't':
- game.turns = (long)atoi(optarg);
+ game.turns = (turn_t)atoi(optarg);
printf("cheat: game.turns = %ld\n", game.turns);
break;
case 'v':
- version = (long)atoi(optarg);
- printf("cheat: version = %ld\n", version);
+ version = atoi(optarg);
+ printf("cheat: version = %d\n", version);
break;
case 'o':
savefilename = optarg;
/* Dwarves move. Return true if player survives, false if he dies. */
{
int kk, stick, attack;
- long tk[21];
+ loc_t tk[21];
/* Dwarf stuff. See earlier comments for description of
* variables. Remember sixth dwarf is pirate and is thus
}
}
-static bool traveleq(long a, long b)
+static bool traveleq(int a, int b)
/* Are two travel entries equal for purposes of skip after failed condition? */
{
return (travel[a].condtype == travel[b].condtype)
if (!DARK(game.loc)) {
++game.abbrev[game.loc];
for (int i = game.atloc[game.loc]; i != 0; i = game.link[i]) {
- long obj = i;
+ obj_t obj = i;
if (obj > NOBJECTS)
obj = obj - NOBJECTS;
if (obj == STEPS && TOTING(NUGGET))
va_end(ap);
}
-void sspeak(const long msg, ...)
+void sspeak(const int msg, ...)
{
va_list ap;
va_start(ap, msg);
return (WORD_NOT_FOUND);
}
-static void get_vocab_metadata(const char* word, long* id, enum wordtype* type)
+static void get_vocab_metadata(const char* word, vocab_t* id, enum wordtype* type)
{
/* Check for an empty string */
if (strncmp(word, "", sizeof("")) == 0) {
return;
}
- long ref_num;
+ vocab_t ref_num;
ref_num = get_motion_vocab_id(word);
if (ref_num != WORD_NOT_FOUND) {
* pick up objects which are not at any loc, since carry wants to
* remove objects from game.atloc chains. */
{
- long from;
+ loc_t from;
if (object > NOBJECTS)
from = game.fixed[object - NOBJECTS];
drop(object, where);
}
-long put(obj_t object, loc_t where, long pval)
+loc_t put(obj_t object, loc_t where, long pval)
/* put() is the same as move(), except it returns a value used to set up the
* negated game.prop values for the repository objects. */
{
* scoring and wrap-up
*/
-static long mxscor; /* ugh..the price for having score() not exit. */
+static int mxscor; /* ugh..the price for having score() not exit. */
long score(enum termination mode)
/* mode is 'scoregame' if scoring, 'quitgame' if quitting, 'endgame' if died
* or won */
{
- long score = 0;
+ int score = 0;
/* The present scoring algorithm is as follows:
* Objective: Points: Present total possible:
if (!objects[i].is_treasure)
continue;
if (objects[i].inventory != 0) {
- long k = 12;
+ int k = 12;
if (i == CHEST)
k = 14;
if (i > CHEST)
mxscor += 2;
/* Deduct for hints/turns/saves. Hints < 4 are special; see database desc. */
- for (long i = 0; i < NHINTS; i++) {
+ for (int i = 0; i < NHINTS; i++) {
if (game.hinted[i])
score = score - hints[i].penalty;
}