fixed problems with units that had no faction

This commit is contained in:
Enno Rehling 2006-10-23 17:21:13 +00:00
parent 94966e8eda
commit a87cc547e1
1 changed files with 10 additions and 5 deletions

View File

@ -2538,13 +2538,18 @@ remove_empty_units_in_region(region *r)
while (*up) { while (*up) {
unit * u = *up; unit * u = *up;
if (MaxAge()>0) {
if (u->number) {
faction * f = u->faction; faction * f = u->faction;
if (!fval(f, FFL_NOTIMEOUT) && f->age > MaxAge()) set_number(u, 0); if (f==NULL || !f->alive) {
}
if (u->faction && !u->faction->alive) {
set_number(u, 0); set_number(u, 0);
} }
if (MaxAge()>0) {
if ((!fval(f, FFL_NOTIMEOUT) && f->age > MaxAge())) {
set_number(u, 0);
}
}
}
if ((u->number == 0 && u->race != new_race[RC_SPELL]) || (u->age <= 0 && u->race == new_race[RC_SPELL])) { if ((u->number == 0 && u->race != new_race[RC_SPELL]) || (u->age <= 0 && u->race == new_race[RC_SPELL])) {
destroy_unit(u); destroy_unit(u);
if (u->number==0) remove_unit(u); if (u->number==0) remove_unit(u);