… | |
… | |
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 | if (maptile *m = find_async (tile_path [dir], this, load)) |
1254 | if (maptile *m = find_async (tile_path [dir], this, load)) |
1255 | { |
1255 | { |
1256 | bool match = true; |
1256 | bool mismatch = false; |
1257 | |
1257 | |
1258 | if (dir == TILE_NORTH || dir == TILE_SOUTH || dir == TILE_UP || dir == TILE_DOWN) |
1258 | if (dir == TILE_NORTH || dir == TILE_SOUTH || dir == TILE_UP || dir == TILE_DOWN) |
1259 | if (width != m->width) |
1259 | if (width != m->width) |
1260 | match = false; |
1260 | mismatch = true; |
1261 | |
1261 | |
1262 | if (dir == TILE_EAST || dir == TILE_WEST || dir == TILE_UP || dir == TILE_DOWN) |
1262 | if (dir == TILE_EAST || dir == TILE_WEST || dir == TILE_UP || dir == TILE_DOWN) |
1263 | if (height != m->height) |
1263 | if (height != m->height) |
1264 | match = false; |
1264 | mismatch = true; |
1265 | |
1265 | |
1266 | if (!match) |
1266 | if (mismatch) |
1267 | { |
1267 | { |
1268 | LOG (llevError, "tile dimension mismatch for direction %d from %s to %s\n", |
1268 | LOG (llevError, "tile dimension mismatch for direction %d from %s to %s\n", |
1269 | dir, &path, &m->path); |
1269 | dir, &path, &m->path); |
1270 | m = 0; |
1270 | m = 0; |
1271 | } |
1271 | } |
|
|
1272 | |
|
|
1273 | // 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. |
|
|
1275 | int dir2 = REVERSE_TILE_DIR (dir); |
|
|
1276 | |
|
|
1277 | if (m->tile_path [dir2] == path) |
|
|
1278 | m->tile_map [dir2] = this; |
1272 | |
1279 | |
1273 | // this could be optimised endlessly |
1280 | // this could be optimised endlessly |
1274 | //m->activate_physics (); |
1281 | //m->activate_physics (); |
1275 | |
1282 | |
1276 | return tile_map [dir] = m; |
1283 | return tile_map [dir] = m; |