Localize OBJ in throw().

This commit is contained in:
Eric S. Raymond 2017-06-07 08:32:06 -04:00
parent a5cef5208f
commit f20b7f56fd
3 changed files with 12 additions and 12 deletions

View file

@ -388,7 +388,7 @@ L9160: if(OBJ != LAMP)SPK=76;
/* Throw moved into separate module. */ /* Throw moved into separate module. */
L9170: return(throw(input)); L9170: return(throw(input, OBJ));
/* Quit. Intransitive only. Verify intent and exit if that's what he wants. */ /* Quit. Intransitive only. Verify intent and exit if that's what he wants. */

View file

@ -213,12 +213,12 @@ L9128: RSPEAK(SPK);
* and if dwarf is present then one might be killed. (Only way to do so!) * 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. */ * Axe also special for dragon, bear, and troll. Treasures special for troll. */
int throw(FILE *cmdin) { int throw(FILE *cmdin, long obj) {
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);
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(game.loc); I=ATDWRF(game.loc);
if(I > 0) goto L9172; if(I > 0) goto L9172;
SPK=152; SPK=152;
@ -228,8 +228,8 @@ int throw(FILE *cmdin) {
SPK=203; SPK=203;
if(AT(OGRE)) goto L9175; if(AT(OGRE)) goto L9175;
if(HERE(BEAR) && game.prop[BEAR] == 0) goto L9176; if(HERE(BEAR) && game.prop[BEAR] == 0) goto L9176;
OBJ=0; obj=0;
return(attack(cmdin, OBJ)); return(attack(cmdin, obj));
L9172: SPK=48; L9172: SPK=48;
if(randrange(NDWARVES+1) < game.dflag) goto L9175; if(randrange(NDWARVES+1) < game.dflag) goto L9175;
@ -252,12 +252,12 @@ L9176: SPK=164;
return(2011); return(2011);
/* But throwing food is another story. */ /* But throwing food is another story. */
L9177: OBJ=BEAR; L9177: obj=BEAR;
return(feed()); return(feed());
L9178: SPK=159; L9178: SPK=159;
/* Snarf a treasure for the troll. */ /* Snarf a treasure for the troll. */
DROP(OBJ,0); DROP(obj,0);
MOVE(TROLL,0); MOVE(TROLL,0);
MOVE(TROLL+NOBJECTS,0); MOVE(TROLL+NOBJECTS,0);
DROP(TROLL2,PLAC[TROLL]); DROP(TROLL2,PLAC[TROLL]);

View file

@ -38,7 +38,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(bool), attack(FILE *, long), throw(FILE *), feed(void), fill(void); extern int carry(void), discard(bool), attack(FILE *, long), throw(FILE *, long obj), feed(void), fill(void);
void score(long); void score(long);