Change YES() to take const char* arguments.

This commit is contained in:
Jason S. Ninneman 2017-06-18 19:51:59 -07:00
parent 9229fdf2a3
commit 624ba16aad
5 changed files with 13 additions and 13 deletions

View file

@ -792,7 +792,7 @@ static int pour(token_t verb, token_t obj)
static int quit(void)
/* Quit. Intransitive only. Verify intent and exit if that's what he wants. */
{
if (YES(REALLY_QUIT, OK_MAN, OK_MAN))
if (YES(arbitrary_messages[REALLY_QUIT], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN]))
terminate(quitgame);
return GO_CLEAROBJ;
}
@ -820,7 +820,7 @@ static int read(token_t verb, token_t obj)
return GO_CLEAROBJ;
}
if (obj == OYSTER && !game.clshnt) {
game.clshnt = YES(CLUE_QUERY, WAYOUT_CLUE, OK_MAN);
game.clshnt = YES(arbitrary_messages[CLUE_QUERY], arbitrary_messages[WAYOUT_CLUE], arbitrary_messages[OK_MAN]);
return GO_CLEAROBJ;
}
PSPEAK(obj, OBJTXT[obj] + game.prop[obj]);

View file

@ -94,7 +94,7 @@ extern void SETPRM(long,long,long);
extern bool GETIN(FILE *,token_t*,token_t*,token_t*,token_t*);
extern void echo_input(FILE*, char*, char*);
extern char* get_input(void);
extern bool YES(vocab_t, vocab_t, vocab_t);
extern bool YES(const char*, const char*, const char*);
extern long GETTXT(bool,bool,bool);
extern token_t MAKEWD(long);
extern long VOCAB(long,long);

8
main.c
View file

@ -148,7 +148,7 @@ int main(int argc, char *argv[])
game.loc = LOC_START;
game.limit = 330;
if (!rfp) {
game.novice = YES(WELCOME_YOU, CAVE_NEARBY, NO_MESSAGE);
game.novice = YES(arbitrary_messages[WELCOME_YOU], arbitrary_messages[CAVE_NEARBY], arbitrary_messages[NO_MESSAGE]);
if (game.novice)game.limit = 1000;
} else {
restore(rfp);
@ -264,11 +264,11 @@ static void checkhints(void)
/* Fall through to hint display */
game.hintlc[hint] = 0;
if (!YES(HINTS[hint][3], NO_MESSAGE, OK_MAN))
if (!YES(arbitrary_messages[HINTS[hint][3]], arbitrary_messages[NO_MESSAGE], arbitrary_messages[OK_MAN]))
return;
SETPRM(1, HINTS[hint][2], HINTS[hint][2]);
RSPEAK(HINT_COST);
game.hinted[hint] = YES(WANT_HINT, HINTS[hint][4], OK_MAN);
game.hinted[hint] = YES(arbitrary_messages[WANT_HINT], arbitrary_messages[HINTS[hint][4]], arbitrary_messages[OK_MAN]);
if (game.hinted[hint] && game.limit > WARNTIME)
game.limit += WARNTIME * HINTS[hint][2];
}
@ -498,7 +498,7 @@ static void croak(void)
terminate(endgame);
}
/* FIXME: Arithmetic on message numbers */
else if (game.numdie == MAXDIE || !YES(WATCH_IT + game.numdie * 2, WHICH_WAY + game.numdie * 2, OK_MAN))
else if (game.numdie == MAXDIE || !YES(arbitrary_messages[WATCH_IT + game.numdie * 2], arbitrary_messages[WHICH_WAY + game.numdie * 2], arbitrary_messages[OK_MAN]))
terminate(endgame);
else {
game.place[WATER] = game.place[OIL] = NOWHERE;

8
misc.c
View file

@ -250,7 +250,7 @@ char* get_input()
return (input);
}
bool YES(vocab_t question, vocab_t yes_response, vocab_t no_response)
bool YES(const char* question, const char* yes_response, const char* no_response)
/* Print message X, wait for yes/no answer. If yes, print Y and return true;
* if no, print Z and return false. */
{
@ -258,7 +258,7 @@ bool YES(vocab_t question, vocab_t yes_response, vocab_t no_response)
bool outcome;
for (;;) {
RSPEAK(question);
speak(question);
reply = get_input();
@ -276,11 +276,11 @@ bool YES(vocab_t question, vocab_t yes_response, vocab_t no_response)
free(firstword);
if (yes == 0 || y == 0) {
RSPEAK(yes_response);
speak(yes_response);
outcome = true;
break;
} else if (no == 0 || n == 0) {
RSPEAK(no_response);
speak(no_response);
outcome = false;
break;
} else

View file

@ -44,7 +44,7 @@ int suspend(void)
FILE *fp = NULL;
RSPEAK(SUSPEND_WARNING);
if (!YES(THIS_ACCEPTABLE, OK_MAN, OK_MAN)) return GO_CLEAROBJ;
if (!YES(arbitrary_messages[THIS_ACCEPTABLE], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN])) return GO_CLEAROBJ;
game.saved = game.saved + 5;
while (fp == NULL) {
@ -83,7 +83,7 @@ int resume(void)
if (game.loc != 1 || game.abbrev[1] != 1) {
RSPEAK(RESUME_ABANDON);
if (!YES(THIS_ACCEPTABLE, OK_MAN, OK_MAN)) return GO_CLEAROBJ;
if (!YES(arbitrary_messages[THIS_ACCEPTABLE], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN])) return GO_CLEAROBJ;
}
while (fp == NULL) {