Localize K in fill().

This commit is contained in:
Eric S. Raymond 2017-06-08 03:12:07 -04:00
parent 7e4753b23a
commit b29678956e

View file

@ -219,42 +219,54 @@ L9128: RSPEAK(SPK);
return(2011); return(2011);
} }
/* Throw. Same as discard unless axe. Then same as attack except ignore bird, int throw(FILE *cmdin, long obj, long verb)
* and if dwarf is present then one might be killed. (Only way to do so!) /* Throw. Same as discard unless axe. Then same as attack except
* Axe also special for dragon, bear, and troll. Treasures special for troll. */ * ignore bird, and if dwarf is present then one might be killed.
* (Only way to do so!) Axe also special for dragon, bear, and
int throw(FILE *cmdin, long obj, long verb) { * troll. Treasures special for troll. */
{
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))
if (obj >= 50 && obj <= MAXTRS && AT(TROLL)) goto L9178; return(2011);
if (obj == FOOD && HERE(BEAR)) goto L9177; if (obj >= 50 && obj <= MAXTRS && AT(TROLL))
if (obj != AXE) return(discard(obj, false)); goto L9178;
if (obj == FOOD && HERE(BEAR))
goto L9177;
if (obj != AXE)
return(discard(obj, false));
I=ATDWRF(game.loc); I=ATDWRF(game.loc);
if (I > 0) goto L9172; if (I > 0)
goto L9172;
SPK=152; SPK=152;
if (AT(DRAGON) && game.prop[DRAGON] == 0) goto L9175; if (AT(DRAGON) && game.prop[DRAGON] == 0)
goto L9175;
SPK=158; SPK=158;
if (AT(TROLL)) goto L9175; if (AT(TROLL))
goto L9175;
SPK=203; SPK=203;
if (AT(OGRE)) goto L9175; if (AT(OGRE))
if (HERE(BEAR) && game.prop[BEAR] == 0) goto L9176; goto L9175;
obj=0; if (HERE(BEAR) && game.prop[BEAR] == 0)
return(attack(cmdin, obj, verb)); goto L9176;
return(attack(cmdin, 0, verb));
L9172: SPK=48; L9172:
SPK=48;
if (randrange(NDWARVES+1) < game.dflag) goto L9175; if (randrange(NDWARVES+1) < game.dflag) goto L9175;
game.dseen[I]=false; game.dseen[I]=false;
game.dloc[I]=0; game.dloc[I]=0;
SPK=47; SPK=47;
game.dkill=game.dkill+1; game.dkill=game.dkill+1;
if (game.dkill == 1)SPK=149; if (game.dkill == 1)SPK=149;
L9175: RSPEAK(SPK); L9175:
RSPEAK(SPK);
DROP(AXE,game.loc); DROP(AXE,game.loc);
K=NUL; K=NUL;
return(8); return(8);
/* This'll teach him to throw the axe at the bear! */ /* This'll teach him to throw the axe at the bear! */
L9176: SPK=164; L9176:
SPK=164;
DROP(AXE,game.loc); DROP(AXE,game.loc);
game.fixed[AXE]= -1; game.fixed[AXE]= -1;
game.prop[AXE]=1; game.prop[AXE]=1;
@ -262,10 +274,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(obj)); return(feed(obj));
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);
@ -332,6 +346,7 @@ int fill(long obj)
/* Fill. Bottle or urn must be empty, and liquid available. (Vase /* Fill. Bottle or urn must be empty, and liquid available. (Vase
* is nasty.) */ * is nasty.) */
{ {
int k;
if (obj == VASE) { if (obj == VASE) {
SPK=29; SPK=29;
if (LIQLOC(game.loc) == 0)SPK=144; if (LIQLOC(game.loc) == 0)SPK=144;
@ -347,11 +362,11 @@ int fill(long obj)
SPK=213; SPK=213;
if (game.prop[URN] != 0) return(2011); if (game.prop[URN] != 0) return(2011);
SPK=144; SPK=144;
K=LIQ(0); k=LIQ(0);
if (K == 0 || !HERE(BOTTLE)) return(2011); if (k == 0 || !HERE(BOTTLE)) return(2011);
game.place[K]=0; game.place[k]=0;
game.prop[BOTTLE]=1; game.prop[BOTTLE]=1;
if (K == OIL)game.prop[URN]=1; if (k == OIL)game.prop[URN]=1;
SPK=211+game.prop[URN]; SPK=211+game.prop[URN];
return(2011); return(2011);
} }
@ -370,10 +385,10 @@ int fill(long obj)
if (SPK != 107) if (SPK != 107)
return(2011); return(2011);
game.prop[BOTTLE]=MOD(COND[game.loc],4)/2*2; game.prop[BOTTLE]=MOD(COND[game.loc],4)/2*2;
K=LIQ(0); k=LIQ(0);
if (TOTING(BOTTLE)) if (TOTING(BOTTLE))
game.place[K]= -1; game.place[k]= -1;
if (K == OIL) if (k == OIL)
SPK=108; SPK=108;
return(2011); return(2011);
} }