--- deliantra/server/common/map.C 2011/05/07 20:03:27 1.213 +++ deliantra/server/common/map.C 2011/05/08 11:32:12 1.214 @@ -1253,23 +1253,30 @@ // well, try to locate it then, if possible - maybe it's there already if (maptile *m = find_async (tile_path [dir], this, load)) { - bool match = true; + bool mismatch = false; if (dir == TILE_NORTH || dir == TILE_SOUTH || dir == TILE_UP || dir == TILE_DOWN) if (width != m->width) - match = false; + mismatch = true; if (dir == TILE_EAST || dir == TILE_WEST || dir == TILE_UP || dir == TILE_DOWN) if (height != m->height) - match = false; + mismatch = true; - if (!match) + if (mismatch) { LOG (llevError, "tile dimension mismatch for direction %d from %s to %s\n", dir, &path, &m->path); m = 0; } + // as an optimisation, link us against the other map if the other map + // has us as neighbour, which is very common, but not guaranteed. + int dir2 = REVERSE_TILE_DIR (dir); + + if (m->tile_path [dir2] == path) + m->tile_map [dir2] = this; + // this could be optimised endlessly //m->activate_physics ();