forked from github/server
on a hunch, checking that number of mages is correct. Also, removing invalid familiars.
This commit is contained in:
parent
64ca5c666e
commit
2f8e9e2053
3 changed files with 1104 additions and 1074 deletions
File diff suppressed because it is too large
Load diff
|
@ -2150,7 +2150,9 @@ remove_familiar(unit *mage)
|
||||||
attrib *an;
|
attrib *an;
|
||||||
skillmod_data *smd;
|
skillmod_data *smd;
|
||||||
|
|
||||||
a_remove(&mage->attribs, a);
|
if (a!=NULL) {
|
||||||
|
a_remove(&mage->attribs, a);
|
||||||
|
}
|
||||||
a = a_find(mage->attribs, &at_skillmod);
|
a = a_find(mage->attribs, &at_skillmod);
|
||||||
while (a && a->type==&at_skillmod) {
|
while (a && a->type==&at_skillmod) {
|
||||||
an = a->next;
|
an = a->next;
|
||||||
|
|
|
@ -826,6 +826,27 @@ check_dissolve(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
check_mages(void)
|
||||||
|
{
|
||||||
|
faction * f;
|
||||||
|
for (f=factions;f!=NULL;f=f->next) {
|
||||||
|
if (f->no!=MONSTER_FACTION) {
|
||||||
|
unit * u;
|
||||||
|
int mages = 0;
|
||||||
|
int maxmages = max_skill(f, SK_MAGIC);
|
||||||
|
|
||||||
|
for (u = f->units;u!=NULL;u=u->nextF) {
|
||||||
|
if (is_mage(u) && !is_familiar(u)) ++mages;
|
||||||
|
}
|
||||||
|
if (mages>maxmages) {
|
||||||
|
log_error(("faction %s has %d of max %d magicians.\n",
|
||||||
|
factionid(u->faction), mages, maxmages));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
fix_familiars(void)
|
fix_familiars(void)
|
||||||
{
|
{
|
||||||
|
@ -843,15 +864,16 @@ fix_familiars(void)
|
||||||
char fname[64];
|
char fname[64];
|
||||||
|
|
||||||
if (mage==0) {
|
if (mage==0) {
|
||||||
log_error(("%s is a %s familiar with no mage for faction %s\n",
|
log_error(("%s was a %s familiar with no mage for faction %s\n",
|
||||||
unitid(u), racename(lang, u, u->race),
|
unitid(u), racename(lang, u, u->race),
|
||||||
factionid(u->faction)));
|
factionid(u->faction)));
|
||||||
|
a_remove(&u->attribs, a);
|
||||||
} else if (!is_mage(mage)) {
|
} else if (!is_mage(mage)) {
|
||||||
log_error(("%s is a %s familiar, but %s is not a mage for faction %s\n",
|
log_error(("%s was a %s familiar, but %s is not a mage for faction %s\n",
|
||||||
unitid(u), racename(lang, u, u->race), unitid(mage),
|
unitid(u), racename(lang, u, u->race), unitid(mage),
|
||||||
factionid(u->faction)));
|
factionid(u->faction)));
|
||||||
}
|
a_remove(&u->attribs, a);
|
||||||
if (has_skill(u, SK_MAGIC) && !is_mage(u)) {
|
} else if (has_skill(u, SK_MAGIC) && !is_mage(u)) {
|
||||||
log_error(("%s is a familiar with magic skill, but did not have a mage-attribute\n",
|
log_error(("%s is a familiar with magic skill, but did not have a mage-attribute\n",
|
||||||
unitid(u)));
|
unitid(u)));
|
||||||
create_mage(u, M_GRAU);
|
create_mage(u, M_GRAU);
|
||||||
|
@ -1022,6 +1044,7 @@ korrektur(void)
|
||||||
fix_demands();
|
fix_demands();
|
||||||
fix_otherfaction();
|
fix_otherfaction();
|
||||||
fix_familiars();
|
fix_familiars();
|
||||||
|
check_mages();
|
||||||
do_once("tfrs", &fix_resources);
|
do_once("tfrs", &fix_resources);
|
||||||
/* trade_orders(); */
|
/* trade_orders(); */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue