diff --git a/src/battle.c b/src/battle.c index 9761f2978..9608a382e 100644 --- a/src/battle.c +++ b/src/battle.c @@ -2297,7 +2297,6 @@ void do_attack(fighter * af) /* Wir suchen eine beliebige Feind-Einheit aus. An der können * wir feststellen, ob noch jemand da ist. */ int apr, attacks = attacks_per_round(ta); - assert(attacks <= RACE_ATTACKS); if (!count_enemies(b, af, FIGHT_ROW, LAST_ROW, SELECT_FIND)) break; diff --git a/src/kernel/save.c b/src/kernel/save.c index fdfe9aad9..928feedf2 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -1119,7 +1119,7 @@ void read_spellbook(spellbook **bookp, struct storage *store, int(*get_level)(co *bookp = create_spellbook(0); sb = *bookp; } - if (global.data_version >= SPELLBOOK_VERSION || !spellbook_get(sb, sp)) { + if (level>0 && (global.data_version >= SPELLBOOK_VERSION || !spellbook_get(sb, sp))) { spellbook_add(sb, sp, level); } } diff --git a/src/laws.c b/src/laws.c index 40d224e7f..f85c8c063 100755 --- a/src/laws.c +++ b/src/laws.c @@ -3772,6 +3772,10 @@ int use_cmd(unit * u, struct order *ord) init_order(ord); t = gettoken(token, sizeof(token)); + if (!t) { + cmistake(u, ord, 43, MSG_PRODUCE); + return err; + } n = atoi((const char *)t); if (n == 0) { if (isparam(t, u->faction->locale, P_ANY)) { diff --git a/src/study.c b/src/study.c index 90d838bfb..467939dbf 100644 --- a/src/study.c +++ b/src/study.c @@ -42,6 +42,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include +#include #include #include #include @@ -217,8 +218,12 @@ bool report, int *academy) } if (index < MAXTEACHERS) teach->teachers[index++] = teacher; - if (index < MAXTEACHERS) + if (index < MAXTEACHERS) { teach->teachers[index] = NULL; + } + else { + log_warning("MAXTEACHERS is too low at %d", MAXTEACHERS); + } teach->value += n; /* Solange Akademien groessenbeschraenkt sind, sollte Lehrer und diff --git a/src/study.h b/src/study.h index dce5c0b34..88a6daa5b 100644 --- a/src/study.h +++ b/src/study.h @@ -32,7 +32,7 @@ extern "C" { extern bool is_migrant(struct unit *u); extern int study_cost(struct unit *u, skill_t talent); -#define MAXTEACHERS 4 +#define MAXTEACHERS 8 typedef struct teaching_info { struct unit *teachers[MAXTEACHERS]; int value;