Bugfix "Astrale Integrität" wenn Anzahl inhab_regions == 0

This commit is contained in:
Enno Rehling 2004-02-16 20:20:18 +00:00
parent 29340f9217
commit 58595fc001
1 changed files with 30 additions and 23 deletions

View File

@ -6384,9 +6384,17 @@ sp_disruptastral(castorder *co)
for (rl2=rl; rl2!=NULL; rl2=rl2->next) {
attrib *a, *a2;
spec_direction *sd;
int inhab_regions = 0;
regionlist * trl = NULL;
if(is_cursed(rl2->region->attribs, C_ASTRALBLOCK, 0))
continue;
if (is_cursed(rl2->region->attribs, C_ASTRALBLOCK, 0)) continue;
if (rl2->region->units!=NULL) {
regionlist * trl2;
trl = allinhab_in_range(r_astral_to_standard(rl2->region), TP_RADIUS);
for (trl2 = trl; trl2; trl2 = trl2->next) ++inhab_regions;
}
/* Nicht-Permanente Tore zerstören */
a = a_find(r->attribs, &at_direction);
@ -6400,19 +6408,16 @@ sp_disruptastral(castorder *co)
/* Einheiten auswerfen */
if (trl!=NULL) {
for (u=rl2->region->units;u;u=u->next) {
if (u->race != new_race[RC_SPELL]) {
regionlist *trl, *trl2;
regionlist *trl2 = trl;
region *tr;
int c = 0;
int c = rand() % inhab_regions;
/* Zufällige Zielregion suchen */
trl = allinhab_in_range(r_astral_to_standard(rl2->region), TP_RADIUS);
for(trl2 = trl; trl2; trl2 = trl2->next) c++;
c = rand()%c;
for(trl2 = trl; trl2 && c != 0; trl2 = trl2->next) c--;
while (c--!=0) trl2 = trl2->next;
tr = trl2->region;
free_regionlist(trl);
if(!is_magic_resistant(mage, u, 0) && can_survive(u, tr)) {
move_unit(u, tr, NULL);
@ -6422,6 +6427,8 @@ sp_disruptastral(castorder *co)
}
}
}
free_regionlist(trl);
}
/* Kontakt unterbinden */
create_curse(mage, &rl2->region->attribs, ct_find("astralblock"),