Nachbesserung an Fix für create_teleport_plane

This commit is contained in:
Enno Rehling 2005-01-01 17:14:51 +00:00
parent f15e8526b7
commit 48141abc65
3 changed files with 20 additions and 12 deletions

View File

@ -88,18 +88,18 @@ const char *
regionname(const region * r, const faction * f)
{
static char buf[65];
const struct locale * lang = f ? f->locale : 0;
plane *pl = getplane(r);
if (r==NULL) {
strcpy(buf, "(null)");
} else if (f == NULL) {
strncpy(buf, rname(r, NULL), 65);
} else if (pl && fval(pl, PFL_NOCOORDS)) {
strncpy(buf, rname(r, f->locale), 65);
strncpy(buf, rname(r, lang), 65);
} else {
#ifdef HAVE_SNPRINTF
snprintf(buf, 65, "%s (%d,%d)", rname(r, f->locale), region_x(r, f), region_y(r, f));
snprintf(buf, 65, "%s (%d,%d)", rname(r, lang),
region_x(r, f), region_y(r, f));
#else
strncpy(buf, rname(r, f->locale), 50);
strncpy(buf, rname(r, lang), 50);
buf[50]=0;
sprintf(buf+strlen(buf), " (%d,%d)", region_x(r, f), region_y(r, f));
#endif

View File

@ -199,11 +199,20 @@ create_teleport_plane(void)
for (r=regions;r;r=r->next) if (r->planep == NULL) {
region *ra = tpregion(r);
if (ra==NULL) {
ra = new_region(TE_CENTER_X+real2tp(r->x), TE_CENTER_Y+real2tp(r->y));
rsetterrain(ra, T_ASTRAL);
int x = TE_CENTER_X+real2tp(r->x);
int y = TE_CENTER_Y+real2tp(r->y);
plane * pl = findplane(x, y);
if (pl==aplane) {
ra = new_region(x, y);
rsetterrain(ra, T_ASTRAL);
ra->planep = aplane;
if (terrain[rterrain(r)].flags & FORBIDDEN_LAND) {
rsetterrain(ra, T_ASTRALB);
}
}
}
ra->planep = aplane;
if (terrain[rterrain(r)].flags & FORBIDDEN_LAND) rsetterrain(ra, T_ASTRALB);
}
for(i=0;i<4;i++) {

View File

@ -172,8 +172,8 @@ region_remove(region& r)
while (*rp) {
if (*rp==&r) {
unit * u;
for (u=r.units;u;u=u->next) {
destroy_unit(u);
while (r.units) {
destroy_unit(r.units);
}
*rp = r.next;
#ifdef FAST_CONNECT
@ -186,7 +186,6 @@ region_remove(region& r)
rn->connect[reldir] = NULL;
}
}
assert (dir>=0 && dir<MAXDIRECTIONS);
#endif
break;
}