int count = 0;
int inblanks = true;
- for (char *s = str; *s; s++)
+ for (char *s = str; *s; s++) {
if (inblanks) {
if (strchr(delims, *s) == 0) {
++count;
inblanks = true;
}
}
+ }
return (count);
}
static char *get_input(void) {
// Set up the prompt
char input_prompt[] = PROMPT;
- if (!settings.prompt)
+ if (!settings.prompt) {
input_prompt[0] = '\0';
+ }
// Print a blank line
printf("\n");
for (;;) {
input = myreadline(input_prompt);
- if (input == NULL) // Got EOF; return with it.
+ if (input == NULL) { // Got EOF; return with it.
return (input);
+ }
if (input[0] == '#') { // Ignore comments.
free(input);
continue;
add_history(input);
- if (!isatty(0))
+ if (!isatty(0)) {
echo_input(stdout, input_prompt, input);
+ }
- if (settings.logfp)
+ if (settings.logfp) {
echo_input(settings.logfp, "", input);
+ }
return (input);
}
free(reply);
- for (int i = 0; i < (int)strlen(firstword); ++i)
+ for (int i = 0; i < (int)strlen(firstword); ++i) {
firstword[i] = tolower(firstword[i]);
+ }
int yes = strncmp("yes", firstword, sizeof("yes") - 1);
int y = strncmp("y", firstword, sizeof("y") - 1);
} else if (no == 0 || n == 0) {
outcome = false;
break;
- } else
+ } else {
rspeak(PLEASE_ANSWER);
+ }
}
return (outcome);
}
speak(no_response);
outcome = false;
break;
- } else
+ } else {
rspeak(PLEASE_ANSWER);
+ }
}
return (outcome);
TOKLEN) == 0 &&
(strlen(word) > 1 ||
strchr(ignore, word[0]) == NULL ||
- !settings.oldstyle))
+ !settings.oldstyle)) {
return (i);
+ }
}
}
// If execution reaches here, we didn't find the word.
// removed
for (int j = 0; j < objects[i].words.n; ++j) {
if (strncasecmp(word, objects[i].words.strs[j],
- TOKLEN) == 0)
+ TOKLEN) == 0) {
return (i);
+ }
}
}
// If execution reaches here, we didn't find the word.
for (;;) {
input = get_input();
- if (input == NULL)
+ if (input == NULL) {
return false;
+ }
if (word_count(input) > 2) {
rspeak(TWO_WORDS);
free(input);
/* put() is the same as move(), except it returns a value used to set
* up the negated game.prop values for the repository objects. */
move(object, where);
- /* (ESR) Read this in combination with the macro defintions in advebt.h.
+ /* (ESR) Read this in combination with the macro defintions in advent.h.
*/
game.objects[object].prop = PROP_STASHIFY(pval);
-#ifdef PROP_SET_SEEN
- PROP_SET_SEEN(object);
+#ifdef OBJECT_SET_SEEN
+ OBJECT_SET_SEEN(object);
#endif
}
*
* Possibly this check should be skipped whwn oldstyle is on.
*/
- if (object != BIRD)
+ if (object != BIRD) {
++game.holdng;
+ }
}
if (game.locs[where].atloc == object) {
game.locs[where].atloc = game.link[object];
if (object > NOBJECTS) {
game.objects[object - NOBJECTS].fixed = where;
} else {
- if (game.objects[object].place == CARRIED)
- if (object != BIRD)
+ if (game.objects[object].place == CARRIED) {
+ if (object != BIRD) {
/* The bird has to be weightless. This ugly
* hack (and the corresponding code in the carry
* function) brought to you by the fact that
* the right thing happen.
*/
--game.holdng;
+ }
+ }
game.objects[object].place = where;
}
if (where == LOC_NOWHERE || where == CARRIED) {