mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-25 00:20:16 +00:00
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.
This commit is contained in:
parent
0c8798d6b5
commit
b2b196aa33
2 changed files with 11 additions and 6 deletions
|
|
@ -182,6 +182,8 @@ private:
|
|||
std::unordered_map<uint64_t, uint8_t> creatureWeaponAttachAttempts_; // guid -> attach attempts
|
||||
std::unordered_set<uint64_t> deadCreatureGuids_; // GUIDs that should spawn in corpse/death pose
|
||||
std::unordered_map<uint32_t, uint32_t> displayIdModelCache_; // displayId → modelId (model caching)
|
||||
mutable std::unordered_set<uint32_t> warnedMissingDisplayDataIds_; // displayIds already warned
|
||||
mutable std::unordered_set<uint32_t> warnedMissingModelPathIds_; // modelIds/displayIds already warned
|
||||
uint32_t nextCreatureModelId_ = 5000; // Model IDs for online creatures
|
||||
uint32_t gryphonDisplayId_ = 0;
|
||||
uint32_t wyvernDisplayId_ = 0;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue