projects
/
open-adventure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
magic numbers, show usage, fixed linty warnings
[open-adventure.git]
/
actions.c
diff --git
a/actions.c
b/actions.c
index 70d5acd127db9945dcae2ec010605085b04cd420..7ade4639c90102f9ab666e196fe7cf28ee573eca 100644
(file)
--- a/
actions.c
+++ b/
actions.c
@@
-21,9
+21,8
@@
static int attack(FILE *input, long verb, token_t obj)
* enemies, or no enemies but 2 others. */
{
int spk = ACTSPK[verb];
* enemies, or no enemies but 2 others. */
{
int spk = ACTSPK[verb];
- int d = ATDWRF(game.loc);
- if (obj == 0) {
- if (d > 0)
+ if (obj == 0 || obj == INTRANSITIVE) {
+ if (ATDWRF(game.loc) > 0)
obj = DWARF;
if (HERE(SNAKE))obj = obj * NOBJECTS + SNAKE;
if (AT(DRAGON) && game.prop[DRAGON] == 0)obj = obj * NOBJECTS + DRAGON;
obj = DWARF;
if (HERE(SNAKE))obj = obj * NOBJECTS + SNAKE;
if (AT(DRAGON) && game.prop[DRAGON] == 0)obj = obj * NOBJECTS + DRAGON;
@@
-65,7
+64,7
@@
static int attack(FILE *input, long verb, token_t obj)
if (obj == DRAGON)spk = ALREADY_DEAD;
if (obj == TROLL)spk = ROCKY_TROLL;
if (obj == OGRE)spk = OGRE_DODGE;
if (obj == DRAGON)spk = ALREADY_DEAD;
if (obj == TROLL)spk = ROCKY_TROLL;
if (obj == OGRE)spk = OGRE_DODGE;
- if (obj == OGRE &&
d
> 0) {
+ if (obj == OGRE &&
ATDWRF(game.loc)
> 0) {
RSPEAK(spk);
RSPEAK(KNIFE_THROWN);
DESTROY(OGRE);
RSPEAK(spk);
RSPEAK(KNIFE_THROWN);
DESTROY(OGRE);
@@
-177,7
+176,7
@@
static void blast(void)
if (HERE(ROD2))
game.bonus = SPLATTER_MESSAGE;
RSPEAK(game.bonus);
if (HERE(ROD2))
game.bonus = SPLATTER_MESSAGE;
RSPEAK(game.bonus);
-
scor
e(endgame);
+
terminat
e(endgame);
}
}
}
}
@@
-711,7
+710,7
@@
static int lock(token_t verb, token_t obj)
if (AT(GRATE))obj = GRATE;
if (obj != 0 && HERE(CHAIN)) return GO_UNKNOWN;
if (HERE(CHAIN))obj = CHAIN;
if (AT(GRATE))obj = GRATE;
if (obj != 0 && HERE(CHAIN)) return GO_UNKNOWN;
if (HERE(CHAIN))obj = CHAIN;
- if (obj == 0) {
+ if (obj == 0
|| obj == INTRANSITIVE
) {
RSPEAK(spk);
return GO_CLEAROBJ;
}
RSPEAK(spk);
return GO_CLEAROBJ;
}
@@
-732,7
+731,7
@@
static int lock(token_t verb, token_t obj)
return chain(verb);
if (game.closng) {
spk = EXIT_CLOSED;
return chain(verb);
if (game.closng) {
spk = EXIT_CLOSED;
- if (!game.panic)game.clock2 =
15
;
+ if (!game.panic)game.clock2 =
PANICTIME
;
game.panic = true;
} else {
spk = game.prop[GRATE] ? GRATE_LOCKED : ALREADY_LOCKED;
game.panic = true;
} else {
spk = game.prop[GRATE] ? GRATE_LOCKED : ALREADY_LOCKED;
@@
-790,15
+789,15
@@
static int pour(token_t verb, token_t obj)
}
}
}
}
-static int quit(
FILE *input
)
+static int quit(
void
)
/* Quit. Intransitive only. Verify intent and exit if that's what he wants. */
{
/* Quit. Intransitive only. Verify intent and exit if that's what he wants. */
{
- if (YES(
input,
REALLY_QUIT, OK_MAN, OK_MAN))
-
scor
e(quitgame);
+ if (YES(REALLY_QUIT, OK_MAN, OK_MAN))
+
terminat
e(quitgame);
return GO_CLEAROBJ;
}
return GO_CLEAROBJ;
}
-static int read(
FILE *input,
token_t verb, token_t obj)
+static int read(token_t verb, token_t obj)
/* Read. Print stuff based on objtxt. Oyster (?) is special case. */
{
int spk = ACTSPK[verb];
/* Read. Print stuff based on objtxt. Oyster (?) is special case. */
{
int spk = ACTSPK[verb];
@@
-821,7
+820,7
@@
static int read(FILE *input, token_t verb, token_t obj)
return GO_CLEAROBJ;
}
if (obj == OYSTER && !game.clshnt) {
return GO_CLEAROBJ;
}
if (obj == OYSTER && !game.clshnt) {
- game.clshnt = YES(
input,
CLUE_QUERY, WAYOUT_CLUE, OK_MAN);
+ game.clshnt = YES(CLUE_QUERY, WAYOUT_CLUE, OK_MAN);
return GO_CLEAROBJ;
}
PSPEAK(obj, OBJTXT[obj] + game.prop[obj]);
return GO_CLEAROBJ;
}
PSPEAK(obj, OBJTXT[obj] + game.prop[obj]);
@@
-951,13
+950,6
@@
static int throw (FILE *cmdin, long verb, token_t obj)
return throw_support((++game.dkill == 1) ? DWARF_SMOKE : KILLED_DWARF);
}
return throw_support((++game.dkill == 1) ? DWARF_SMOKE : KILLED_DWARF);
}
-static int vscore(void)
-/* Score. Call scoring routine but tell it to return. */
-{
- score(scoregame);
- return GO_CLEAROBJ;
-}
-
static int wake(token_t verb, token_t obj)
/* Wake. Only use is to disturb the dwarves. */
{
static int wake(token_t verb, token_t obj)
/* Wake. Only use is to disturb the dwarves. */
{
@@
-1108,7
+1100,7
@@
int action(FILE *input, enum speechpart part, long verb, token_t obj)
case 16: /* TOSS */
return GO_UNKNOWN;
case 17: /* QUIT */
case 16: /* TOSS */
return GO_UNKNOWN;
case 17: /* QUIT */
- return quit(
input
);
+ return quit();
case 18: /* FIND */
return GO_UNKNOWN;
case 19: /* INVEN */
case 18: /* FIND */
return GO_UNKNOWN;
case 19: /* INVEN */
@@
-1121,21
+1113,22
@@
int action(FILE *input, enum speechpart part, long verb, token_t obj)
blast();
return GO_CLEAROBJ;
case 23: /* SCOR */
blast();
return GO_CLEAROBJ;
case 23: /* SCOR */
- return vscore();
+ score(scoregame);
+ return GO_CLEAROBJ;
case 24: /* FOO */
return bigwords(WD1);
case 25: /* BRIEF */
return brief();
case 26: /* READ */
case 24: /* FOO */
return bigwords(WD1);
case 25: /* BRIEF */
return brief();
case 26: /* READ */
- return read(
input,
verb, INTRANSITIVE);
+ return read(verb, INTRANSITIVE);
case 27: /* BREAK */
return GO_UNKNOWN;
case 28: /* WAKE */
return GO_UNKNOWN;
case 29: /* SUSP */
case 27: /* BREAK */
return GO_UNKNOWN;
case 28: /* WAKE */
return GO_UNKNOWN;
case 29: /* SUSP */
- return suspend(
input
);
+ return suspend();
case 30: /* RESU */
case 30: /* RESU */
- return resume(
input
);
+ return resume();
case 31: /* FLY */
return fly(verb, INTRANSITIVE);
case 32: /* LISTE */
case 31: /* FLY */
return fly(verb, INTRANSITIVE);
case 32: /* LISTE */
@@
-1143,7
+1136,7
@@
int action(FILE *input, enum speechpart part, long verb, token_t obj)
case 33: /* ZZZZ */
return reservoir();
}
case 33: /* ZZZZ */
return reservoir();
}
- BUG(
23
);
+ BUG(
INTRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST
);
}
/* FALLTHRU */
case transitive:
}
/* FALLTHRU */
case transitive:
@@
-1217,7
+1210,7
@@
int action(FILE *input, enum speechpart part, long verb, token_t obj)
return GO_CLEAROBJ;
}
case 26: /* READ */
return GO_CLEAROBJ;
}
case 26: /* READ */
- return read(
input,
verb, obj);
+ return read(verb, obj);
case 27: /* BREAK */
return vbreak(verb, obj);
case 28: /* WAKE */
case 27: /* BREAK */
return vbreak(verb, obj);
case 28: /* WAKE */
@@
-1239,13
+1232,13
@@
int action(FILE *input, enum speechpart part, long verb, token_t obj)
case 33: /* ZZZZ */
return reservoir();
}
case 33: /* ZZZZ */
return reservoir();
}
- BUG(
24
);
+ BUG(
TRANSITIVE_ACTION_VERB_EXCEEDS_GOTO_LIST
);
case unknown:
/* Unknown verb, couldn't deduce object - might need hint */
SETPRM(1, WD1, WD1X);
RSPEAK(WHAT_DO);
return GO_CHECKHINT;
default:
case unknown:
/* Unknown verb, couldn't deduce object - might need hint */
SETPRM(1, WD1, WD1X);
RSPEAK(WHAT_DO);
return GO_CHECKHINT;
default:
- BUG(
99
);
+ BUG(
SPEECHPART_NOT_TRANSITIVE_OR_INTRANSITIVE_OR_UNKNOWN
);
}
}
}
}