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,61 +219,75 @@ L9128: RSPEAK(SPK);
return(2011);
}
/* Throw. Same as discard unless axe. Then same as attack except ignore bird,
* 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, long verb)
/* Throw. Same as discard unless axe. Then same as attack except
* ignore bird, 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. */
{
if (TOTING(ROD2) && obj == ROD && !TOTING(ROD))obj=ROD2;
if (!TOTING(obj))
return(2011);
if (obj >= 50 && obj <= MAXTRS && AT(TROLL))
goto L9178;
if (obj == FOOD && HERE(BEAR))
goto L9177;
if (obj != AXE)
return(discard(obj, false));
I=ATDWRF(game.loc);
if (I > 0)
goto L9172;
SPK=152;
if (AT(DRAGON) && game.prop[DRAGON] == 0)
goto L9175;
SPK=158;
if (AT(TROLL))
goto L9175;
SPK=203;
if (AT(OGRE))
goto L9175;
if (HERE(BEAR) && game.prop[BEAR] == 0)
goto L9176;
return(attack(cmdin, 0, verb));
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;
if (obj == FOOD && HERE(BEAR)) goto L9177;
if (obj != AXE) return(discard(obj, false));
I=ATDWRF(game.loc);
if (I > 0) goto L9172;
SPK=152;
if (AT(DRAGON) && game.prop[DRAGON] == 0) goto L9175;
SPK=158;
if (AT(TROLL)) goto L9175;
SPK=203;
if (AT(OGRE)) goto L9175;
if (HERE(BEAR) && game.prop[BEAR] == 0) goto L9176;
obj=0;
return(attack(cmdin, obj, verb));
L9172:
SPK=48;
if (randrange(NDWARVES+1) < game.dflag) goto L9175;
game.dseen[I]=false;
game.dloc[I]=0;
SPK=47;
game.dkill=game.dkill+1;
if (game.dkill == 1)SPK=149;
L9175:
RSPEAK(SPK);
DROP(AXE,game.loc);
K=NUL;
return(8);
L9172: SPK=48;
if (randrange(NDWARVES+1) < game.dflag) goto L9175;
game.dseen[I]=false;
game.dloc[I]=0;
SPK=47;
game.dkill=game.dkill+1;
if (game.dkill == 1)SPK=149;
L9175: RSPEAK(SPK);
DROP(AXE,game.loc);
K=NUL;
return(8);
/* This'll teach him to throw the axe at the bear! */
L9176:
SPK=164;
DROP(AXE,game.loc);
game.fixed[AXE]= -1;
game.prop[AXE]=1;
JUGGLE(BEAR);
return(2011);
/* This'll teach him to throw the axe at the bear! */
L9176: SPK=164;
DROP(AXE,game.loc);
game.fixed[AXE]= -1;
game.prop[AXE]=1;
JUGGLE(BEAR);
return(2011);
/* But throwing food is another story. */
L9177:
obj=BEAR;
return(feed(obj));
/* But throwing food is another story. */
L9177: obj=BEAR;
return(feed(obj));
L9178: SPK=159;
/* Snarf a treasure for the troll. */
DROP(obj,0);
MOVE(TROLL,0);
MOVE(TROLL+NOBJECTS,0);
DROP(TROLL2,PLAC[TROLL]);
DROP(TROLL2+NOBJECTS,FIXD[TROLL]);
JUGGLE(CHASM);
return(2011);
L9178:
SPK=159;
/* Snarf a treasure for the troll. */
DROP(obj,0);
MOVE(TROLL,0);
MOVE(TROLL+NOBJECTS,0);
DROP(TROLL2,PLAC[TROLL]);
DROP(TROLL2+NOBJECTS,FIXD[TROLL]);
JUGGLE(CHASM);
return(2011);
}
int feed(long obj)
@ -332,6 +346,7 @@ int fill(long obj)
/* Fill. Bottle or urn must be empty, and liquid available. (Vase
* is nasty.) */
{
int k;
if (obj == VASE) {
SPK=29;
if (LIQLOC(game.loc) == 0)SPK=144;
@ -347,11 +362,11 @@ int fill(long obj)
SPK=213;
if (game.prop[URN] != 0) return(2011);
SPK=144;
K=LIQ(0);
if (K == 0 || !HERE(BOTTLE)) return(2011);
game.place[K]=0;
k=LIQ(0);
if (k == 0 || !HERE(BOTTLE)) return(2011);
game.place[k]=0;
game.prop[BOTTLE]=1;
if (K == OIL)game.prop[URN]=1;
if (k == OIL)game.prop[URN]=1;
SPK=211+game.prop[URN];
return(2011);
}
@ -370,10 +385,10 @@ int fill(long obj)
if (SPK != 107)
return(2011);
game.prop[BOTTLE]=MOD(COND[game.loc],4)/2*2;
K=LIQ(0);
k=LIQ(0);
if (TOTING(BOTTLE))
game.place[K]= -1;
if (K == OIL)
game.place[k]= -1;
if (k == OIL)
SPK=108;
return(2011);
}