… | |
… | |
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 |
… | |
… | |
1269 | { |
1269 | { |
1270 | 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", |
1271 | dir, &path, &m->path); |
1271 | dir, &path, &m->path); |
1272 | m = 0; |
1272 | m = 0; |
1273 | } |
1273 | } |
1274 | |
1274 | else if (0)//D |
|
|
1275 | { |
1275 | // 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 |
1276 | // has us as neighbour, which is very common, but not guaranteed. |
1277 | // has us as neighbour, which is very common, but not guaranteed. |
1277 | int dir2 = REVERSE_TILE_DIR (dir); |
1278 | int dir2 = REVERSE_TILE_DIR (dir); |
1278 | |
1279 | |
1279 | if (m->tile_path [dir2] == path) |
1280 | if (m->tile_path [dir2] == path) |
1280 | m->tile_map [dir2] = this; |
1281 | m->tile_map [dir2] = this; |
|
|
1282 | } |
|
|
1283 | |
1281 | |
1284 | |
1282 | return tile_map [dir] = m; |
1285 | return tile_map [dir] = m; |
1283 | } |
1286 | } |
1284 | } |
1287 | } |
1285 | |
1288 | |
… | |
… | |
1725 | if (x1 > m->width) |
1728 | if (x1 > m->width) |
1726 | { |
1729 | { |
1727 | if (maptile *tile = m->tile_available (TILE_EAST, 1)) |
1730 | if (maptile *tile = m->tile_available (TILE_EAST, 1)) |
1728 | 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); |
1729 | |
1732 | |
1730 | if (x0 > m->width) // entirely to the right |
1733 | if (x0 >= m->width) // entirely to the right |
1731 | return; |
1734 | return; |
1732 | |
1735 | |
1733 | x1 = m->width; |
1736 | x1 = m->width; |
1734 | } |
1737 | } |
1735 | |
1738 | |
1736 | // clip to map above |
1739 | // clip to map to the north |
1737 | if (y0 < 0) |
1740 | if (y0 < 0) |
1738 | { |
1741 | { |
1739 | if (maptile *tile = m->tile_available (TILE_NORTH, 1)) |
1742 | if (maptile *tile = m->tile_available (TILE_NORTH, 1)) |
1740 | 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); |
1741 | |
1744 | |
1742 | if (y1 < 0) // entirely above |
1745 | if (y1 < 0) // entirely to the north |
1743 | return; |
1746 | return; |
1744 | |
1747 | |
1745 | y0 = 0; |
1748 | y0 = 0; |
1746 | } |
1749 | } |
1747 | |
1750 | |
1748 | // clip to map below |
1751 | // clip to map to the south |
1749 | if (y1 > m->height) |
1752 | if (y1 > m->height) |
1750 | { |
1753 | { |
1751 | if (maptile *tile = m->tile_available (TILE_SOUTH, 1)) |
1754 | if (maptile *tile = m->tile_available (TILE_SOUTH, 1)) |
1752 | 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); |
1753 | |
1756 | |
1754 | if (y0 > m->height) // entirely below |
1757 | if (y0 >= m->height) // entirely to the south |
1755 | return; |
1758 | return; |
1756 | |
1759 | |
1757 | y1 = m->height; |
1760 | y1 = m->height; |
1758 | } |
1761 | } |
1759 | |
1762 | |