forked from github/server
Astralraum: Markieren von illegalen Astralregionen,
Verschieben von Einheiten, die in illegalen Astralregionen stehen.
This commit is contained in:
parent
d74fadc751
commit
905f5d6a0d
|
@ -98,6 +98,11 @@ typedef struct region {
|
||||||
#endif
|
#endif
|
||||||
} region;
|
} region;
|
||||||
|
|
||||||
|
typedef struct region_list {
|
||||||
|
struct region_list * next;
|
||||||
|
struct region * data;
|
||||||
|
} region_list;
|
||||||
|
|
||||||
extern struct message_list * r_getmessages(const struct region * r, const struct faction * viewer);
|
extern struct message_list * r_getmessages(const struct region * r, const struct faction * viewer);
|
||||||
extern struct message * r_addmessage(struct region * r, const struct faction * viewer, struct message * msg);
|
extern struct message * r_addmessage(struct region * r, const struct faction * viewer, struct message * msg);
|
||||||
|
|
||||||
|
|
|
@ -2611,11 +2611,56 @@ static int
|
||||||
fix_astralplane(void)
|
fix_astralplane(void)
|
||||||
{
|
{
|
||||||
plane * astralplane = getplanebyname("Astralraum");
|
plane * astralplane = getplanebyname("Astralraum");
|
||||||
|
region * r;
|
||||||
|
region_list * rlist = NULL;
|
||||||
|
|
||||||
if (astralplane) {
|
if (astralplane) {
|
||||||
freset(astralplane, PFL_NOCOORDS);
|
freset(astralplane, PFL_NOCOORDS);
|
||||||
freset(astralplane, PFL_NOFEED);
|
freset(astralplane, PFL_NOFEED);
|
||||||
set_ursprung(findfaction(MONSTER_FACTION), astralplane->id, 0, 0);
|
set_ursprung(findfaction(MONSTER_FACTION), astralplane->id, 0, 0);
|
||||||
}
|
}
|
||||||
|
for (r=regions;r;r=r->next) {
|
||||||
|
region * ra = r_standard_to_astral(r);
|
||||||
|
if (ra==NULL) continue;
|
||||||
|
if (r->terrain!=T_FIREWALL) continue;
|
||||||
|
if (ra->terrain==T_ASTRALB) continue;
|
||||||
|
if (ra->units!=NULL) {
|
||||||
|
region_list * rnew = malloc(sizeof(region_list));
|
||||||
|
rnew->data = ra;
|
||||||
|
rnew->next = rlist;
|
||||||
|
rlist = rnew;
|
||||||
|
}
|
||||||
|
terraform(ra, T_ASTRALB);
|
||||||
|
}
|
||||||
|
while (rlist) {
|
||||||
|
region_list * rnew = rlist;
|
||||||
|
region * r = rnew->data;
|
||||||
|
direction_t dir;
|
||||||
|
for (dir=0;dir!=MAXDIRECTIONS;++dir) {
|
||||||
|
region * rnext = rconnect(r, dir);
|
||||||
|
if (rnext==NULL) continue;
|
||||||
|
if (rnext->terrain!=T_ASTRAL) continue;
|
||||||
|
while (r->units) {
|
||||||
|
unit * u = r->units;
|
||||||
|
move_unit(u, rnext, NULL);
|
||||||
|
if (u->faction->no==MONSTER_FACTION) {
|
||||||
|
set_number(u, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (r->units!=NULL) {
|
||||||
|
unit * u;
|
||||||
|
for (u=r->units;u;u=u->next) {
|
||||||
|
if (u->faction->no!=MONSTER_FACTION) {
|
||||||
|
log_error(("Einheit %s in %u, %u steckt im Nebel fest.\n",
|
||||||
|
unitname(u), r->x, r->y));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(rnew);
|
||||||
|
rlist= rlist->next;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue