Use server zone ID (SMSG_INIT_WORLD_STATES) for zone music selection

In online mode, SMSG_INIT_WORLD_STATES delivers the server-authoritative
zone ID when entering a new area. Prefer this over the tile-based fallback
so music transitions are accurate for small zones (city districts, caves,
dungeon entrances) that don't align with 533-unit tile boundaries.
This commit is contained in:
Kelsi 2026-03-09 16:19:38 -07:00
parent a654dd5e99
commit 6583ce9c57

View file

@ -3040,9 +3040,12 @@ void Renderer::update(float deltaTime) {
// Update zone detection and music
if (zoneManager && musicManager && terrainManager && camera) {
// First check tile-based zone
// Prefer server-authoritative zone ID (from SMSG_INIT_WORLD_STATES);
// fall back to tile-based lookup for single-player / offline mode.
const auto* gh = core::Application::getInstance().getGameHandler();
uint32_t serverZoneId = gh ? gh->getWorldStateZoneId() : 0;
auto tile = terrainManager->getCurrentTile();
uint32_t zoneId = zoneManager->getZoneId(tile.x, tile.y);
uint32_t zoneId = (serverZoneId != 0) ? serverZoneId : zoneManager->getZoneId(tile.x, tile.y);
bool insideTavern = false;
bool insideBlacksmith = false;