fix: check loadModel return before createInstance for WMO doodads

When the M2 model cache is full (>6000 entries), loadModel() returns
false and the model is never added to the GPU cache. The WMO instance
doodad path was calling createInstanceWithMatrix() unconditionally,
generating hundreds of "Cannot create instance: model X not loaded"
warnings on zone entry. Add the same guard already present in the
terrain doodad path.
This commit is contained in:
Kelsi 2026-03-13 03:41:42 -07:00
parent 863faf9b54
commit 0487d2eda6

View file

@ -4464,7 +4464,7 @@ void Application::loadOnlineWorldTerrain(uint32_t mapId, float x, float y, float
glm::vec3 worldPos = glm::vec3(worldMatrix[3]);
uint32_t doodadModelId = static_cast<uint32_t>(std::hash<std::string>{}(m2Path));
m2Renderer->loadModel(m2Model, doodadModelId);
if (!m2Renderer->loadModel(m2Model, doodadModelId)) continue;
uint32_t doodadInstId = m2Renderer->createInstanceWithMatrix(doodadModelId, worldMatrix, worldPos);
if (doodadInstId) m2Renderer->setSkipCollision(doodadInstId, true);
loadedDoodads++;