projects
/
open-adventure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Magic-number elimination.
[open-adventure.git]
/
actions.c
diff --git
a/actions.c
b/actions.c
index 43a570e2d74ae3b249f1dc59fa6fc253ffde4f71..b236cbf13b11e5b3accdd7b8b4f1dd21750515bb 100644
(file)
--- a/
actions.c
+++ b/
actions.c
@@
-123,7
+123,7
@@
static int attack(struct command_t *command)
}
state_change(DRAGON, DRAGON_DEAD);
game.prop[RUG] = RUG_FLOOR;
}
state_change(DRAGON, DRAGON_DEAD);
game.prop[RUG] = RUG_FLOOR;
- /* FIXME: Arithme
n
tic on location values */
+ /* FIXME: Arithmetic on location values */
int k = (objects[DRAGON].plac + objects[DRAGON].fixd) / 2;
move(DRAGON + NOBJECTS, -1);
move(RUG + NOBJECTS, 0);
int k = (objects[DRAGON].plac + objects[DRAGON].fixd) / 2;
move(DRAGON + NOBJECTS, -1);
move(RUG + NOBJECTS, 0);
@@
-172,11
+172,11
@@
static int bigwords(token_t foo)
* crossing. */
if (game.place[EGGS] == LOC_NOWHERE && game.place[TROLL] == LOC_NOWHERE && game.prop[TROLL] == TROLL_UNPAID)
game.prop[TROLL] = TROLL_PAIDONCE;
* crossing. */
if (game.place[EGGS] == LOC_NOWHERE && game.place[TROLL] == LOC_NOWHERE && game.prop[TROLL] == TROLL_UNPAID)
game.prop[TROLL] = TROLL_PAIDONCE;
- k =
2
;
+ k =
EGGS_DONE
;
if (HERE(EGGS))
if (HERE(EGGS))
- k =
1
;
+ k =
EGGS_VANISHED
;
if (game.loc == objects[EGGS].plac)
if (game.loc == objects[EGGS].plac)
- k =
0
;
+ k =
EGGS_HERE
;
move(EGGS, objects[EGGS].plac);
pspeak(EGGS, look, k);
return GO_CLEAROBJ;
move(EGGS, objects[EGGS].plac);
pspeak(EGGS, look, k);
return GO_CLEAROBJ;
@@
-224,23
+224,24
@@
static void blast(void)
static int vbreak(token_t verb, token_t obj)
/* Break. Only works for mirror in repository and, of course, the vase. */
{
static int vbreak(token_t verb, token_t obj)
/* Break. Only works for mirror in repository and, of course, the vase. */
{
- int spk = actions[verb].message;
- if (obj == MIRROR)
- spk = TOO_FAR;
- if (obj == VASE && game.prop[VASE] == 0) {
- if (TOTING(VASE))
- drop(VASE, game.loc);
- game.prop[VASE] = 2;
- game.fixed[VASE] = -1;
- spk = BREAK_VASE;
- } else {
- if (obj == MIRROR && game.closed) {
+ if (obj == MIRROR) {
+ if (game.closed) {
rspeak(BREAK_MIRROR);
return GO_DWARFWAKE;
rspeak(BREAK_MIRROR);
return GO_DWARFWAKE;
+ } else {
+ rspeak(TOO_FAR);
+ return GO_CLEAROBJ;
}
}
}
}
- rspeak(spk);
- return GO_CLEAROBJ;
+ if (obj == VASE && game.prop[VASE] == VASE_WHOLE) {
+ if (TOTING(VASE))
+ drop(VASE, game.loc);
+ state_change(VASE, VASE_BROKEN);
+ game.fixed[VASE] = -1;
+ return GO_CLEAROBJ;
+ }
+ rspeak(actions[verb].message);
+ return (GO_CLEAROBJ);
}
static int brief(void)
}
static int brief(void)
@@
-443,15
+444,15
@@
static int discard(token_t verb, token_t obj, bool just_do_it)
move(TROLL2, objects[TROLL].plac);
move(TROLL2 + NOBJECTS, objects[TROLL].fixd);
juggle(CHASM);
move(TROLL2, objects[TROLL].plac);
move(TROLL2 + NOBJECTS, objects[TROLL].fixd);
juggle(CHASM);
- game.prop[TROLL] =
2
;
+ game.prop[TROLL] =
TROLL_GONE
;
} else if (obj != VASE || game.loc == objects[PILLOW].plac) {
rspeak(OK_MAN);
} else {
} else if (obj != VASE || game.loc == objects[PILLOW].plac) {
rspeak(OK_MAN);
} else {
- game.prop[VASE] =
2
;
+ game.prop[VASE] =
VASE_BROKEN
;
if (AT(PILLOW))
if (AT(PILLOW))
- game.prop[VASE] =
0
;
+ game.prop[VASE] =
VASE_WHOLE
;
pspeak(VASE, look, game.prop[VASE] + 1);
pspeak(VASE, look, game.prop[VASE] + 1);
- if (game.prop[VASE] !=
0
)
+ if (game.prop[VASE] !=
VASE_WHOLE
)
game.fixed[VASE] = -1;
}
}
game.fixed[VASE] = -1;
}
}
@@
-604,7
+605,7
@@
int fill(token_t verb, token_t obj)
return GO_CLEAROBJ;
}
rspeak(SHATTER_VASE);
return GO_CLEAROBJ;
}
rspeak(SHATTER_VASE);
- game.prop[VASE] =
2
;
+ game.prop[VASE] =
VASE_BROKEN
;
game.fixed[VASE] = -1;
return (discard(verb, obj, true));
} else if (obj == URN) {
game.fixed[VASE] = -1;
return (discard(verb, obj, true));
} else if (obj == URN) {