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) { for (rl2=rl; rl2!=NULL; rl2=rl2->next) {
attrib *a, *a2; attrib *a, *a2;
spec_direction *sd; spec_direction *sd;
int inhab_regions = 0;
regionlist * trl = NULL;
if(is_cursed(rl2->region->attribs, C_ASTRALBLOCK, 0)) if (is_cursed(rl2->region->attribs, C_ASTRALBLOCK, 0)) continue;
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 */ /* Nicht-Permanente Tore zerstören */
a = a_find(r->attribs, &at_direction); a = a_find(r->attribs, &at_direction);
@ -6394,34 +6402,33 @@ sp_disruptastral(castorder *co)
while (a!=NULL) { while (a!=NULL) {
a2 = a->nexttype; a2 = a->nexttype;
sd = (spec_direction *)(a->data.v); sd = (spec_direction *)(a->data.v);
if(sd->duration != -1) a_remove(&r->attribs, a); if (sd->duration != -1) a_remove(&r->attribs, a);
a = a2; a = a2;
} }
/* Einheiten auswerfen */ /* Einheiten auswerfen */
for(u=rl2->region->units;u;u=u->next) { if (trl!=NULL) {
if(u->race != new_race[RC_SPELL]) { for (u=rl2->region->units;u;u=u->next) {
regionlist *trl, *trl2; if (u->race != new_race[RC_SPELL]) {
region *tr; regionlist *trl2 = trl;
int c = 0; region *tr;
int c = rand() % inhab_regions;
/* Zufällige Zielregion suchen */ /* Zufällige Zielregion suchen */
trl = allinhab_in_range(r_astral_to_standard(rl2->region), TP_RADIUS); while (c--!=0) trl2 = trl2->next;
for(trl2 = trl; trl2; trl2 = trl2->next) c++; tr = trl2->region;
c = rand()%c;
for(trl2 = trl; trl2 && c != 0; trl2 = trl2->next) c--;
tr = trl2->region;
free_regionlist(trl);
if(!is_magic_resistant(mage, u, 0) && can_survive(u, tr)) { if(!is_magic_resistant(mage, u, 0) && can_survive(u, tr)) {
move_unit(u, tr, NULL); move_unit(u, tr, NULL);
sprintf(buf, "%s wird aus der astralen Ebene nach %s geschleudert.", sprintf(buf, "%s wird aus der astralen Ebene nach %s geschleudert.",
unitname(u), regionid(tr)); unitname(u), regionid(tr));
addmessage(0, u->faction, buf, MSG_MAGIC, ML_INFO); addmessage(0, u->faction, buf, MSG_MAGIC, ML_INFO);
} }
} }
} }
free_regionlist(trl);
}
/* Kontakt unterbinden */ /* Kontakt unterbinden */
create_curse(mage, &rl2->region->attribs, ct_find("astralblock"), create_curse(mage, &rl2->region->attribs, ct_find("astralblock"),