#include <stdlib.h>
+#include <stdbool.h>
#include "misc.h"
#include "main.h"
#include "share.h"
#include "funcs.h"
-#define TRUE (0==0)
-#define FALSE (0!=0)
-
/* This stuff was broken off as part of an effort to get the main program
* to compile without running out of memory. We're called with a number
* that says what label the caller wanted to "goto", and we return a
/* ANALYSE A VERB. REMEMBER WHAT IT WAS, GO BACK FOR OBJECT IF SECOND WORD
* UNLESS VERB IS "SAY", WHICH SNARFS ARBITRARY SECOND WORD. */
-int action(STARTAT)long STARTAT; {
+int action(long STARTAT) {
switch(STARTAT) {
case 4000: goto L4000;
case 4090: goto L4090;
/* TRANSITIVE CARRY/DROP ARE IN SEPARATE FILE. */
L9010: return(carry());
-L9020: return(discard(FALSE));
+L9020: return(discard(false));
/* SAY. ECHO WD2 (OR WD1 IF NO WD2 (SAY WHAT?, ETC.).) MAGIC WORDS OVERRIDE. */
if(!CLOSNG) goto L9043;
K=130;
if(!PANIC)CLOCK2=15;
- PANIC=TRUE;
+ PANIC=true;
return(2010);
L9043: K=34+PROP[GRATE];
/* 8201 */ for (I=1; I<=100; I++) {
if(I == BEAR || !TOTING(I)) goto L8201;
if(SPK == 98)RSPEAK(99);
- BLKLIN=FALSE;
+ BLKLIN=false;
PSPEAK(I,-1);
- BLKLIN=TRUE;
+ BLKLIN=true;
SPK=0;
L8201: /*etc*/ ;
} /* end loop */
ZZWORD=RNDVOC(3,ZZWORD-MESH*2)+MESH*2;
if(KK > 0) return(8);
RSPEAK(266);
- exit(FALSE);
+ exit(0);
/* RESUME. READ A SUSPENDED GAME BACK FROM A FILE. */
return(2000);
L8318: RSPEAK(270);
- exit(FALSE);
+ exit(0);
/* FLY. SNIDE REMARKS UNLESS HOVERING RUG IS HERE. */
#include "share.h"
#include "funcs.h"
-#define TRUE (0==0)
-#define FALSE (0!=0)
-
/* CARRY AN OBJECT. SPECIAL CASES FOR BIRD AND CAGE (IF BIRD IN CAGE, CAN'T
* TAKE ONE WITHOUT THE OTHER). LIQUIDS ALSO SPECIAL, SINCE THEY DEPEND ON
* STATUS OF BOTTLE. ALSO VARIOUS SIDE EFFECTS, ETC. */
-int carry() {
+int carry(void) {
if(TOTING(OBJ)) return(2011);
SPK=25;
if(OBJ == PLANT && PROP[PLANT] <= 0)SPK=115;
* BIRD (MIGHT ATTACK SNAKE OR DRAGON) AND CAGE (MIGHT CONTAIN BIRD) AND VASE.
* DROP COINS AT VENDING MACHINE FOR EXTRA BATTERIES. */
-int discard(just_do_it)long just_do_it; {
+int discard(bool just_do_it) {
if(just_do_it) goto L9021;
if(TOTING(ROD2) && OBJ == ROD && !TOTING(ROD))OBJ=ROD2;
if(!TOTING(OBJ)) return(2011);
if(DLOC[I] != LOC) goto L9129;
K=K+1;
DLOC[I]=61;
- DSEEN[I]=FALSE;
+ DSEEN[I]=false;
L9129: /*etc*/ ;
} /* end loop */
SPK=SPK+1+1/K;
if(!TOTING(OBJ)) return(2011);
if(OBJ >= 50 && OBJ <= MAXTRS && AT(TROLL)) goto L9178;
if(OBJ == FOOD && HERE(BEAR)) goto L9177;
- if(OBJ != AXE) return(discard(FALSE));
+ if(OBJ != AXE) return(discard(false));
I=ATDWRF(LOC);
if(I > 0) goto L9172;
SPK=152;
L9172: SPK=48;
if(RAN(7) < DFLAG) goto L9175;
- DSEEN[I]=FALSE;
+ DSEEN[I]=false;
DLOC[I]=0;
SPK=47;
DKILL=DKILL+1;
RSPEAK(145);
PROP[VASE]=2;
FIXED[VASE]= -1;
- return(discard(TRUE));
+ return(discard(true));
L9224: SPK=213;
if(PROP[URN] != 0) return(2011);
#define _TIME_
#include "time.h"
-fDATIME(X,Y)long *X, *Y; {
+fDATIME(long *X,long *Y) {
time(X); time(Y);
*Y /= 2;
/* it would be even better if the two numbers were totally
#ifndef _TIME_
#include "sys/time.h"
-void fDATIME(X,Y)long *X, *Y; {
+void fDATIME(long *X, long *Y) {
struct timeval now;
gettimeofday(&now, 0);
*X = now.tv_sec;
+#include <stdbool.h>
+
/* STATEMENT FUNCTIONS
*
* AT(OBJ) = TRUE IF ON EITHER SIDE OF TWO-PLACED OBJECT
#define OUTSID(LOC) ((LOC) <= 8 || FOREST(LOC) || (LOC) == PLAC[SAPPH] || (LOC) == 180 || (LOC) == 182)
#define INDEEP(LOC) ((LOC) >= 15 && !OUTSID(LOC) && (LOC) != 179)
-extern int carry(void), discard(long), attack(void), throw(void), feed(void), fill(void);
+extern int carry(void), discard(bool), attack(void), throw(void), feed(void), fill(void);
void score(long);
static int finish_init(void);
static void quick_io(void);
-void initialise() {
+void initialise(void) {
printf("Initialising...\n");
if(!quick_init()){raw_init(); report(); quick_save();}
finish_init();
* MAIN PROGRAM
*/
-int main() {
+int main(int argc, char *argv[]) {
/* ADVENTURE (REV 2: 20 TREASURES) */
* SCORING AND WRAP-UP
*/
-void score(MODE)long MODE; {
+void score(long MODE) {
/* <0 if scoring, >0 if quitting, =0 if died or won */
/* THE PRESENT SCORING ALGORITHM IS AS FOLLOWS: