… | |
… | |
543 | *q = '\0'; |
543 | *q = '\0'; |
544 | |
544 | |
545 | current_type = get_typedata_by_name (p); |
545 | current_type = get_typedata_by_name (p); |
546 | if (current_type) |
546 | if (current_type) |
547 | { |
547 | { |
548 | items[i].name = current_type->name; |
548 | items[i].name = current_type->name; |
549 | items[i].typenum = current_type->number; |
549 | items[i].typenum = current_type->number; |
550 | items[i].name_pl = current_type->name_pl; |
550 | items[i].name_pl = current_type->name_pl; |
551 | } |
551 | } |
552 | else |
552 | else |
553 | { /* oh uh, something's wrong, let's free up this one, and try |
553 | { /* oh uh, something's wrong, let's free up this one, and try |
… | |
… | |
1249 | return tile_map [dir]; |
1249 | return tile_map [dir]; |
1250 | |
1250 | |
1251 | if (tile_path [dir]) |
1251 | if (tile_path [dir]) |
1252 | { |
1252 | { |
1253 | // well, try to locate it then, if possible - maybe it's there already |
1253 | // well, try to locate it then, if possible - maybe it's there already |
|
|
1254 | // this is the ONLY place in the server that links maps with each other, |
|
|
1255 | // so any kind of inter-map stuff has to be initiated here. |
1254 | if (maptile *m = find_async (tile_path [dir], this, load)) |
1256 | if (maptile *m = find_async (tile_path [dir], this, load)) |
1255 | { |
1257 | { |
1256 | bool mismatch = false; |
1258 | bool mismatch = false; |
1257 | |
1259 | |
1258 | if (dir == TILE_NORTH || dir == TILE_SOUTH || dir == TILE_UP || dir == TILE_DOWN) |
1260 | if (dir == TILE_NORTH || dir == TILE_SOUTH || dir == TILE_UP || dir == TILE_DOWN) |
… | |
… | |
1267 | { |
1269 | { |
1268 | LOG (llevError, "tile dimension mismatch for direction %d from %s to %s\n", |
1270 | LOG (llevError, "tile dimension mismatch for direction %d from %s to %s\n", |
1269 | dir, &path, &m->path); |
1271 | dir, &path, &m->path); |
1270 | m = 0; |
1272 | m = 0; |
1271 | } |
1273 | } |
1272 | |
1274 | else if (0)//D |
|
|
1275 | { |
1273 | // as an optimisation, link us against the other map if the other map |
1276 | // as an optimisation, link us against the other map if the other map |
1274 | // has us as neighbour, which is very common, but not guaranteed. |
1277 | // has us as neighbour, which is very common, but not guaranteed. |
1275 | int dir2 = REVERSE_TILE_DIR (dir); |
1278 | int dir2 = REVERSE_TILE_DIR (dir); |
1276 | |
1279 | |
1277 | if (m->tile_path [dir2] == path) |
1280 | if (m->tile_path [dir2] == path) |
1278 | m->tile_map [dir2] = this; |
1281 | m->tile_map [dir2] = this; |
|
|
1282 | } |
1279 | |
1283 | |
1280 | // this could be optimised endlessly |
|
|
1281 | //m->activate_physics (); |
|
|
1282 | |
1284 | |
1283 | return tile_map [dir] = m; |
1285 | return tile_map [dir] = m; |
1284 | } |
1286 | } |
1285 | } |
1287 | } |
1286 | |
1288 | |
… | |
… | |
1726 | if (x1 > m->width) |
1728 | if (x1 > m->width) |
1727 | { |
1729 | { |
1728 | if (maptile *tile = m->tile_available (TILE_EAST, 1)) |
1730 | if (maptile *tile = m->tile_available (TILE_EAST, 1)) |
1729 | split_to_tiles (buf, tile, max (x0 - m->width, 0), y0, x1 - m->width, y1, dx + m->width, dy); |
1731 | split_to_tiles (buf, tile, max (x0 - m->width, 0), y0, x1 - m->width, y1, dx + m->width, dy); |
1730 | |
1732 | |
1731 | if (x0 > m->width) // entirely to the right |
1733 | if (x0 >= m->width) // entirely to the right |
1732 | return; |
1734 | return; |
1733 | |
1735 | |
1734 | x1 = m->width; |
1736 | x1 = m->width; |
1735 | } |
1737 | } |
1736 | |
1738 | |
1737 | // clip to map above |
1739 | // clip to map to the north |
1738 | if (y0 < 0) |
1740 | if (y0 < 0) |
1739 | { |
1741 | { |
1740 | if (maptile *tile = m->tile_available (TILE_NORTH, 1)) |
1742 | if (maptile *tile = m->tile_available (TILE_NORTH, 1)) |
1741 | split_to_tiles (buf, tile, x0, y0 + tile->height, x1, min (y1 + tile->height, tile->height), dx, dy - tile->height); |
1743 | split_to_tiles (buf, tile, x0, y0 + tile->height, x1, min (y1 + tile->height, tile->height), dx, dy - tile->height); |
1742 | |
1744 | |
1743 | if (y1 < 0) // entirely above |
1745 | if (y1 < 0) // entirely to the north |
1744 | return; |
1746 | return; |
1745 | |
1747 | |
1746 | y0 = 0; |
1748 | y0 = 0; |
1747 | } |
1749 | } |
1748 | |
1750 | |
1749 | // clip to map below |
1751 | // clip to map to the south |
1750 | if (y1 > m->height) |
1752 | if (y1 > m->height) |
1751 | { |
1753 | { |
1752 | if (maptile *tile = m->tile_available (TILE_SOUTH, 1)) |
1754 | if (maptile *tile = m->tile_available (TILE_SOUTH, 1)) |
1753 | split_to_tiles (buf, tile, x0, max (y0 - m->height, 0), x1, y1 - m->height, dx, dy + m->height); |
1755 | split_to_tiles (buf, tile, x0, max (y0 - m->height, 0), x1, y1 - m->height, dx, dy + m->height); |
1754 | |
1756 | |
1755 | if (y0 > m->height) // entirely below |
1757 | if (y0 >= m->height) // entirely to the south |
1756 | return; |
1758 | return; |
1757 | |
1759 | |
1758 | y1 = m->height; |
1760 | y1 = m->height; |
1759 | } |
1761 | } |
1760 | |
1762 | |