#include "realm/realm-names-table.h"
#include "system/player-type-definition.h"
#include "system/system-variables.h"
+#include "term/z-form.h"
#include "util/string-processor.h"
/*!
{
char *s;
s = (*sp);
- while (iswspace(*s))
+ while (iswspace(*s)) {
s++;
+ }
char *b;
b = s;
v = "0";
while (*s && (f != b2)) {
t = process_pref_file_expr(player_ptr, &s, &f);
- if (*t && !streq(t, "0"))
+ if (*t && !streq(t, "0")) {
v = "1";
+ }
}
} else if (streq(t, "AND")) {
v = "1";
while (*s && (f != b2)) {
t = process_pref_file_expr(player_ptr, &s, &f);
- if (*t && streq(t, "0"))
+ if (*t && streq(t, "0")) {
v = "0";
+ }
}
} else if (streq(t, "NOT")) {
v = "1";
while (*s && (f != b2)) {
t = process_pref_file_expr(player_ptr, &s, &f);
- if (*t && streq(t, "1"))
+ if (*t && streq(t, "1")) {
v = "0";
+ }
}
} else if (streq(t, "EQU")) {
v = "0";
}
while (*s && (f != b2)) {
p = process_pref_file_expr(player_ptr, &s, &f);
- if (streq(t, p))
+ if (streq(t, p)) {
v = "1";
+ }
}
} else if (streq(t, "LEQ")) {
v = "1";
while (*s && (f != b2)) {
p = t;
t = process_pref_file_expr(player_ptr, &s, &f);
- if (*t && atoi(p) > atoi(t))
+ if (*t && atoi(p) > atoi(t)) {
v = "0";
+ }
}
} else if (streq(t, "GEQ")) {
v = "1";
while (*s && (f != b2)) {
p = t;
t = process_pref_file_expr(player_ptr, &s, &f);
- if (*t && atoi(p) < atoi(t))
+ if (*t && atoi(p) < atoi(t)) {
v = "0";
+ }
}
} else {
while (*s && (f != b2)) {
}
}
- if (f != b2)
+ if (f != b2) {
v = "?x?x?";
+ }
- if ((f = *s) != '\0')
+ if ((f = *s) != '\0') {
*s++ = '\0';
+ }
*fp = f;
*sp = s;
/* Accept all printables except spaces and brackets */
#ifdef JP
while (iskanji(*s) || (isprint(*s) && !angband_strchr(" []", *s))) {
- if (iskanji(*s))
+ if (iskanji(*s)) {
s++;
+ }
s++;
}
#else
- while (isprint(*s) && !angband_strchr(" []", *s))
+ while (isprint(*s) && !angband_strchr(" []", *s)) {
++s;
+ }
#endif
- if ((f = *s) != '\0')
+ if ((f = *s) != '\0') {
*s++ = '\0';
+ }
if (*b != '$') {
v = b;
} else if (streq(b + 1, "GRAF")) {
v = ANGBAND_GRAF;
} else if (streq(b + 1, "MONOCHROME")) {
- if (arg_monochrome)
+ if (arg_monochrome) {
v = "ON";
- else
+ } else {
v = "OFF";
+ }
} else if (streq(b + 1, "RACE")) {
#ifdef JP
v = rp_ptr->E_title;
v = realm_names[player_ptr->realm2];
#endif
} else if (streq(b + 1, "LEVEL")) {
- sprintf(tmp, "%02d", player_ptr->lev);
+ strnfmt(tmp, sizeof(tmp), "%02d", player_ptr->lev);
v = tmp;
} else if (streq(b + 1, "AUTOREGISTER")) {
- if (player_ptr->autopick_autoregister)
+ if (player_ptr->autopick_autoregister) {
v = "1";
- else
+ } else {
v = "0";
+ }
} else if (streq(b + 1, "MONEY")) {
- sprintf(tmp, "%09ld", (long int)player_ptr->au);
+ strnfmt(tmp, sizeof(tmp), "%09ld", (long int)player_ptr->au);
v = tmp;
}