From b2b196aa33b067ab2186218c2f4075fa8eac8c03 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Sat, 21 Feb 2026 02:43:06 -0800 Subject: [PATCH] Reduce creature spawn stutter from repeated missing-display logging - add one-time warning caches for missing CreatureDisplayInfo and missing model path lookups - log each missing displayId/model-path only once instead of every spawn retry/frame - remove duplicate empty-model-path warning in spawnOnlineCreature (already reported by lookup path) This cuts high-frequency log I/O and string formatting in hotspots when server sends unknown displayIds, while preserving first-occurrence diagnostics. --- include/core/application.hpp | 2 ++ src/core/application.cpp | 15 +++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/core/application.hpp b/include/core/application.hpp index a1d6fa53..08da7458 100644 --- a/include/core/application.hpp +++ b/include/core/application.hpp @@ -182,6 +182,8 @@ private: std::unordered_map creatureWeaponAttachAttempts_; // guid -> attach attempts std::unordered_set deadCreatureGuids_; // GUIDs that should spawn in corpse/death pose std::unordered_map displayIdModelCache_; // displayId → modelId (model caching) + mutable std::unordered_set warnedMissingDisplayDataIds_; // displayIds already warned + mutable std::unordered_set warnedMissingModelPathIds_; // modelIds/displayIds already warned uint32_t nextCreatureModelId_ = 5000; // Model IDs for online creatures uint32_t gryphonDisplayId_ = 0; uint32_t wyvernDisplayId_ = 0; diff --git a/src/core/application.cpp b/src/core/application.cpp index c3b5b758..9306bfca 100644 --- a/src/core/application.cpp +++ b/src/core/application.cpp @@ -3485,16 +3485,20 @@ std::string Application::getModelPathForDisplayId(uint32_t displayId) const { } if (displayId == 30412) return "Creature\\Gryphon\\Gryphon.m2"; if (displayId == 30413) return "Creature\\Wyvern\\Wyvern.m2"; - LOG_WARNING("No display data for displayId ", displayId, - " (displayDataMap_ has ", displayDataMap_.size(), " entries)"); + if (warnedMissingDisplayDataIds_.insert(displayId).second) { + LOG_WARNING("No display data for displayId ", displayId, + " (displayDataMap_ has ", displayDataMap_.size(), " entries)"); + } return ""; } auto itPath = modelIdToPath_.find(itData->second.modelId); if (itPath == modelIdToPath_.end()) { - LOG_WARNING("No model path for modelId ", itData->second.modelId, - " from displayId ", displayId, - " (modelIdToPath_ has ", modelIdToPath_.size(), " entries)"); + if (warnedMissingModelPathIds_.insert(displayId).second) { + LOG_WARNING("No model path for modelId ", itData->second.modelId, + " from displayId ", displayId, + " (modelIdToPath_ has ", modelIdToPath_.size(), " entries)"); + } return ""; } @@ -3629,7 +3633,6 @@ void Application::spawnOnlineCreature(uint64_t guid, uint32_t displayId, float x // Get model path from displayId std::string m2Path = getModelPathForDisplayId(displayId); if (m2Path.empty()) { - LOG_WARNING("No model path for displayId ", displayId, " (guid 0x", std::hex, guid, std::dec, ")"); return; } {