Fix terrain streaming performance: revert copy back to move, remove broken cache

The previous commit changed std::move to copy for terrain/mesh data to fix
the empty-cache bug. But copying ~8 MB per tile × 81 tiles caused a 60s
streaming timeout.

The tile cache was already broken before — putCachedTile stored a shared_ptr
to the same PendingTile whose data was moved out, so cached tiles always had
empty meshes. Remove the putCachedTile call entirely; tiles re-parse from
ADT files (asset manager file cache hit) when they re-enter streaming range.

The softReset cache clear from the previous commit remains as safety for
map transitions.
This commit is contained in:
Kelsi 2026-03-02 10:15:01 -08:00
parent 335b1b1c3a
commit f5f4467565

View file

@ -912,8 +912,8 @@ bool TerrainManager::advanceFinalization(FinalizingTile& ft) {
// Commit tile to loadedTiles
auto tile = std::make_unique<TerrainTile>();
tile->coord = coord;
tile->terrain = pending->terrain; // copy (not move) — pending is cached for reuse
tile->mesh = pending->mesh; // copy (not move) — pending is cached for reuse
tile->terrain = std::move(pending->terrain);
tile->mesh = std::move(pending->mesh);
tile->loaded = true;
tile->m2InstanceIds = std::move(ft.m2InstanceIds);
tile->wmoInstanceIds = std::move(ft.wmoInstanceIds);
@ -921,7 +921,9 @@ bool TerrainManager::advanceFinalization(FinalizingTile& ft) {
tile->doodadUniqueIds = std::move(ft.tileUniqueIds);
getTileBounds(coord, tile->minX, tile->minY, tile->maxX, tile->maxY);
loadedTiles[coord] = std::move(tile);
putCachedTile(pending);
// NOTE: Don't cache pending here — std::move above empties terrain/mesh,
// so the cached tile would have 0 valid chunks on reuse. Tiles are
// re-parsed from ADT files (file-cache hit) when they re-enter range.
// Now safe to remove from pendingTiles (tile is in loadedTiles)
{