From: Eric S. Raymond Date: Wed, 7 Jun 2017 13:39:04 +0000 (-0400) Subject: Narrow the scope of VERB. X-Git-Tag: 1.1~567 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=57104237ed0964f4824f8aeac7630a76ebdd9c3f;p=open-adventure.git Narrow the scope of VERB. --- diff --git a/actions1.c b/actions1.c index 781b996..34ae784 100644 --- a/actions1.c +++ b/actions1.c @@ -12,7 +12,7 @@ /* Analyse a verb. Remember what it was, go back for object if second word * unless verb is "say", which snarfs arbitrary second word. - * Takes K, OBJ, and VERB as inputs. + * FIXME: Takes K and VERB as additional inputs. */ int action(FILE *input, long STARTAT, long obj) { @@ -310,7 +310,7 @@ L9094: DROP(JADE,game.loc); /* Attack also moved into separate module. */ -L9120: return(attack(input, obj)); +L9120: return(attack(input, obj, VERB)); /* Pour. If no object, or object is bottle, assume contents of bottle. * special tests for pouring water or oil on plant or rusty door. */ @@ -390,7 +390,7 @@ L9160: if(obj != LAMP)SPK=76; /* Throw moved into separate module. */ -L9170: return(throw(input, obj)); +L9170: return(throw(input, obj, VERB)); /* Quit. Intransitive only. Verify intent and exit if that's what he wants. */ diff --git a/actions2.c b/actions2.c index 6161b47..f3a021a 100644 --- a/actions2.c +++ b/actions2.c @@ -129,7 +129,7 @@ L9028: game.prop[VASE]=2; * objects fall into two categories: enemies (snake, dwarf, etc.) and others * (bird, clam, machine). Ambiguous if 2 enemies, or no enemies but 2 others. */ -int attack(FILE *input, long obj) { +int attack(FILE *input, long obj, long verb) { I=ATDWRF(game.loc); if(obj != 0) goto L9124; if(I > 0)obj=DWARF; @@ -141,8 +141,8 @@ int attack(FILE *input, long obj) { if(obj > NOBJECTS) return(8000); if(obj != 0) goto L9124; /* CAN'T ATTACK BIRD OR MACHINE BY THROWING AXE. */ - if(HERE(BIRD) && VERB != THROW)obj=BIRD; - if(HERE(VEND) && VERB != THROW)obj=obj*NOBJECTS+VEND; + if(HERE(BIRD) && verb != THROW)obj=BIRD; + if(HERE(VEND) && verb != THROW)obj=obj*NOBJECTS+VEND; /* CLAM AND OYSTER BOTH TREATED AS CLAM FOR INTRANSITIVE CASE; NO HARM DONE. */ if(HERE(CLAM) || HERE(OYSTER))obj=NOBJECTS*obj+CLAM; if(obj > NOBJECTS) return(8000); @@ -173,8 +173,6 @@ L9126: if(obj == 0)SPK=44; * move dragon to central loc (still fixed), move rug there (not fixed), and * move him there, too. Then do a null motion to get new description. */ RSPEAK(49); - VERB=0; - obj=0; GETIN(input,WD1,WD1X,WD2,WD2X); if(WD1 != MAKEWD(25) && WD1 != MAKEWD(250519)) return(2607); PSPEAK(DRAGON,3); @@ -213,7 +211,7 @@ L9128: RSPEAK(SPK); * 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. */ -int throw(FILE *cmdin, long obj) { +int throw(FILE *cmdin, long obj, long verb) { if(TOTING(ROD2) && obj == ROD && !TOTING(ROD))obj=ROD2; if(!TOTING(obj)) return(2011); if(obj >= 50 && obj <= MAXTRS && AT(TROLL)) goto L9178; @@ -229,7 +227,7 @@ int throw(FILE *cmdin, long obj) { if(AT(OGRE)) goto L9175; if(HERE(BEAR) && game.prop[BEAR] == 0) goto L9176; obj=0; - return(attack(cmdin, obj)); + return(attack(cmdin, obj, verb)); L9172: SPK=48; if(randrange(NDWARVES+1) < game.dflag) goto L9175; diff --git a/funcs.h b/funcs.h index c7b580d..e21fbd4 100644 --- a/funcs.h +++ b/funcs.h @@ -38,7 +38,12 @@ #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(long), discard(long, bool), attack(FILE *, long), throw(FILE *, long obj), feed(long), fill(long); +extern int carry(long); +extern int discard(long, bool); +extern int attack(FILE *, long, long); +extern int throw(FILE *, long, long); +extern int feed(long); +extern int fill(long); void score(long);