X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=misc.c;h=5c71c744d7067f4806e5664e2878324c8ce82ff0;hb=07c0020a7aaa0ab34ee0e4f6e3a9ae0e1fe06c25;hp=0126d692d2a02f9c80691356a30075c6e96d7cf4;hpb=fd10d380df6804dca3b19ea68dc32df2de6090bd;p=open-adventure.git diff --git a/misc.c b/misc.c index 0126d69..5c71c74 100644 --- a/misc.c +++ b/misc.c @@ -12,7 +12,7 @@ /* I/O routines (SPEAK, PSPEAK, RSPEAK, SETPRM, GETIN, YES) */ -void SPEAK(long N) { +void SPEAK(vocab_t N) { long BLANK, CASE, I, K, L, NEG, NPARMS, PARM, PRMTYP, STATE; /* Print the message which starts at LINES(N). Precede it with a blank line @@ -111,7 +111,7 @@ L40: if(BLANK)TYPE0(); return; } -void PSPEAK(long MSG,long SKIP) { +void PSPEAK(vocab_t MSG,int SKIP) { long I, M; /* Find the skip+1st message from msg and print it. MSG should be the index of @@ -129,7 +129,7 @@ L9: SPEAK(M); return; } -void RSPEAK(long I) { +void RSPEAK(vocab_t I) { /* Print the I-TH "random" message (section 6 of database). */ @@ -194,8 +194,8 @@ L22: JUNK=GETTXT(false,true,true); #undef WORD2X #define GETIN(SRC,WORD1,WORD1X,WORD2,WORD2X) fGETIN(SRC,&WORD1,&WORD1X,&WORD2,&WORD2X) -long YES(FILE *input, long X, long Y, long Z) { -long YEAH, REPLY, JUNK1, JUNK2, JUNK3; +long YES(FILE *input, vocab_t X, vocab_t Y, vocab_t Z) { +token_t YEAH, REPLY, JUNK1, JUNK2, JUNK3; /* Print message X, wait for yes/no answer. If yes, print Y and return true; * if no, print Z and return false. */ @@ -223,7 +223,7 @@ L20: YEAH=false; * machine dependent i/o stuff is on the following page. See that page * for a description of MAPCOM's inline array. */ -long GETTXT(long SKIP,long ONEWRD, long UPPER) { +long GETTXT(bool SKIP,bool ONEWRD, bool UPPER) { /* Take characters from an input line and pack them into 30-bit words. * Skip says to skip leading blanks. ONEWRD says stop if we come to a * blank. UPPER says to map all letters to uppercase. If we reach the @@ -272,7 +272,7 @@ long GETTXT(long SKIP,long ONEWRD, long UPPER) { return(TEXT); } -long MAKEWD(long LETTRS) { +token_t MAKEWD(long LETTRS) { long I, L, WORD; /* Combine five uppercase letters (represented by pairs of decimal digits @@ -282,15 +282,13 @@ long I, L, WORD; * kludgey workaround, you can increment a letter by 5 by adding 50 to * the next pair of digits. */ - WORD=0; I=1; - L=LETTRS; -L10: WORD=WORD+I*(MOD(L,50)+10); - I=I*64; - if(MOD(L,100) > 50)WORD=WORD+I*5; - L=L/100; - if(L != 0) goto L10; + for (L=LETTRS; L != 0; L=L/100) { + WORD=WORD+I*(MOD(L,50)+10); + I=I*64; + if(MOD(L,100) > 50)WORD=WORD+I*5; + } I=64L*64L*64L*64L*64L/I; WORD=WORD*I; return(WORD); @@ -298,7 +296,7 @@ L10: WORD=WORD+I*(MOD(L,50)+10); #define STATE (*sTATE) -void fPUTTXT(long WORD, long *sTATE, long CASE) { +void fPUTTXT(token_t WORD, long *sTATE, long CASE) { long ALPH1, ALPH2, BYTE, DIV, I, W; /* Unpack the 30-bit value in word to obtain up to 5 integer-encoded chars, @@ -593,9 +591,9 @@ long AT, I; AT=0; if(DFLAG < 2)return(AT); AT= -1; - for (I=1; I<=5; I++) { - if(DLOC[I] == WHERE) goto L2; - if(DLOC[I] != 0)AT=0; + for (I=1; I<=NDWARVES-1; I++) { + if(game.dloc[I] == WHERE) goto L2; + if(game.dloc[I] != 0)AT=0; } /* end loop */ return(AT);