+#include <stdlib.h>
#include "misc.h"
#include "main.h"
#include "share.h"
#define TRUE (0==0)
#define FALSE (0!=0)
-extern carry(), discard(long), attack(), throw(), feed(), fill();
-
/* 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
* TAKE ONE WITHOUT THE OTHER). LIQUIDS ALSO SPECIAL, SINCE THEY DEPEND ON
* STATUS OF BOTTLE. ALSO VARIOUS SIDE EFFECTS, ETC. */
-carry() {
+int carry() {
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. */
-discard(just_do_it)long just_do_it; {
+int discard(just_do_it)long just_do_it; {
if(just_do_it) goto L9021;
if(TOTING(ROD2) && OBJ == ROD && !TOTING(ROD))OBJ=ROD2;
if(!TOTING(OBJ)) return(2011);
* OBJECTS FALL INTO TWO CATEGORIES: ENEMIES (SNAKE, DWARF, ETC.) AND OTHERS
* (BIRD, CLAM, MACHINE). AMBIGUOUS IF 2 ENEMIES, OR NO ENEMIES BUT 2 OTHERS. */
-attack() {
+int attack() {
I=ATDWRF(LOC);
if(OBJ != 0) goto L9124;
if(I > 0)OBJ=DWARF;
* AND IF DWARF IS PRESENT THEN ONE MIGHT BE KILLED. (ONLY WAY TO DO SO!)
* AXE ALSO SPECIAL FOR DRAGON, BEAR, AND TROLL. TREASURES SPECIAL FOR TROLL. */
-throw() {
+int throw() {
if(TOTING(ROD2) && OBJ == ROD && !TOTING(ROD))OBJ=ROD2;
if(!TOTING(OBJ)) return(2011);
if(OBJ >= 50 && OBJ <= MAXTRS && AT(TROLL)) goto L9178;
/* FEED. IF BIRD, NO SEED. SNAKE, DRAGON, TROLL: QUIP. IF DWARF, MAKE HIM
* MAD. BEAR, SPECIAL. */
-feed() {
+int feed() {
if(OBJ != BIRD) goto L9212;
SPK=100;
return(2011);
/* FILL. BOTTLE OR URN MUST BE EMPTY, AND LIQUID AVAILABLE. (VASE IS NASTY.) */
-fill() {
+int fill() {
if(OBJ == VASE) goto L9222;
if(OBJ == URN) goto L9224;
if(OBJ != 0 && OBJ != BOTTLE) return(2011);
#ifndef _TIME_
#include "sys/time.h"
-fDATIME(X,Y)long *X, *Y; {
+void fDATIME(X,Y)long *X, *Y; {
struct timeval now;
gettimeofday(&now, 0);
*X = now.tv_sec;
#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);
+void score(long);
+
#include <stdlib.h>
#include <stdio.h>
+#include "main.h"
#include "misc.h"
#ifdef __MSDOS__
#define TRUE (0==0)
#define FALSE (0!=0)
+
long ABB[186], ATAB[331], ATLOC[186], BLKLIN = TRUE, DFLAG,
DLOC[7], FIXED[101], HOLDNG,
KTAB[331], *LINES, LINK[201], LNLENG, LNPOSN,
PARMS[26], PLACE[101], PTEXT[101], RTEXT[278],
SETUP = 0, TABSIZ = 330;
-char INLINE[101], MAP1[129], MAP2[129];
+signed char INLINE[LINESIZE], MAP1[129], MAP2[129];
long ABBNUM, ACTSPK[36], AMBER, ATTACK, AXE, BACK, BATTER, BEAR, BIRD, BLOOD, BONUS,
BOTTLE, CAGE, CAVE, CAVITY, CHAIN, CHASM, CHEST, CHLOC, CHLOC2,
+#define LINESIZE 101
+
extern long ABB[], ATAB[], ATLOC[], BLKLIN, DFLAG, DLOC[], FIXED[], HOLDNG,
KTAB[], *LINES, LINK[], LNLENG, LNPOSN,
PARMS[], PLACE[], PTEXT[], RTEXT[], TABSIZ;
-extern signed char INLINE[], MAP1[], MAP2[];
+extern signed char INLINE[LINESIZE], MAP1[], MAP2[];
+#include <stdlib.h>
+#include <stdio.h>
#include "main.h"
#include "misc.h"
-#include <stdio.h>
+#include "funcs.h"
#define TRUE (0==0)
#define FALSE (0!=0)
+/* hack to ignore GCC Unused Result */
+#define IGNORE(r) do{if(r){}}while(0)
+
/* I/O ROUTINES (SPEAK, PSPEAK, RSPEAK, SETPRM, GETIN, YES) */
#undef SPEAK
* 28 INVALID MONTH RETURNED BY DATE FUNCTION
* 29 TOO MANY PARAMETERS GIVEN TO SETPRM */
- printf("Fatal error %d. See source code for interpretation.\n",
+ printf("Fatal error %ld. See source code for interpretation.\n",
NUM);
exit(FALSE);
}
if(MAP2[1] == 0)MPINIT();
if(FIL) goto L15;
- gets(INLINE+1);
+ IGNORE(fgets(INLINE+1, sizeof(INLINE)-1, stdin));
if(feof(stdin)) score(1);
goto L20;
OPENED=fopen("adventure.text","r" /* NOT binary */);
if(!OPENED){printf("Can't read adventure.text!\n"); exit(FALSE);}
}
- fgets(INLINE+1,100,OPENED);
+ IGNORE(fgets(INLINE+1,100,OPENED));
L20: LNLENG=0;
/* 25 */ for (I=1; I<=100 && INLINE[I]!=0; I++) {
return;
L20: printf("\nFile name: ");
- gets(NAME);
+ IGNORE(fgets(NAME, sizeof(NAME), stdin));
F=fopen(NAME,(IN ? READ_MODE : WRITE_MODE));
if(F == NULL) {printf("Can't open file, try again.\n"); goto L20;}
return;
-L30: if(IN)fread(ARR,4,250,F);
+L30: if(IN)IGNORE(fread(ARR,4,250,F));
if(!IN)fwrite(ARR,4,250,F);
return;
+#include <stdlib.h>
#include "misc.h"
#include "main.h"
#include "share.h"