X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=misc.c;h=b3d88742df487f9f4a389f19fa94b679b4ab7316;hb=ff36dff18f30cab559a34b4b08214c3ab87491dd;hp=6887f684453d8cd7dd18b115bc7790acab71c197;hpb=19b3ac4ccd3cc5fc7e40fea53463e1bd9502ab96;p=open-adventure.git diff --git a/misc.c b/misc.c index 6887f68..b3d8874 100644 --- a/misc.c +++ b/misc.c @@ -146,14 +146,16 @@ void PSPEAK(vocab_t msg,int skip) m=PTEXT[msg]; if (skip >= 0) { - for (i=0; i<=skip; i++) { -L1: m=labs(LINES[m]); - if (LINES[m] >= 0) - goto L1; + for (i=0; i <=skip; i++) { + do { + m=labs(LINES[m]); + } while + (LINES[m] >= 0); } } SPEAK(m); } + void RSPEAK(vocab_t i) /* Print the i-th "random" message (section 6 of database). */ { @@ -173,11 +175,9 @@ void SETPRM(long first, long p1, long p2) } } -#define WORD1 (*wORD1) -#define WORD1X (*wORD1X) -#define WORD2 (*wORD2) -#define WORD2X (*wORD2X) -bool fGETIN(FILE *input, long *wORD1, long *wORD1X, long *wORD2, long *wORD2X) +bool fGETIN(FILE *input, + long *pword1, long *pword1x, + long *pword2, long *pword2x) /* Get a command from the adventurer. Snarf out the first word, pad it with * blanks, and return it in WORD1. Chars 6 thru 10 are returned in WORD1X, in * case we need to print out the whole word in an error message. Any number of @@ -192,16 +192,16 @@ bool fGETIN(FILE *input, long *wORD1, long *wORD1X, long *wORD2, long *wORD2X) MAPLIN(input); if (feof(input)) return false; - WORD1=GETTXT(true,true,true); - if (game.blklin && WORD1 < 0) + *pword1=GETTXT(true,true,true); + if (game.blklin && *pword1 < 0) continue; - WORD1X=GETTXT(false,true,true); + *pword1x=GETTXT(false,true,true); do { junk=GETTXT(false,true,true); } while (junk > 0); - WORD2=GETTXT(true,true,true); - WORD2X=GETTXT(false,true,true); + *pword2=GETTXT(true,true,true); + *pword2x=GETTXT(false,true,true); do { junk=GETTXT(false,true,true); } while @@ -332,9 +332,10 @@ void fPUTTXT(token_t word, long *state, long casemake) if (w <= 0 && *state == 0 && labs(casemake) <= 1) return; byte=w/div; + w=(w-byte*div)*64; if (!(*state != 0 || byte != 63)) { *state=63; - goto L18; + continue; } SHFTXT(LNPOSN,1); *state=*state+byte; @@ -342,7 +343,6 @@ void fPUTTXT(token_t word, long *state, long casemake) INLINE[LNPOSN]=*state; LNPOSN=LNPOSN+1; *state=0; -L18: w=(w-byte*div)*64; } } #define PUTTXT(WORD,STATE,CASE) fPUTTXT(WORD,&STATE,CASE) @@ -521,12 +521,9 @@ void MOVE(long object, long where) long from; if (object > NOBJECTS) - goto L1; - from=game.place[object]; - goto L2; -L1: - from=game.fixed[object-NOBJECTS]; -L2: + from=game.fixed[object-NOBJECTS]; + else + from=game.place[object]; if (from > 0 && from <= 300) CARRY(object,from); DROP(object,where); @@ -570,16 +567,17 @@ void DROP(long object, long where) * game.holdng if the object was being toted. */ { if (object > NOBJECTS) - goto L1; - if (game.place[object] == -1) - game.holdng=game.holdng-1; - game.place[object]=where; - goto L2; -L1: game.fixed[object-NOBJECTS]=where; -L2: if (where <= 0) + game.fixed[object-NOBJECTS] = where; + else + { + if (game.place[object] == -1) + --game.holdng; + game.place[object] = where; + } + if (where <= 0) return; - game.link[object]=game.atloc[where]; - game.atloc[where]=object; + game.link[object] = game.atloc[where]; + game.atloc[where] = object; } long ATDWRF(long where)