fix: use expansion context for spline parsing; preload DBC caches at world entry

Spline parsing: remove Classic format fallback from the WotLK parser. The
PacketParsers hierarchy already dispatches to expansion-specific parsers
(Classic/TBC/WotLK/Turtle), so the WotLK parseMovementBlock should only
attempt WotLK spline format. The Classic fallback could false-positive when
durationMod bytes resembled a valid point count, corrupting downstream parsing.

Preload DBC caches: call loadSpellNameCache() and 5 other lazy DBC caches
during handleLoginVerifyWorld() on initial world entry. This moves the ~170ms
Spell.csv load from the first SMSG_SPELL_GO handler to the loading screen,
eliminating the mid-gameplay stall.

WMO portal culling: move per-instance portalVisibleGroups vector and
portalVisibleGroupSet to reusable member variables, eliminating heap
allocations per WMO instance per frame.
This commit is contained in:
Kelsi 2026-03-27 16:58:39 -07:00
parent a795239e77
commit 6f2c8962e5
5 changed files with 54 additions and 48 deletions

View file

@ -8739,6 +8739,13 @@ void GameHandler::handleLoginVerifyWorld(network::Packet& packet) {
}
}
// Pre-load DBC name caches during world entry so the first packet that
// needs spell/title/achievement data doesn't stall mid-gameplay (the
// Spell.dbc cache alone is ~170ms on a cold load).
if (initialWorldEntry) {
preloadDBCCaches();
}
// Fire PLAYER_ENTERING_WORLD — THE most important event for addon initialization.
// Fires on initial login, teleports, instance transitions, and zone changes.
if (addonEventCallback_) {
@ -21907,6 +21914,22 @@ void GameHandler::closeTrainer() {
trainerTabs_.clear();
}
void GameHandler::preloadDBCCaches() const {
LOG_INFO("Pre-loading DBC caches during world entry...");
auto t0 = std::chrono::steady_clock::now();
loadSpellNameCache(); // Spell.dbc — largest, ~170ms cold
loadTitleNameCache(); // CharTitles.dbc
loadFactionNameCache(); // Faction.dbc
loadAreaNameCache(); // WorldMapArea.dbc
loadMapNameCache(); // Map.dbc
loadLfgDungeonDbc(); // LFGDungeons.dbc
auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::steady_clock::now() - t0).count();
LOG_INFO("DBC cache pre-load complete in ", elapsed, " ms");
}
void GameHandler::loadSpellNameCache() const {
if (spellNameCacheLoaded_) return;
spellNameCacheLoaded_ = true;