refactor: extract class/race restriction helpers, add DBC fallback comment

- inventory_screen: extract renderClassRestriction() and
  renderRaceRestriction() from two identical 40-line blocks in quest
  info and item info tooltips. Both used identical bitmask logic,
  strncat formatting, and player-class/race validation (-49 lines net)
- world_map: add why-comment on AreaTable.dbc fallback field indices —
  explains that incorrect indices silently return wrong data and why
  the WotLK stock layout (ID=0, Parent=2, ExploreFlag=3) is chosen
  as the safest default
This commit is contained in:
Kelsi 2026-03-30 15:45:48 -07:00
parent af604cc442
commit 4215950dcd
2 changed files with 51 additions and 100 deletions

View file

@ -281,8 +281,11 @@ void WorldMap::loadZonesFromDBC() {
}
}
// Use expansion-aware DBC layout when available; fall back to WotLK stock field
// indices (ID=0, ParentAreaNum=2, ExploreFlag=3) when layout metadata is missing.
// Incorrect field indices silently return wrong data, so these defaults must match
// the most common AreaTable.dbc layout to minimize breakage.
const auto* atL = activeLayout ? activeLayout->getLayout("AreaTable") : nullptr;
// Map areaID → its own AreaBit, and parentAreaID → list of child AreaBits
std::unordered_map<uint32_t, uint32_t> exploreFlagByAreaId;
std::unordered_map<uint32_t, std::vector<uint32_t>> childBitsByParent;
auto areaDbc = assetManager->loadDBC("AreaTable.dbc");