Use prototypes and bools.
This commit is contained in:
parent
c9e9b64575
commit
b38c11abef
7 changed files with 22 additions and 25 deletions
18
actions1.c
18
actions1.c
|
@ -1,12 +1,10 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "share.h"
|
#include "share.h"
|
||||||
#include "funcs.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
|
/* 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
|
* 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
|
* that says what label the caller wanted to "goto", and we return a
|
||||||
|
@ -16,7 +14,7 @@
|
||||||
/* ANALYSE A VERB. REMEMBER WHAT IT WAS, GO BACK FOR OBJECT IF SECOND WORD
|
/* ANALYSE A VERB. REMEMBER WHAT IT WAS, GO BACK FOR OBJECT IF SECOND WORD
|
||||||
* UNLESS VERB IS "SAY", WHICH SNARFS ARBITRARY SECOND WORD. */
|
* UNLESS VERB IS "SAY", WHICH SNARFS ARBITRARY SECOND WORD. */
|
||||||
|
|
||||||
int action(STARTAT)long STARTAT; {
|
int action(long STARTAT) {
|
||||||
switch(STARTAT) {
|
switch(STARTAT) {
|
||||||
case 4000: goto L4000;
|
case 4000: goto L4000;
|
||||||
case 4090: goto L4090;
|
case 4090: goto L4090;
|
||||||
|
@ -125,7 +123,7 @@ L8010: if(ATLOC[LOC] == 0 || LINK[ATLOC[LOC]] != 0 || ATDWRF(LOC) > 0) return(80
|
||||||
/* TRANSITIVE CARRY/DROP ARE IN SEPARATE FILE. */
|
/* TRANSITIVE CARRY/DROP ARE IN SEPARATE FILE. */
|
||||||
|
|
||||||
L9010: return(carry());
|
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. */
|
/* SAY. ECHO WD2 (OR WD1 IF NO WD2 (SAY WHAT?, ETC.).) MAGIC WORDS OVERRIDE. */
|
||||||
|
|
||||||
|
@ -165,7 +163,7 @@ L9040: if(OBJ == CLAM || OBJ == OYSTER) goto L9046;
|
||||||
if(!CLOSNG) goto L9043;
|
if(!CLOSNG) goto L9043;
|
||||||
K=130;
|
K=130;
|
||||||
if(!PANIC)CLOCK2=15;
|
if(!PANIC)CLOCK2=15;
|
||||||
PANIC=TRUE;
|
PANIC=true;
|
||||||
return(2010);
|
return(2010);
|
||||||
|
|
||||||
L9043: K=34+PROP[GRATE];
|
L9043: K=34+PROP[GRATE];
|
||||||
|
@ -372,9 +370,9 @@ L8200: SPK=98;
|
||||||
/* 8201 */ for (I=1; I<=100; I++) {
|
/* 8201 */ for (I=1; I<=100; I++) {
|
||||||
if(I == BEAR || !TOTING(I)) goto L8201;
|
if(I == BEAR || !TOTING(I)) goto L8201;
|
||||||
if(SPK == 98)RSPEAK(99);
|
if(SPK == 98)RSPEAK(99);
|
||||||
BLKLIN=FALSE;
|
BLKLIN=false;
|
||||||
PSPEAK(I,-1);
|
PSPEAK(I,-1);
|
||||||
BLKLIN=TRUE;
|
BLKLIN=true;
|
||||||
SPK=0;
|
SPK=0;
|
||||||
L8201: /*etc*/ ;
|
L8201: /*etc*/ ;
|
||||||
} /* end loop */
|
} /* end loop */
|
||||||
|
@ -520,7 +518,7 @@ L8305: DATIME(I,K);
|
||||||
ZZWORD=RNDVOC(3,ZZWORD-MESH*2)+MESH*2;
|
ZZWORD=RNDVOC(3,ZZWORD-MESH*2)+MESH*2;
|
||||||
if(KK > 0) return(8);
|
if(KK > 0) return(8);
|
||||||
RSPEAK(266);
|
RSPEAK(266);
|
||||||
exit(FALSE);
|
exit(0);
|
||||||
|
|
||||||
/* RESUME. READ A SUSPENDED GAME BACK FROM A FILE. */
|
/* RESUME. READ A SUSPENDED GAME BACK FROM A FILE. */
|
||||||
|
|
||||||
|
@ -536,7 +534,7 @@ L8312: SETPRM(1,K/10,MOD(K,10));
|
||||||
return(2000);
|
return(2000);
|
||||||
|
|
||||||
L8318: RSPEAK(270);
|
L8318: RSPEAK(270);
|
||||||
exit(FALSE);
|
exit(0);
|
||||||
|
|
||||||
/* FLY. SNIDE REMARKS UNLESS HOVERING RUG IS HERE. */
|
/* FLY. SNIDE REMARKS UNLESS HOVERING RUG IS HERE. */
|
||||||
|
|
||||||
|
|
15
actions2.c
15
actions2.c
|
@ -3,14 +3,11 @@
|
||||||
#include "share.h"
|
#include "share.h"
|
||||||
#include "funcs.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
|
/* 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
|
* TAKE ONE WITHOUT THE OTHER). LIQUIDS ALSO SPECIAL, SINCE THEY DEPEND ON
|
||||||
* STATUS OF BOTTLE. ALSO VARIOUS SIDE EFFECTS, ETC. */
|
* STATUS OF BOTTLE. ALSO VARIOUS SIDE EFFECTS, ETC. */
|
||||||
|
|
||||||
int carry() {
|
int carry(void) {
|
||||||
if(TOTING(OBJ)) return(2011);
|
if(TOTING(OBJ)) return(2011);
|
||||||
SPK=25;
|
SPK=25;
|
||||||
if(OBJ == PLANT && PROP[PLANT] <= 0)SPK=115;
|
if(OBJ == PLANT && PROP[PLANT] <= 0)SPK=115;
|
||||||
|
@ -60,7 +57,7 @@ L9015: SPK=238;
|
||||||
* BIRD (MIGHT ATTACK SNAKE OR DRAGON) AND CAGE (MIGHT CONTAIN BIRD) AND VASE.
|
* BIRD (MIGHT ATTACK SNAKE OR DRAGON) AND CAGE (MIGHT CONTAIN BIRD) AND VASE.
|
||||||
* DROP COINS AT VENDING MACHINE FOR EXTRA BATTERIES. */
|
* 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(just_do_it) goto L9021;
|
||||||
if(TOTING(ROD2) && OBJ == ROD && !TOTING(ROD))OBJ=ROD2;
|
if(TOTING(ROD2) && OBJ == ROD && !TOTING(ROD))OBJ=ROD2;
|
||||||
if(!TOTING(OBJ)) return(2011);
|
if(!TOTING(OBJ)) return(2011);
|
||||||
|
@ -206,7 +203,7 @@ L9128: RSPEAK(SPK);
|
||||||
if(DLOC[I] != LOC) goto L9129;
|
if(DLOC[I] != LOC) goto L9129;
|
||||||
K=K+1;
|
K=K+1;
|
||||||
DLOC[I]=61;
|
DLOC[I]=61;
|
||||||
DSEEN[I]=FALSE;
|
DSEEN[I]=false;
|
||||||
L9129: /*etc*/ ;
|
L9129: /*etc*/ ;
|
||||||
} /* end loop */
|
} /* end loop */
|
||||||
SPK=SPK+1+1/K;
|
SPK=SPK+1+1/K;
|
||||||
|
@ -222,7 +219,7 @@ int throw() {
|
||||||
if(!TOTING(OBJ)) return(2011);
|
if(!TOTING(OBJ)) return(2011);
|
||||||
if(OBJ >= 50 && OBJ <= MAXTRS && AT(TROLL)) goto L9178;
|
if(OBJ >= 50 && OBJ <= MAXTRS && AT(TROLL)) goto L9178;
|
||||||
if(OBJ == FOOD && HERE(BEAR)) goto L9177;
|
if(OBJ == FOOD && HERE(BEAR)) goto L9177;
|
||||||
if(OBJ != AXE) return(discard(FALSE));
|
if(OBJ != AXE) return(discard(false));
|
||||||
I=ATDWRF(LOC);
|
I=ATDWRF(LOC);
|
||||||
if(I > 0) goto L9172;
|
if(I > 0) goto L9172;
|
||||||
SPK=152;
|
SPK=152;
|
||||||
|
@ -237,7 +234,7 @@ int throw() {
|
||||||
|
|
||||||
L9172: SPK=48;
|
L9172: SPK=48;
|
||||||
if(RAN(7) < DFLAG) goto L9175;
|
if(RAN(7) < DFLAG) goto L9175;
|
||||||
DSEEN[I]=FALSE;
|
DSEEN[I]=false;
|
||||||
DLOC[I]=0;
|
DLOC[I]=0;
|
||||||
SPK=47;
|
SPK=47;
|
||||||
DKILL=DKILL+1;
|
DKILL=DKILL+1;
|
||||||
|
@ -337,7 +334,7 @@ L9222: SPK=29;
|
||||||
RSPEAK(145);
|
RSPEAK(145);
|
||||||
PROP[VASE]=2;
|
PROP[VASE]=2;
|
||||||
FIXED[VASE]= -1;
|
FIXED[VASE]= -1;
|
||||||
return(discard(TRUE));
|
return(discard(true));
|
||||||
|
|
||||||
L9224: SPK=213;
|
L9224: SPK=213;
|
||||||
if(PROP[URN] != 0) return(2011);
|
if(PROP[URN] != 0) return(2011);
|
||||||
|
|
4
datime.c
4
datime.c
|
@ -30,7 +30,7 @@ static int GOTX = 0, GOTY;
|
||||||
#define _TIME_
|
#define _TIME_
|
||||||
#include "time.h"
|
#include "time.h"
|
||||||
|
|
||||||
fDATIME(X,Y)long *X, *Y; {
|
fDATIME(long *X,long *Y) {
|
||||||
time(X); time(Y);
|
time(X); time(Y);
|
||||||
*Y /= 2;
|
*Y /= 2;
|
||||||
/* it would be even better if the two numbers were totally
|
/* it would be even better if the two numbers were totally
|
||||||
|
@ -41,7 +41,7 @@ fDATIME(X,Y)long *X, *Y; {
|
||||||
#ifndef _TIME_
|
#ifndef _TIME_
|
||||||
#include "sys/time.h"
|
#include "sys/time.h"
|
||||||
|
|
||||||
void fDATIME(X,Y)long *X, *Y; {
|
void fDATIME(long *X, long *Y) {
|
||||||
struct timeval now;
|
struct timeval now;
|
||||||
gettimeofday(&now, 0);
|
gettimeofday(&now, 0);
|
||||||
*X = now.tv_sec;
|
*X = now.tv_sec;
|
||||||
|
|
4
funcs.h
4
funcs.h
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
/* STATEMENT FUNCTIONS
|
/* STATEMENT FUNCTIONS
|
||||||
*
|
*
|
||||||
* AT(OBJ) = TRUE IF ON EITHER SIDE OF TWO-PLACED OBJECT
|
* AT(OBJ) = TRUE IF ON EITHER SIDE OF TWO-PLACED OBJECT
|
||||||
|
@ -35,7 +37,7 @@
|
||||||
#define OUTSID(LOC) ((LOC) <= 8 || FOREST(LOC) || (LOC) == PLAC[SAPPH] || (LOC) == 180 || (LOC) == 182)
|
#define OUTSID(LOC) ((LOC) <= 8 || FOREST(LOC) || (LOC) == PLAC[SAPPH] || (LOC) == 180 || (LOC) == 182)
|
||||||
#define INDEEP(LOC) ((LOC) >= 15 && !OUTSID(LOC) && (LOC) != 179)
|
#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);
|
void score(long);
|
||||||
|
|
||||||
|
|
||||||
|
|
2
init.c
2
init.c
|
@ -172,7 +172,7 @@ static void quick_save(void);
|
||||||
static int finish_init(void);
|
static int finish_init(void);
|
||||||
static void quick_io(void);
|
static void quick_io(void);
|
||||||
|
|
||||||
void initialise() {
|
void initialise(void) {
|
||||||
printf("Initialising...\n");
|
printf("Initialising...\n");
|
||||||
if(!quick_init()){raw_init(); report(); quick_save();}
|
if(!quick_init()){raw_init(); report(); quick_save();}
|
||||||
finish_init();
|
finish_init();
|
||||||
|
|
2
main.c
2
main.c
|
@ -48,7 +48,7 @@ extern int action(long);
|
||||||
* MAIN PROGRAM
|
* MAIN PROGRAM
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int main() {
|
int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
/* ADVENTURE (REV 2: 20 TREASURES) */
|
/* ADVENTURE (REV 2: 20 TREASURES) */
|
||||||
|
|
||||||
|
|
2
score.c
2
score.c
|
@ -10,7 +10,7 @@
|
||||||
* SCORING AND WRAP-UP
|
* SCORING AND WRAP-UP
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void score(MODE)long MODE; {
|
void score(long MODE) {
|
||||||
/* <0 if scoring, >0 if quitting, =0 if died or won */
|
/* <0 if scoring, >0 if quitting, =0 if died or won */
|
||||||
|
|
||||||
/* THE PRESENT SCORING ALGORITHM IS AS FOLLOWS:
|
/* THE PRESENT SCORING ALGORITHM IS AS FOLLOWS:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue