diff --git a/src/jsreport.c b/src/jsreport.c index 6d9f710c2..44f015053 100644 --- a/src/jsreport.c +++ b/src/jsreport.c @@ -59,9 +59,11 @@ static int report_json(const char *filename, report_context * ctx, const char *c if (sr) { terrain_t ter = oldterrain(r->terrain); if (ter == NOTERRAIN) { - log_warning("report_json: %s has no terrain id\n", r->terrain->_name); + data = 1 + r->terrain->_name[0]; + } + else { + data = 1 + (int)ter; } - data = 1 + (int)ter; } } fprintf(F, "%d", data); diff --git a/src/kernel/order.c b/src/kernel/order.c index 20cce5853..9ade22fff 100644 --- a/src/kernel/order.c +++ b/src/kernel/order.c @@ -115,7 +115,9 @@ char* get_command(const order *ord, char *sbuffer, size_t size) { assert(str); if (text) --size; bytes = (int)strlcpy(bufp, str, size); - if (wrptr(&bufp, &size, bytes) != 0) WARN_STATIC_BUFFER(); + if (wrptr(&bufp, &size, bytes) != 0) { + WARN_STATIC_BUFFER(); + } if (text) *bufp++ = ' '; } else { diff --git a/src/kernel/terrain.c b/src/kernel/terrain.c index 36efb3591..f27fe1bd0 100644 --- a/src/kernel/terrain.c +++ b/src/kernel/terrain.c @@ -127,8 +127,7 @@ const struct terrain_type *newterrain(terrain_t t) terrain_t oldterrain(const struct terrain_type * terrain) { terrain_t t; - if (terrain == NULL) - return NOTERRAIN; + assert(terrain); for (t = 0; t != MAXTERRAINS; ++t) { if (newterrains[t] == terrain) return t; diff --git a/src/reports.c b/src/reports.c index 128815f71..f086c878e 100644 --- a/src/reports.c +++ b/src/reports.c @@ -2291,7 +2291,7 @@ static void eval_race(struct opstack **stack, const void *userdata) static void eval_order(struct opstack **stack, const void *userdata) { /* order -> string */ const struct order *ord = (const struct order *)opop(stack).v; - char buf[512]; + char buf[4096]; size_t len; variant var; diff --git a/src/study.c b/src/study.c index dac5134d5..08bb749b2 100644 --- a/src/study.c +++ b/src/study.c @@ -222,7 +222,7 @@ bool report, int *academy) teach->teachers[index] = NULL; } else { - log_warning("MAXTEACHERS is too low at %d", MAXTEACHERS); + log_error("MAXTEACHERS=%d is too low for student %s, teacher %s", MAXTEACHERS, unitname(student), unitname(teacher)); } teach->value += n; diff --git a/src/study.h b/src/study.h index d4a49ab20..1feb55921 100644 --- a/src/study.h +++ b/src/study.h @@ -33,7 +33,7 @@ extern "C" { extern bool is_migrant(struct unit *u); extern int study_cost(struct unit *u, skill_t talent); -#define MAXTEACHERS 16 +#define MAXTEACHERS 20 typedef struct teaching_info { struct unit *teachers[MAXTEACHERS]; int value;