cosmetic changes, quick and easy assert to prevent too many magicians.

This commit is contained in:
Enno Rehling 2014-10-30 17:48:02 +01:00
parent aa4a93435e
commit e9c13cc328
2 changed files with 8 additions and 7 deletions

View File

@ -177,11 +177,9 @@ int count)
} }
if (rtype->flags & RTF_POOLED && mode & ~(GET_SLACK | GET_RESERVE)) { if (rtype->flags & RTF_POOLED && mode & ~(GET_SLACK | GET_RESERVE)) {
for (v = r->units; v && use < count; v = v->next) for (v = r->units; v && use < count; v = v->next)
if (u != v) { if (u != v && (u->items || rtype->uget)) {
int mask; int mask;
if (v->items == NULL && rtype->uget == NULL)
continue;
if ((urace(v)->ec_flags & GIVEITEM) == 0) if ((urace(v)->ec_flags & GIVEITEM) == 0)
continue; continue;

View File

@ -1161,10 +1161,13 @@ skill *add_skill(unit * u, skill_t id)
++u->skill_size; ++u->skill_size;
u->skills = realloc(u->skills, u->skill_size * sizeof(skill)); u->skills = realloc(u->skills, u->skill_size * sizeof(skill));
sv = (u->skills + u->skill_size - 1); sv = (u->skills + u->skill_size - 1);
sv->level = (unsigned char)0; sv->level = 0;
sv->weeks = (unsigned char)1; sv->weeks = 1;
sv->old = (unsigned char)0; sv->old = 0;
sv->id = (unsigned char)id; sv->id = id;
if (id == SK_MAGIC && u->faction) {
assert(max_magicians(u->faction) >= u->number);
}
return sv; return sv;
} }