From 48141abc650e5a729544d2e57221ceeec627eefa Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 1 Jan 2005 17:14:51 +0000 Subject: [PATCH] =?UTF-8?q?Nachbesserung=20an=20Fix=20f=C3=BCr=20create=5F?= =?UTF-8?q?teleport=5Fplane?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/kernel/region.c | 10 +++++----- src/common/kernel/teleport.c | 17 +++++++++++++---- src/eressea/lua/region.cpp | 5 ++--- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/common/kernel/region.c b/src/common/kernel/region.c index 3ab4b6f0a..f24673113 100644 --- a/src/common/kernel/region.c +++ b/src/common/kernel/region.c @@ -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 diff --git a/src/common/kernel/teleport.c b/src/common/kernel/teleport.c index a92556676..ed880ace0 100644 --- a/src/common/kernel/teleport.c +++ b/src/common/kernel/teleport.c @@ -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++) { diff --git a/src/eressea/lua/region.cpp b/src/eressea/lua/region.cpp index 89ff2c6d3..a735ae889 100644 --- a/src/eressea/lua/region.cpp +++ b/src/eressea/lua/region.cpp @@ -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