tools/game: fix dbc_to_csv false-positive string detection + clear DBC cache on expansion switch

dbc_to_csv: The string-column auto-detector would mark integer fields (e.g.
RaceID=1, SexID=0, BaseSection=0-4) as string columns whenever their small
values were valid string-block offsets that happened to land inside longer
strings.  Fix by requiring that an offset point to a string *boundary* (offset
0 or immediately after a null byte) rather than any valid position — this
eliminates false positives from integer fields whose values accidentally alias
path substrings.  Affected CSVs (CharSections, ItemDisplayInfo for Classic/TBC)
can now be regenerated correctly.

game_handler: clearDBCCache() is already called by application.cpp before
resetDbcCaches(), but also add it inside resetDbcCaches() as a defensive
measure so that future callers of resetDbcCaches() alone also flush stale
expansion-specific DBC data (CharSections, ItemDisplayInfo, etc.).
This commit is contained in:
Kelsi 2026-03-10 03:27:30 -07:00
parent 29ca9809b1
commit 4a213d8da8
2 changed files with 36 additions and 3 deletions

View file

@ -520,6 +520,13 @@ void GameHandler::resetDbcCaches() {
talentDbcLoaded_ = false;
talentCache_.clear();
talentTabCache_.clear();
// Clear the AssetManager DBC file cache so that expansion-specific DBCs
// (CharSections, ItemDisplayInfo, etc.) are reloaded from the new expansion's
// MPQ files instead of returning stale data from a previous session/expansion.
auto* am = core::Application::getInstance().getAssetManager();
if (am) {
am->clearDBCCache();
}
LOG_INFO("GameHandler: DBC caches cleared for expansion switch");
}