From 624ba16aadabdcf84a6c04ae17d0d0ff1d166835 Mon Sep 17 00:00:00 2001 From: "Jason S. Ninneman" Date: Sun, 18 Jun 2017 19:51:59 -0700 Subject: [PATCH] Change YES() to take const char* arguments. --- actions.c | 4 ++-- advent.h | 2 +- main.c | 8 ++++---- misc.c | 8 ++++---- saveresume.c | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/actions.c b/actions.c index 74d6756..4798d7d 100644 --- a/actions.c +++ b/actions.c @@ -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]); diff --git a/advent.h b/advent.h index e461b57..3e89be0 100644 --- a/advent.h +++ b/advent.h @@ -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); diff --git a/main.c b/main.c index b14e5ca..dd9d5c1 100644 --- a/main.c +++ b/main.c @@ -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; diff --git a/misc.c b/misc.c index 9899b08..33ec95b 100644 --- a/misc.c +++ b/misc.c @@ -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 diff --git a/saveresume.c b/saveresume.c index 20b6344..a0fa8a8 100644 --- a/saveresume.c +++ b/saveresume.c @@ -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) { -- 2.31.1