--- deliantra/server/common/map.C 2011/05/07 20:03:27 1.213 +++ deliantra/server/common/map.C 2011/05/08 21:51:26 1.216 @@ -545,7 +545,7 @@ current_type = get_typedata_by_name (p); if (current_type) { - items[i].name = current_type->name; + items[i].name = current_type->name; items[i].typenum = current_type->number; items[i].name_pl = current_type->name_pl; } @@ -1251,27 +1251,36 @@ if (tile_path [dir]) { // well, try to locate it then, if possible - maybe it's there already + // this is the ONLY place in the server that links maps with each other, + // so any kind of inter-map stuff has to be initiated here. 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; } + else if (0)//D + { + // 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 (); return tile_map [dir] = m; } @@ -1721,31 +1730,31 @@ if (maptile *tile = m->tile_available (TILE_EAST, 1)) split_to_tiles (buf, tile, max (x0 - m->width, 0), y0, x1 - m->width, y1, dx + m->width, dy); - if (x0 > m->width) // entirely to the right + if (x0 >= m->width) // entirely to the right return; x1 = m->width; } - // clip to map above + // clip to map to the north if (y0 < 0) { if (maptile *tile = m->tile_available (TILE_NORTH, 1)) split_to_tiles (buf, tile, x0, y0 + tile->height, x1, min (y1 + tile->height, tile->height), dx, dy - tile->height); - if (y1 < 0) // entirely above + if (y1 < 0) // entirely to the north return; y0 = 0; } - // clip to map below + // clip to map to the south if (y1 > m->height) { if (maptile *tile = m->tile_available (TILE_SOUTH, 1)) split_to_tiles (buf, tile, x0, max (y0 - m->height, 0), x1, y1 - m->height, dx, dy + m->height); - if (y0 > m->height) // entirely below + if (y0 >= m->height) // entirely to the south return; y1 = m->height;