mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-25 08:30:13 +00:00
fix: clear gameObjectDisplayIdWmoCache_ on world transition, add stale-entry guard
gameObjectDisplayIdWmoCache_ was not cleared on world unload/transition, causing stale WMO model IDs (e.g. 40006, 40003) to be looked up after the renderer cleared its model list, resulting in "Cannot create instance of unloaded WMO model" errors on zone re-entry. Changes: - Clear gameObjectDisplayIdWmoCache_ alongside other GO caches on world reset - Add WMORenderer::isModelLoaded() for cache-hit validation - Inline GO WMO path now verifies cached model is still renderer-resident before using it; evicts stale entries and falls back to reload
This commit is contained in:
parent
0487d2eda6
commit
85767187b1
3 changed files with 20 additions and 2 deletions
|
|
@ -4113,6 +4113,7 @@ void Application::loadOnlineWorldTerrain(uint32_t mapId, float x, float y, float
|
|||
|
||||
gameObjectInstances_.clear();
|
||||
gameObjectDisplayIdModelCache_.clear();
|
||||
gameObjectDisplayIdWmoCache_.clear();
|
||||
gameObjectDisplayIdFailedCache_.clear();
|
||||
|
||||
// Force player character re-spawn on new map
|
||||
|
|
@ -7115,8 +7116,15 @@ void Application::spawnOnlineGameObject(uint64_t guid, uint32_t entry, uint32_t
|
|||
auto itCache = gameObjectDisplayIdWmoCache_.find(displayId);
|
||||
if (itCache != gameObjectDisplayIdWmoCache_.end()) {
|
||||
modelId = itCache->second;
|
||||
loadedAsWmo = true;
|
||||
} else {
|
||||
// Only use cached entry if the model is still resident in the renderer
|
||||
if (wmoRenderer->isModelLoaded(modelId)) {
|
||||
loadedAsWmo = true;
|
||||
} else {
|
||||
gameObjectDisplayIdWmoCache_.erase(itCache);
|
||||
modelId = 0;
|
||||
}
|
||||
}
|
||||
if (!loadedAsWmo && modelId == 0) {
|
||||
auto wmoData = assetManager->readFile(modelPath);
|
||||
if (!wmoData.empty()) {
|
||||
pipeline::WMOModel wmoModel = pipeline::WMOLoader::load(wmoData);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue