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(spk);
|
||||||
RSPEAK(KNIFE_THROWN);
|
RSPEAK(KNIFE_THROWN);
|
||||||
DSTROY(OGRE);
|
DSTROY(OGRE);
|
||||||
int k=0;
|
int dwarves=0;
|
||||||
for (int i=1; i < PIRATE; i++) {
|
for (int i=1; i < PIRATE; i++) {
|
||||||
if (game.dloc[i] == game.loc) {
|
if (game.dloc[i] == game.loc) {
|
||||||
++k;
|
++dwarves;
|
||||||
game.dloc[i] = LOC_LONGWEST;
|
game.dloc[i] = LOC_LONGWEST;
|
||||||
game.dseen[i]=false;
|
game.dseen[i]=false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
spk=spk+1+1/k; /* FIXME: Arithmetic on message numbers */
|
spk=spk+1+1/dwarves; /* FIXME: Arithmetic on message numbers */
|
||||||
RSPEAK(spk);
|
|
||||||
return GO_CLEAROBJ;
|
|
||||||
}
|
}
|
||||||
|
else if (obj == BEAR)
|
||||||
if (obj == BEAR)
|
|
||||||
/* FIXME: Arithmetic on message numbers */
|
/* FIXME: Arithmetic on message numbers */
|
||||||
spk = BEAR_HANDS+(game.prop[BEAR]+1)/2;
|
spk = BEAR_HANDS+(game.prop[BEAR]+1)/2;
|
||||||
if (obj != DRAGON || game.prop[DRAGON] != 0) {
|
else if (obj == DRAGON && game.prop[DRAGON] == 0) {
|
||||||
RSPEAK(spk);
|
|
||||||
return GO_CLEAROBJ;
|
|
||||||
}
|
|
||||||
/* Fun stuff for dragon. If he insists on attacking it, win!
|
/* Fun stuff for dragon. If he insists on attacking it, win!
|
||||||
* Set game.prop to dead, move dragon to central loc (still
|
* Set game.prop to dead, move dragon to central loc (still
|
||||||
* fixed), move rug there (not fixed), and move him there,
|
* fixed), move rug there (not fixed), and move him there,
|
||||||
|
@ -113,6 +107,10 @@ static int attack(FILE *input, long verb, token_t obj)
|
||||||
}
|
}
|
||||||
game.loc=k;
|
game.loc=k;
|
||||||
return GO_MOVE;
|
return GO_MOVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
RSPEAK(spk);
|
||||||
|
return GO_CLEAROBJ;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bigwords(long foo)
|
static int bigwords(long foo)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue