cppcheck cleanup.
This commit is contained in:
parent
ceba6482a1
commit
4069bf210b
5 changed files with 17 additions and 17 deletions
12
actions.c
12
actions.c
|
@ -111,7 +111,7 @@ static phase_codes_t attack(command_t command)
|
|||
* fixed), move rug there (not fixed), and move him there,
|
||||
* too. Then do a null motion to get new description. */
|
||||
rspeak(BARE_HANDS_QUERY);
|
||||
if (!silent_yes()) {
|
||||
if (!silent_yes_or_no()) {
|
||||
speak(arbitrary_messages[NASTY_DRAGON]);
|
||||
return GO_MOVE;
|
||||
}
|
||||
|
@ -1096,7 +1096,7 @@ static phase_codes_t pour(verb_t verb, obj_t obj)
|
|||
static phase_codes_t quit(void)
|
||||
/* Quit. Intransitive only. Verify intent and exit if that's what he wants. */
|
||||
{
|
||||
if (yes(arbitrary_messages[REALLY_QUIT], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN]))
|
||||
if (yes_or_no(arbitrary_messages[REALLY_QUIT], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN]))
|
||||
terminate(quitgame);
|
||||
return GO_CLEAROBJ;
|
||||
}
|
||||
|
@ -1122,8 +1122,8 @@ static phase_codes_t read(command_t command)
|
|||
if (!TOTING(OYSTER) || !game.closed) {
|
||||
rspeak(DONT_UNDERSTAND);
|
||||
} else if (!game.clshnt) {
|
||||
game.clshnt = yes(arbitrary_messages[CLUE_QUERY], arbitrary_messages[WAYOUT_CLUE], arbitrary_messages[OK_MAN]);
|
||||
} else if (game.clshnt) {
|
||||
game.clshnt = yes_or_no(arbitrary_messages[CLUE_QUERY], arbitrary_messages[WAYOUT_CLUE], arbitrary_messages[OK_MAN]);
|
||||
} else {
|
||||
pspeak(OYSTER, hear, true, 1); // Not really a sound, but oh well.
|
||||
}
|
||||
} else if (objects[command.obj].texts[0] == NULL ||
|
||||
|
@ -1204,7 +1204,7 @@ static phase_codes_t throw_support(vocab_t spk)
|
|||
return GO_MOVE;
|
||||
}
|
||||
|
||||
static phase_codes_t throw (command_t command)
|
||||
static phase_codes_t throwit(command_t command)
|
||||
/* Throw. Same as discard unless axe. Then same as attack except
|
||||
* ignore bird, and if dwarf is present then one might be killed.
|
||||
* (Only way to do so!) Axe also special for dragon, bear, and
|
||||
|
@ -1539,7 +1539,7 @@ phase_codes_t action(command_t command)
|
|||
case RUB:
|
||||
return rub(command.verb, command.obj);
|
||||
case THROW:
|
||||
return throw (command);
|
||||
return throwit(command);
|
||||
case QUIT: {
|
||||
speak(actions[command.verb].message);
|
||||
return GO_CLEAROBJ;
|
||||
|
|
4
advent.h
4
advent.h
|
@ -229,8 +229,8 @@ extern void sspeak(int msg, ...);
|
|||
extern void pspeak(vocab_t, enum speaktype, bool, int, ...);
|
||||
extern void rspeak(vocab_t, ...);
|
||||
extern void echo_input(FILE*, const char*, const char*);
|
||||
extern bool silent_yes(void);
|
||||
extern bool yes(const char*, const char*, const char*);
|
||||
extern bool silent_yes_or_no(void);
|
||||
extern bool yes_or_no(const char*, const char*, const char*);
|
||||
extern void juggle(obj_t);
|
||||
extern void move(obj_t, loc_t);
|
||||
extern loc_t put(obj_t, int, int);
|
||||
|
|
10
main.c
10
main.c
|
@ -107,14 +107,14 @@ int main(int argc, char *argv[])
|
|||
|
||||
#ifndef ADVENT_NOSAVE
|
||||
if (!rfp) {
|
||||
game.novice = yes(arbitrary_messages[WELCOME_YOU], arbitrary_messages[CAVE_NEARBY], arbitrary_messages[NO_MESSAGE]);
|
||||
game.novice = yes_or_no(arbitrary_messages[WELCOME_YOU], arbitrary_messages[CAVE_NEARBY], arbitrary_messages[NO_MESSAGE]);
|
||||
if (game.novice)
|
||||
game.limit = NOVICELIMIT;
|
||||
} else {
|
||||
restore(rfp);
|
||||
}
|
||||
#else
|
||||
game.novice = yes(arbitrary_messages[WELCOME_YOU], arbitrary_messages[CAVE_NEARBY], arbitrary_messages[NO_MESSAGE]);
|
||||
game.novice = yes_or_no(arbitrary_messages[WELCOME_YOU], arbitrary_messages[CAVE_NEARBY], arbitrary_messages[NO_MESSAGE]);
|
||||
if (game.novice)
|
||||
game.limit = NOVICELIMIT;
|
||||
#endif
|
||||
|
@ -261,10 +261,10 @@ static void checkhints(void)
|
|||
|
||||
/* Fall through to hint display */
|
||||
game.hintlc[hint] = 0;
|
||||
if (!yes(hints[hint].question, arbitrary_messages[NO_MESSAGE], arbitrary_messages[OK_MAN]))
|
||||
if (!yes_or_no(hints[hint].question, arbitrary_messages[NO_MESSAGE], arbitrary_messages[OK_MAN]))
|
||||
return;
|
||||
rspeak(HINT_COST, hints[hint].penalty, hints[hint].penalty);
|
||||
game.hinted[hint] = yes(arbitrary_messages[WANT_HINT], hints[hint].hint, arbitrary_messages[OK_MAN]);
|
||||
game.hinted[hint] = yes_or_no(arbitrary_messages[WANT_HINT], hints[hint].hint, arbitrary_messages[OK_MAN]);
|
||||
if (game.hinted[hint] && game.limit > WARNTIME)
|
||||
game.limit += WARNTIME * hints[hint].penalty;
|
||||
}
|
||||
|
@ -519,7 +519,7 @@ static void croak(void)
|
|||
* death and exit. */
|
||||
rspeak(DEATH_CLOSING);
|
||||
terminate(endgame);
|
||||
} else if (!yes(query, yes_response, arbitrary_messages[OK_MAN])
|
||||
} else if (!yes_or_no(query, yes_response, arbitrary_messages[OK_MAN])
|
||||
|| game.numdie == NDEATHS) {
|
||||
/* Player is asked if he wants to try again. If not, or if
|
||||
* he's already used all of his lives, we end the game */
|
||||
|
|
4
misc.c
4
misc.c
|
@ -246,7 +246,7 @@ static char* get_input(void)
|
|||
return (input);
|
||||
}
|
||||
|
||||
bool silent_yes(void)
|
||||
bool silent_yes_or_no(void)
|
||||
{
|
||||
bool outcome = false;
|
||||
|
||||
|
@ -295,7 +295,7 @@ bool silent_yes(void)
|
|||
}
|
||||
|
||||
|
||||
bool yes(const char* question, const char* yes_response, const char* no_response)
|
||||
bool yes_or_no(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. */
|
||||
{
|
||||
|
|
|
@ -68,7 +68,7 @@ int suspend(void)
|
|||
FILE *fp = NULL;
|
||||
|
||||
rspeak(SUSPEND_WARNING);
|
||||
if (!yes(arbitrary_messages[THIS_ACCEPTABLE], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN]))
|
||||
if (!yes_or_no(arbitrary_messages[THIS_ACCEPTABLE], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN]))
|
||||
return GO_CLEAROBJ;
|
||||
game.saved = game.saved + 5;
|
||||
|
||||
|
@ -101,7 +101,7 @@ int resume(void)
|
|||
if (game.loc != 1 ||
|
||||
game.abbrev[1] != 1) {
|
||||
rspeak(RESUME_ABANDON);
|
||||
if (!yes(arbitrary_messages[THIS_ACCEPTABLE], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN]))
|
||||
if (!yes_or_no(arbitrary_messages[THIS_ACCEPTABLE], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN]))
|
||||
return GO_CLEAROBJ;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue