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]
/
main.c
diff --git
a/main.c
b/main.c
index 4ebe719b646947b0cb1e6d423559d8230a94e168..4a92f00835d3f4c616b50fe95ae1b4d7f6c7b670 100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-521,7
+521,7
@@
static void croak(void)
* him, so we need game.oldlc2, which is the last place he was
* safe.) */
* him, so we need game.oldlc2, which is the last place he was
* safe.) */
-static bool playermove(
token_t verb,
int motion)
+static bool playermove( int motion)
{
int scratchloc, travel_entry = tkey[game.loc];
game.newloc = game.loc;
{
int scratchloc, travel_entry = tkey[game.loc];
game.newloc = game.loc;
@@
-598,23
+598,20
@@
static bool playermove(token_t verb, int motion)
if (T_TERMINATE(travel[travel_entry]) || travel[travel_entry].motion == motion)
break;
if (travel[travel_entry].stop) {
if (T_TERMINATE(travel[travel_entry]) || travel[travel_entry].motion == motion)
break;
if (travel[travel_entry].stop) {
- /* FIXME: Magic numbers! */
/* Couldn't find an entry matching the motion word passed
* in. Various messages depending on word given. */
int spk = CANT_APPLY;
/* Couldn't find an entry matching the motion word passed
* in. Various messages depending on word given. */
int spk = CANT_APPLY;
- if (motion >=
MOT_43 && motion <= MOT_50
)
+ if (motion >=
EAST && motion <= NW
)
spk = BAD_DIRECTION;
spk = BAD_DIRECTION;
- if (motion ==
MOT_29 || motion == MOT_30
)
+ if (motion ==
UP || motion == DOWN
)
spk = BAD_DIRECTION;
spk = BAD_DIRECTION;
- if (motion ==
MOT_7 || motion == MOT_36 || motion == MOT_37
)
+ if (motion ==
FORWARD || motion == LEFT || motion == RIGHT
)
spk = UNSURE_FACING;
spk = UNSURE_FACING;
- if (motion ==
MOT_11 || motion == MOT_19
)
+ if (motion ==
OUTSIDE || motion == INSIDE
)
spk = NO_INOUT_HERE;
spk = NO_INOUT_HERE;
- if (verb == FIND || verb == INVENTORY)
- spk = NEARBY;
- if (motion == MOT_62 || motion == MOT_65)
+ if (motion == XYZZY || motion == PLUGH)
spk = NOTHING_HAPPENS;
spk = NOTHING_HAPPENS;
- if (motion ==
MOT_17
)
+ if (motion ==
CRAWL
)
spk = WHICH_WAY;
rspeak(spk);
return true;
spk = WHICH_WAY;
rspeak(spk);
return true;
@@
-998,7
+995,7
@@
static bool do_command()
rspeak(TAME_BEAR);
speak(msg);
if (FORCED(game.loc)) {
rspeak(TAME_BEAR);
speak(msg);
if (FORCED(game.loc)) {
- if (playermove(
command.verb, 1
))
+ if (playermove(
HERE
))
return true;
else
continue; /* back to top of main interpreter loop */
return true;
else
continue; /* back to top of main interpreter loop */
@@
-1132,7
+1129,7
@@
Lookup:
kmod = MOD(defn, 1000);
switch (defn / 1000) {
case 0:
kmod = MOD(defn, 1000);
switch (defn / 1000) {
case 0:
- if (playermove(
command.verb,
kmod))
+ if (playermove(kmod))
return true;
else
continue; /* back to top of main interpreter loop */
return true;
else
continue; /* back to top of main interpreter loop */
@@
-1156,7
+1153,7
@@
Laction:
case GO_TERMINATE:
return true;
case GO_MOVE:
case GO_TERMINATE:
return true;
case GO_MOVE:
- playermove(
command.verb,
NUL);
+ playermove(NUL);
return true;
case GO_TOP:
continue; /* back to top of main interpreter loop */
return true;
case GO_TOP:
continue; /* back to top of main interpreter loop */