Code simplification.
This commit is contained in:
parent
7ccef92f7f
commit
1b5ab6c808
1 changed files with 31 additions and 33 deletions
20
actions.c
20
actions.c
|
@ -70,26 +70,20 @@ static int attack(FILE *input, long verb, token_t obj)
|
|||
RSPEAK(spk);
|
||||
RSPEAK(KNIFE_THROWN);
|
||||
DSTROY(OGRE);
|
||||
int k=0;
|
||||
int dwarves=0;
|
||||
for (int i=1; i < PIRATE; i++) {
|
||||
if (game.dloc[i] == game.loc) {
|
||||
++k;
|
||||
++dwarves;
|
||||
game.dloc[i] = LOC_LONGWEST;
|
||||
game.dseen[i]=false;
|
||||
}
|
||||
}
|
||||
spk=spk+1+1/k; /* FIXME: Arithmetic on message numbers */
|
||||
RSPEAK(spk);
|
||||
return GO_CLEAROBJ;
|
||||
spk=spk+1+1/dwarves; /* FIXME: Arithmetic on message numbers */
|
||||
}
|
||||
|
||||
if (obj == BEAR)
|
||||
else if (obj == BEAR)
|
||||
/* FIXME: Arithmetic on message numbers */
|
||||
spk = BEAR_HANDS+(game.prop[BEAR]+1)/2;
|
||||
if (obj != DRAGON || game.prop[DRAGON] != 0) {
|
||||
RSPEAK(spk);
|
||||
return GO_CLEAROBJ;
|
||||
}
|
||||
else if (obj == DRAGON && game.prop[DRAGON] == 0) {
|
||||
/* Fun stuff for dragon. If he insists on attacking it, win!
|
||||
* Set game.prop to dead, move dragon to central loc (still
|
||||
* fixed), move rug there (not fixed), and move him there,
|
||||
|
@ -115,6 +109,10 @@ static int attack(FILE *input, long verb, token_t obj)
|
|||
return GO_MOVE;
|
||||
}
|
||||
|
||||
RSPEAK(spk);
|
||||
return GO_CLEAROBJ;
|
||||
}
|
||||
|
||||
static int bigwords(long foo)
|
||||
/* FEE FIE FOE FOO (AND FUM). Advance to next state if given in proper order.
|
||||
* Look up WD1 in section 3 of vocab to determine which word we've got. Last
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue