Merge pull request #244 from badgerman/develop

Bug 1861 (MAXTEACHERS) and misc fixes
This commit is contained in:
Enno Rehling 2015-07-02 16:32:25 +02:00
commit 98c161869f
5 changed files with 12 additions and 4 deletions

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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)) {

View File

@ -42,6 +42,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <util/attrib.h>
#include <util/base36.h>
#include <util/language.h>
#include <util/log.h>
#include <util/parser.h>
#include <util/rand.h>
#include <util/umlaut.h>
@ -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

View File

@ -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;