if (input == NULL) // Got EOF; return with it.
return (input);
- else if (input[0] == '#') { // Ignore comments.
+ if (input[0] == '#') { // Ignore comments.
free(input);
continue;
- } else // We have a 'normal' line; leave the loop.
- break;
+ }
+ // We have a 'normal' line; leave the loop.
+ break;
}
// Strip trailing newlines from the input
bool silent_yes()
{
- bool outcome;
+ bool outcome = false;
for (;;) {
char* reply = get_input();
exit(EXIT_SUCCESS);
// LCOV_EXCL_STOP
}
+ if (strlen(reply) == 0) {
+ free(reply);
+ rspeak(PLEASE_ANSWER);
+ continue;
+ }
char* firstword = (char*) xmalloc(strlen(reply) + 1);
sscanf(reply, "%s", firstword);
/* Print message X, wait for yes/no answer. If yes, print Y and return true;
* if no, print Z and return false. */
{
- bool outcome;
+ bool outcome = false;
for (;;) {
speak(question);
// LCOV_EXCL_STOP
}
+ if (strlen(reply) == 0) {
+ free(reply);
+ rspeak(PLEASE_ANSWER);
+ continue;
+ }
+
char* firstword = (char*) xmalloc(strlen(reply) + 1);
sscanf(reply, "%s", firstword);
from = game.fixed[object - NOBJECTS];
else
from = game.place[object];
- if (from != LOC_NOWHERE && from != CARRIED && !SPECIAL(from))
+ /* (ESR) Used to check for !SPECIAL(from). I *think* that was wrong... */
+ if (from != LOC_NOWHERE && from != CARRIED)
carry(object, from);
drop(object, where);
}
--game.holdng;
game.place[object] = where;
}
- if (where <= 0)
+ if (where == LOC_NOWHERE ||
+ where == CARRIED)
return;
game.link[object] = game.atloc[where];
game.atloc[where] = object;