From 1e4cc2293a388b279d2174e4773ae703e9693787 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Sun, 24 Feb 2019 00:14:44 +0100 Subject: [PATCH] Core/Datastores: use generated member names for MapEntry fields * load all dbc fields of MapEntry --- src/server/game/Conditions/DisableMgr.cpp | 8 +-- src/server/game/DataStores/DBCStores.cpp | 11 +-- src/server/game/DataStores/DBCStructure.h | 68 +++++++++---------- src/server/game/DataStores/DBCfmt.h | 2 +- src/server/game/Entities/Player/Player.cpp | 4 +- src/server/game/Entities/Unit/Unit.cpp | 2 +- src/server/game/Globals/ObjectMgr.cpp | 26 +++---- src/server/game/Globals/ObjectMgr.h | 2 +- src/server/game/Groups/Group.cpp | 4 +- src/server/game/Groups/GroupMgr.cpp | 2 +- src/server/game/Handlers/MiscHandler.cpp | 4 +- src/server/game/Handlers/MovementHandler.cpp | 8 +-- src/server/game/Handlers/QueryHandler.cpp | 10 +-- src/server/game/Instances/InstanceSaveMgr.cpp | 6 +- src/server/game/Maps/Map.cpp | 10 +-- src/server/game/Maps/MapManager.cpp | 16 ++--- src/server/game/Scripting/ScriptMgr.cpp | 2 +- src/server/game/Spells/SpellInfo.cpp | 2 +- src/server/game/World/World.cpp | 6 +- src/server/scripts/Commands/cs_debug.cpp | 20 +++--- src/server/scripts/Commands/cs_lookup.cpp | 4 +- src/server/scripts/Commands/cs_misc.cpp | 4 +- src/server/scripts/Commands/cs_modify.cpp | 2 +- src/server/scripts/Pet/pet_generic.cpp | 2 +- src/tools/mmaps_generator/MapBuilder.cpp | 6 ++ 25 files changed, 120 insertions(+), 111 deletions(-) diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp index 9cbf062a63b..b1b402ceda2 100644 --- a/src/server/game/Conditions/DisableMgr.cpp +++ b/src/server/game/Conditions/DisableMgr.cpp @@ -130,7 +130,7 @@ void LoadDisables() continue; } bool isFlagInvalid = false; - switch (mapEntry->map_type) + switch (mapEntry->MapType) { case MAP_COMMON: if (flags) @@ -194,7 +194,7 @@ void LoadDisables() TC_LOG_ERROR("sql.sql", "Map entry %u from `disables` doesn't exist in dbc, skipped.", entry); continue; } - switch (mapEntry->map_type) + switch (mapEntry->MapType) { case MAP_COMMON: if (flags & VMAP::VMAP_DISABLE_AREAFLAG) @@ -234,7 +234,7 @@ void LoadDisables() TC_LOG_ERROR("sql.sql", "Map entry %u from `disables` doesn't exist in dbc, skipped.", entry); continue; } - switch (mapEntry->map_type) + switch (mapEntry->MapType) { case MAP_COMMON: TC_LOG_INFO("misc", "Pathfinding disabled for world map %u.", entry); @@ -369,7 +369,7 @@ bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags return (disabledModes & RAID_STATUSFLAG_25MAN_HEROIC) != 0; } } - else if (mapEntry->map_type == MAP_COMMON) + else if (mapEntry->MapType == MAP_COMMON) return true; } return false; diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index bc5a9b43ca6..eeb8519ac24 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -902,8 +902,8 @@ ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId) return CONTENT_1_60; // no need enum all maps from phasing - if (mapEntry->rootPhaseMap >= 0) - mapid = mapEntry->rootPhaseMap; + if (mapEntry->ParentMapID >= 0) + mapid = mapEntry->ParentMapID; switch (mapid) { @@ -1274,9 +1274,12 @@ SkillRaceClassInfoEntry const* GetSkillRaceClassInfo(uint32 skill, uint8 race, u std::vector const* GetPhasesForGroup(uint32 group) { - return &sPhasesByGroup[group]; -} + auto itr = sPhasesByGroup.find(group); + if (itr != sPhasesByGroup.end()) + return &itr->second; + return nullptr; +} ResponseCodes ValidateName(std::wstring const& name, LocaleConstant locale) { if (locale >= TOTAL_LOCALES) diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index 430ee77af9c..142c48be7ca 100644 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -1647,52 +1647,52 @@ struct MailTemplateEntry struct MapEntry { - uint32 MapID; // 0 - //char* internalname; // 1 unused - uint32 map_type; // 2 - uint32 Flags; // 3 - //uint32 unk4; // 4 4.0.1 - //uint32 isPvP; // 5 m_PVP 0 or 1 for battlegrounds (not arenas) - char* name; // 6 m_MapName_lang - uint32 linked_zone; // 7 m_areaTableID - //char* hordeIntro; // 8 m_MapDescription0_lang - //char* allianceIntro; // 9 m_MapDescription1_lang - uint32 multimap_id; // 10 m_LoadingScreenID (LoadingScreens.dbc) - //float BattlefieldMapIconScale; // 11 m_minimapIconScale - int32 entrance_map; // 12 m_corpseMapID map_id of entrance map in ghost mode (continent always and in most cases = normal entrance) - float entrance_x; // 13 m_corpseX entrance x coordinate in ghost mode (in most cases = normal entrance) - float entrance_y; // 14 m_corpseY entrance y coordinate in ghost mode (in most cases = normal entrance) - //uint32 timeOfDayOverride; // 15 m_timeOfDayOverride - uint32 addon; // 16 m_expansionID - uint32 expireTime; // 17 m_raidOffset - uint32 maxPlayers; // 18 m_maxPlayers - int32 rootPhaseMap; // 19 new 4.0.0, mapid, related to phasing + uint32 ID; // 0 MapID + char const* Directory; // 1 m_internalName + uint32 MapType; // 2 m_mapType + uint32 Flags; // 3 m_mapFlags + uint32 InstanceType; // 4 instance_type + uint32 IsPvP; // 5 m_PVP 0 or 1 for battlegrounds (not arenas) + char const* Name; // 6 m_MapName_lang + uint32 AreaTableID; // 7 m_areaTableID + char const* MapDescription0; // 8 m_MapDescription0_lang Horde + char const* MapDescription1; // 9 m_MapDescription1_lang Alliance + uint32 LoadingScreenID; // 10 m_LoadingScreenID (LoadingScreens.dbc) + float MinimapIconScale; // 11 m_minimapIconScale + int32 CorpseMapID; // 12 m_corpseMapID map_id of entrance map in ghost mode (continent always and in most cases = normal entrance) + DBCPosition2D Corpse; // 13 - 14 entrance coordinates in ghost mode (in most cases = normal entrance) + uint32 TimeOfDayOverride; // 15 m_timeOfDayOverride + uint32 ExpansionID; // 16 m_expansionID + uint32 RaidOffset; // 17 m_raidOffset + uint32 MaxPlayers; // 18 m_maxPlayers + int32 ParentMapID; // 19 // Helpers - uint32 Expansion() const { return addon; } + uint32 Expansion() const { return ExpansionID; } - bool IsDungeon() const { return map_type == MAP_INSTANCE || map_type == MAP_RAID; } - bool IsNonRaidDungeon() const { return map_type == MAP_INSTANCE; } - bool Instanceable() const { return map_type == MAP_INSTANCE || map_type == MAP_RAID || map_type == MAP_BATTLEGROUND || map_type == MAP_ARENA; } - bool IsRaid() const { return map_type == MAP_RAID; } - bool IsBattleground() const { return map_type == MAP_BATTLEGROUND; } - bool IsBattleArena() const { return map_type == MAP_ARENA; } - bool IsBattlegroundOrArena() const { return map_type == MAP_BATTLEGROUND || map_type == MAP_ARENA; } - bool IsWorldMap() const { return map_type == MAP_COMMON; } + bool IsDungeon() const { return MapType == MAP_INSTANCE || MapType == MAP_RAID; } + bool IsNonRaidDungeon() const { return MapType == MAP_INSTANCE; } + bool Instanceable() const { return MapType == MAP_INSTANCE || MapType == MAP_RAID || MapType == MAP_BATTLEGROUND || MapType == MAP_ARENA; } + bool IsRaid() const { return MapType == MAP_RAID; } + bool IsBattleground() const { return MapType == MAP_BATTLEGROUND; } + bool IsBattleArena() const { return MapType == MAP_ARENA; } + bool IsBattlegroundOrArena() const { return MapType == MAP_BATTLEGROUND || MapType == MAP_ARENA; } + bool IsWorldMap() const { return MapType == MAP_COMMON; } bool GetEntrancePos(int32 &mapid, float &x, float &y) const { - if (entrance_map < 0) + if (CorpseMapID < 0) return false; - mapid = entrance_map; - x = entrance_x; - y = entrance_y; + + mapid = CorpseMapID; + x = Corpse.X; + y = Corpse.Y; return true; } bool IsContinent() const { - return MapID == 0 || MapID == 1 || MapID == 530 || MapID == 571; + return ID == 0 || ID == 1 || ID == 530 || ID == 571; } bool IsDynamicDifficultyMap() const { return (Flags & MAP_FLAG_DYNAMIC_DIFFICULTY) != 0; } diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h index fd8f15998e6..3fa1d53cf68 100644 --- a/src/server/game/DataStores/DBCfmt.h +++ b/src/server/game/DataStores/DBCfmt.h @@ -109,7 +109,7 @@ char const LockEntryfmt[] = "niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx"; char const PhaseEntryfmt[] = "nsi"; char const PhaseGroupfmt[] = "nii"; char const MailTemplateEntryfmt[] = "nxs"; -char const MapEntryfmt[] = "nxiixxsixxixiffxiiii"; +char const MapEntryfmt[] = "nsiiiisissififfiiiii"; char const MapDifficultyEntryfmt[] = "diisiix"; char const MovieEntryfmt[] = "nxxx"; char const NamesProfanityEntryfmt[] = "dsi"; diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index cbe6eaed42e..6c3526319fe 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -19345,7 +19345,7 @@ void Player::_LoadBoundInstances(PreparedQueryResult result) bool deleteInstance = false; MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); - std::string mapname = mapEntry ? mapEntry->name : "Unknown"; + std::string mapname = mapEntry ? mapEntry->Name : "Unknown"; if (!mapEntry || !mapEntry->IsDungeon()) { @@ -21148,7 +21148,7 @@ void Player::ResetInstances(uint8 method, bool isRaid) if (method == INSTANCE_RESET_ALL) { // the "reset all instances" method can only reset normal maps - if (entry->map_type == MAP_RAID || diff == DUNGEON_DIFFICULTY_HEROIC) + if (entry->MapType == MAP_RAID || diff == DUNGEON_DIFFICULTY_HEROIC) { ++itr; continue; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 501ca8992ba..6c32c58232e 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -8319,7 +8319,7 @@ MountCapabilityEntry const* Unit::GetMountCapability(uint32 mountType) const if (mountCapability->RequiredMap != -1 && int32(GetMapId()) != mountCapability->RequiredMap && - GetMap()->GetEntry()->rootPhaseMap != mountCapability->RequiredMap) + GetMap()->GetEntry()->ParentMapID != mountCapability->RequiredMap) continue; if (mountCapability->RequiredArea && !IsInArea(areaId, mountCapability->RequiredArea)) diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 64ae3180156..5ed57030dc3 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -2148,7 +2148,7 @@ void ObjectMgr::LoadCreatures() TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u Entry: %u) with `terrainSwapMap` %u does not exist, set to -1", guid, data.id, data.terrainSwapMap); data.terrainSwapMap = -1; } - else if (terrainSwapEntry->rootPhaseMap != int32(data.spawnPoint.GetMapId())) + else if (terrainSwapEntry->ParentMapID != int32(data.spawnPoint.GetMapId())) { TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u Entry: %u) with `terrainSwapMap` %u which cannot be used on spawn map, set to -1", guid, data.id, data.terrainSwapMap); data.terrainSwapMap = -1; @@ -2465,7 +2465,7 @@ void ObjectMgr::LoadGameObjects() TC_LOG_ERROR("sql.sql", "Table `gameobject` have gameobject (GUID: %u Entry: %u) with `terrainSwapMap` %u does not exist, set to -1", guid, data.id, data.terrainSwapMap); data.terrainSwapMap = -1; } - else if (terrainSwapEntry->rootPhaseMap != int32(data.spawnPoint.GetMapId())) + else if (terrainSwapEntry->ParentMapID != int32(data.spawnPoint.GetMapId())) { TC_LOG_ERROR("sql.sql", "Table `gameobject` have gameobject (GUID: %u Entry: %u) with `terrainSwapMap` %u which cannot be used on spawn map, set to -1", guid, data.id, data.terrainSwapMap); data.terrainSwapMap = -1; @@ -6823,18 +6823,18 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveyard(WorldLocation const& lo if (!sConditionMgr->IsObjectMeetingNotGroupedConditions(CONDITION_SOURCE_TYPE_GRAVEYARD, data.safeLocId, conditionSource)) continue; - if (int16(entry->map_id) == mapEntry->rootPhaseMap && !conditionObject->GetPhaseShift().HasVisibleMapId(entry->map_id)) + if (int16(entry->map_id) == mapEntry->ParentMapID && !conditionObject->GetPhaseShift().HasVisibleMapId(entry->map_id)) continue; } // find now nearest graveyard at other map - if (MapId != entry->map_id && int16(entry->map_id) != mapEntry->rootPhaseMap) + if (MapId != entry->map_id && int16(entry->map_id) != mapEntry->ParentMapID) { // if find graveyard at different map from where entrance placed (or no entrance data), use any first if (!mapEntry - || mapEntry->entrance_map < 0 - || uint32(mapEntry->entrance_map) != entry->map_id - || (mapEntry->entrance_x == 0 && mapEntry->entrance_y == 0)) + || mapEntry->CorpseMapID < 0 + || uint32(mapEntry->CorpseMapID) != entry->map_id + || (mapEntry->Corpse.X == 0 && mapEntry->Corpse.Y == 0)) { // not have any corrdinates for check distance anyway entryFar = entry; @@ -6842,8 +6842,8 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveyard(WorldLocation const& lo } // at entrance map calculate distance (2D); - float dist2 = (entry->x - mapEntry->entrance_x)*(entry->x - mapEntry->entrance_x) - +(entry->y - mapEntry->entrance_y)*(entry->y - mapEntry->entrance_y); + float dist2 = (entry->x - mapEntry->Corpse.X)*(entry->x - mapEntry->Corpse.X) + +(entry->y - mapEntry->Corpse.Y)*(entry->y - mapEntry->Corpse.Y); if (foundEntr) { if (dist2 < distEntr) @@ -7150,7 +7150,7 @@ AreaTriggerStruct const* ObjectMgr::GetGoBackTrigger(uint32 Map) const bool useParentDbValue = false; uint32 parentId = 0; MapEntry const* mapEntry = sMapStore.LookupEntry(Map); - if (!mapEntry || mapEntry->entrance_map < 0) + if (!mapEntry || mapEntry->CorpseMapID < 0) return nullptr; if (mapEntry->IsDungeon()) @@ -7164,7 +7164,7 @@ AreaTriggerStruct const* ObjectMgr::GetGoBackTrigger(uint32 Map) const useParentDbValue = true; } - uint32 entrance_map = uint32(mapEntry->entrance_map); + uint32 entrance_map = uint32(mapEntry->CorpseMapID); for (AreaTriggerContainer::const_iterator itr = _areaTriggerStore.begin(); itr != _areaTriggerStore.end(); ++itr) if ((!useParentDbValue && itr->second.target_mapId == entrance_map) || (useParentDbValue && itr->second.target_mapId == parentId)) { @@ -10057,8 +10057,8 @@ void ObjectMgr::LoadPhases() _phaseInfoById.emplace(std::make_pair(phase->ID, PhaseInfoStruct{ phase->ID, std::unordered_set{} })); for (MapEntry const* map : sMapStore) - if (map->rootPhaseMap != -1) - _terrainSwapInfoById.emplace(std::make_pair(map->MapID, TerrainSwapInfo{ map->MapID, std::vector{} })); + if (map->ParentMapID != -1) + _terrainSwapInfoById.emplace(std::make_pair(map->ID, TerrainSwapInfo{ map->ID, std::vector{} })); TC_LOG_INFO("server.loading", "Loading Terrain World Map definitions..."); LoadTerrainWorldMaps(); diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 927cde40c91..e81448d344c 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -1665,7 +1665,7 @@ class TC_GAME_API ObjectMgr TerrainSwapInfo const* GetTerrainSwapInfo(uint32 terrainSwapId) const; std::unordered_map> const& GetTerrainSwaps() const { return _terrainSwapInfoByMap; } - private: + private: std::unordered_map _phaseInfoById; std::unordered_map _terrainSwapInfoById; std::unordered_map> _phaseInfoByArea; diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 2a31e08f264..ed53f6fd5fe 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -2299,7 +2299,7 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo) if (method == INSTANCE_RESET_ALL) { // the "reset all instances" method can only reset normal maps - if (entry->map_type == MAP_RAID || diff == DUNGEON_DIFFICULTY_HEROIC) + if (entry->MapType == MAP_RAID || diff == DUNGEON_DIFFICULTY_HEROIC) { ++itr; continue; @@ -2384,7 +2384,7 @@ InstanceGroupBind* Group::GetBoundInstance(MapEntry const* mapEntry) return nullptr; Difficulty difficulty = GetDifficulty(mapEntry->IsRaid()); - return GetBoundInstance(difficulty, mapEntry->MapID); + return GetBoundInstance(difficulty, mapEntry->ID); } InstanceGroupBind* Group::GetBoundInstance(Difficulty difficulty, uint32 mapId) diff --git a/src/server/game/Groups/GroupMgr.cpp b/src/server/game/Groups/GroupMgr.cpp index db212b9e3f9..4296c2c41c2 100644 --- a/src/server/game/Groups/GroupMgr.cpp +++ b/src/server/game/Groups/GroupMgr.cpp @@ -237,7 +237,7 @@ void GroupMgr::LoadGroups() diff = 0; // default for both difficaly types } - InstanceSave* save = sInstanceSaveMgr->AddInstanceSave(mapEntry->MapID, fields[2].GetUInt32(), Difficulty(diff), time_t(fields[5].GetUInt32()), fields[6].GetUInt64() == 0, true); + InstanceSave* save = sInstanceSaveMgr->AddInstanceSave(mapEntry->ID, fields[2].GetUInt32(), Difficulty(diff), time_t(fields[5].GetUInt32()), fields[6].GetUInt64() == 0, true); group->BindToInstance(save, fields[3].GetBool(), true); ++count; } diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index f447f702928..5ca5c78a300 100644 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -740,7 +740,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recvData) case Map::CANNOT_ENTER_DIFFICULTY_UNAVAILABLE: TC_LOG_DEBUG("maps", "MAP: Player '%s' attempted to enter instance map %d but the requested difficulty was not found", player->GetName().c_str(), at->target_mapId); if (MapEntry const* entry = sMapStore.LookupEntry(at->target_mapId)) - player->SendTransferAborted(entry->MapID, TRANSFER_ABORT_DIFFICULTY, player->GetDifficulty(entry->IsRaid())); + player->SendTransferAborted(entry->ID, TRANSFER_ABORT_DIFFICULTY, player->GetDifficulty(entry->IsRaid())); break; case Map::CANNOT_ENTER_NOT_IN_RAID: { @@ -762,7 +762,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recvData) case Map::CANNOT_ENTER_INSTANCE_BIND_MISMATCH: if (MapEntry const* entry = sMapStore.LookupEntry(at->target_mapId)) { - char const* mapName = entry->name; + char const* mapName = entry->Name; TC_LOG_DEBUG("maps", "MAP: Player '%s' cannot enter instance map '%s' because their permanent bind is incompatible with their group's", player->GetName().c_str(), mapName); // is there a special opcode for this? // @todo figure out how to get player localized difficulty string (e.g. "10 player", "Heroic" etc) diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp index 87498255b1e..a4337dbaf90 100644 --- a/src/server/game/Handlers/MovementHandler.cpp +++ b/src/server/game/Handlers/MovementHandler.cpp @@ -161,7 +161,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() // resurrect character at enter into instance where his corpse exist after add to map if (mEntry->IsDungeon() && !GetPlayer()->IsAlive()) - if (GetPlayer()->GetCorpseLocation().GetMapId() == mEntry->MapID) + if (GetPlayer()->GetCorpseLocation().GetMapId() == mEntry->ID) { GetPlayer()->ResurrectPlayer(0.5f, false); GetPlayer()->SpawnCorpseBones(); @@ -172,14 +172,14 @@ void WorldSession::HandleMoveWorldportAckOpcode() { // check if this instance has a reset time and send it to player if so Difficulty diff = newMap->GetDifficulty(); - if (MapDifficulty const* mapDiff = GetMapDifficultyData(mEntry->MapID, diff)) + if (MapDifficulty const* mapDiff = GetMapDifficultyData(mEntry->ID, diff)) { if (mapDiff->resetTime) { - if (time_t timeReset = sInstanceSaveMgr->GetResetTimeFor(mEntry->MapID, diff)) + if (time_t timeReset = sInstanceSaveMgr->GetResetTimeFor(mEntry->ID, diff)) { uint32 timeleft = uint32(timeReset - time(nullptr)); - GetPlayer()->SendInstanceResetWarning(mEntry->MapID, diff, timeleft, true); + GetPlayer()->SendInstanceResetWarning(mEntry->ID, diff, timeleft, true); } } } diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index aa915d7f2a9..87c4e4c57d5 100644 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -262,14 +262,14 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket& /*recvData*/) // search entrance map for proper show entrance if (MapEntry const* corpseMapEntry = sMapStore.LookupEntry(mapID)) { - if (corpseMapEntry->IsDungeon() && corpseMapEntry->entrance_map >= 0) + if (corpseMapEntry->IsDungeon() && corpseMapEntry->CorpseMapID >= 0) { // if corpse map have entrance - if (Map const* entranceMap = sMapMgr->CreateBaseMap(corpseMapEntry->entrance_map)) + if (Map const* entranceMap = sMapMgr->CreateBaseMap(corpseMapEntry->CorpseMapID)) { - mapID = corpseMapEntry->entrance_map; - x = corpseMapEntry->entrance_x; - y = corpseMapEntry->entrance_y; + mapID = corpseMapEntry->CorpseMapID; + x = corpseMapEntry->Corpse.X; + y = corpseMapEntry->Corpse.Y; z = entranceMap->GetHeight(GetPlayer()->GetPhaseShift(), x, y, MAX_HEIGHT); } } diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index a07d9700b12..edbadb6616e 100644 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -101,7 +101,7 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance { // initialize reset time // for normal instances if no creatures are killed the instance will reset in two hours - if (entry->map_type == MAP_RAID || difficulty > DUNGEON_DIFFICULTY_NORMAL) + if (entry->MapType == MAP_RAID || difficulty > DUNGEON_DIFFICULTY_NORMAL) resetTime = GetResetTimeFor(mapId, difficulty); else { @@ -222,7 +222,7 @@ time_t InstanceSave::GetResetTimeForDB() { // only save the reset time for normal instances MapEntry const* entry = sMapStore.LookupEntry(GetMapId()); - if (!entry || entry->map_type == MAP_RAID || GetDifficulty() == DUNGEON_DIFFICULTY_HEROIC) + if (!entry || entry->MapType == MAP_RAID || GetDifficulty() == DUNGEON_DIFFICULTY_HEROIC) return 0; else return GetResetTime(); @@ -631,7 +631,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b MapEntry const* mapEntry = sMapStore.LookupEntry(mapid); if (!mapEntry->Instanceable()) return; - TC_LOG_DEBUG("misc", "InstanceSaveManager::ResetOrWarnAll: Processing map %s (%u) on difficulty %u (warn? %u)", mapEntry->name, mapid, uint8(difficulty), warn); + TC_LOG_DEBUG("misc", "InstanceSaveManager::ResetOrWarnAll: Processing map %s (%u) on difficulty %u (warn? %u)", mapEntry->Name, mapid, uint8(difficulty), warn); time_t now = time(nullptr); diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index ed77002542c..9dde3d4f18d 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -2523,7 +2523,7 @@ uint32 Map::GetAreaId(PhaseShift const& phaseShift, float x, float y, float z) c areaId = gridAreaId; if (!areaId) - areaId = i_mapEntry->linked_zone; + areaId = i_mapEntry->AreaTableID; return areaId; } @@ -2701,7 +2701,7 @@ void Map::GetFullTerrainStatusForPosition(PhaseShift const& phaseShift, float x, } if (!data.areaId) - data.areaId = i_mapEntry->linked_zone; + data.areaId = i_mapEntry->AreaTableID; AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(data.areaId); @@ -2829,7 +2829,7 @@ bool Map::CheckGridIntegrity(Creature* c, bool moved) const char const* Map::GetMapName() const { - return i_mapEntry ? i_mapEntry->name : "UNNAMEDMAP\x0"; + return i_mapEntry ? i_mapEntry->Name : "UNNAMEDMAP\x0"; } void Map::SendInitSelf(Player* player) @@ -4119,7 +4119,7 @@ bool Map::Is25ManRaid() const uint32 Map::GetId() const { - return i_mapEntry->MapID; + return i_mapEntry->ID; } bool Map::IsRegularDifficulty() const @@ -4162,7 +4162,7 @@ uint32 InstanceMap::GetMaxPlayers() const if (mapDiff && mapDiff->maxPlayers) return mapDiff->maxPlayers; - return GetEntry()->maxPlayers; + return GetEntry()->MaxPlayers; } uint32 InstanceMap::GetMaxResetDelay() const diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index f1bde63a3ad..28878f381cb 100644 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -80,9 +80,9 @@ Map* MapManager::CreateBaseMap(uint32 id) if (!map) { MapEntry const* entry = sMapStore.AssertEntry(id); - if (entry->rootPhaseMap != -1) + if (entry->ParentMapID != -1) { - CreateBaseMap(entry->rootPhaseMap); + CreateBaseMap(entry->ParentMapID); // must have been created by parent map map = FindBaseMap(id); @@ -101,17 +101,17 @@ Map* MapManager::CreateBaseMap_i(MapEntry const* mapEntry) { Map* map; if (mapEntry->Instanceable()) - map = new MapInstanced(mapEntry->MapID, i_gridCleanUpDelay); + map = new MapInstanced(mapEntry->ID, i_gridCleanUpDelay); else { - map = new Map(mapEntry->MapID, i_gridCleanUpDelay, 0, REGULAR_DIFFICULTY); + map = new Map(mapEntry->ID, i_gridCleanUpDelay, 0, REGULAR_DIFFICULTY); map->LoadRespawnTimes(); map->LoadCorpseData(); } - i_maps[mapEntry->MapID] = map; + i_maps[mapEntry->ID] = map; - for (uint32 childMapId : _parentMapData[mapEntry->MapID]) + for (uint32 childMapId : _parentMapData[mapEntry->ID]) map->AddChildTerrainMap(CreateBaseMap_i(sMapStore.AssertEntry(childMapId))); return map; @@ -163,7 +163,7 @@ Map::EnterState MapManager::PlayerCannotEnter(uint32 mapid, Player* player, bool Difficulty targetDifficulty, requestedDifficulty; targetDifficulty = requestedDifficulty = player->GetDifficulty(entry->IsRaid()); // Get the highest available difficulty if current setting is higher than the instance allows - MapDifficulty const* mapDiff = GetDownscaledMapDifficultyData(entry->MapID, targetDifficulty); + MapDifficulty const* mapDiff = GetDownscaledMapDifficultyData(entry->ID, targetDifficulty); if (!mapDiff) return Map::CANNOT_ENTER_DIFFICULTY_UNAVAILABLE; @@ -171,7 +171,7 @@ Map::EnterState MapManager::PlayerCannotEnter(uint32 mapid, Player* player, bool if (player->IsGameMaster()) return Map::CAN_ENTER; - char const* mapName = entry->name; + char const* mapName = entry->Name; Group* group = player->GetGroup(); if (entry->IsRaid()) // can only enter in a raid group diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index c877268a7b4..0ddf5689cae 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -1376,7 +1376,7 @@ void ScriptMgr::OnGroupRateCalculation(float& rate, uint32 count, bool isRaid) MapEntry const* C = I->second->GetEntry(); \ if (!C) \ continue; \ - if (C->MapID == V->GetId()) \ + if (C->ID == V->GetId()) \ { #define SCR_MAP_END \ diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 7e807a1299c..502d9d9fedf 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1654,7 +1654,7 @@ SpellCastResult SpellInfo::CheckLocation(uint32 map_id, uint32 zone_id, uint32 a uint32 v_map = GetVirtualMapForMapAndZone(map_id, zone_id); MapEntry const* mapEntry = sMapStore.LookupEntry(v_map); - if (!mapEntry || mapEntry->addon < 1 || !mapEntry->IsContinent()) + if (!mapEntry || mapEntry->ExpansionID < 1 || !mapEntry->IsContinent()) return SPELL_FAILED_INCORRECT_AREA; } diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 0fff2220ace..544a32b61ea 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1641,9 +1641,9 @@ void World::SetInitialWorldSettings() std::unordered_map> mapData; for (MapEntry const* mapEntry : sMapStore) { - mapData.emplace(std::piecewise_construct, std::forward_as_tuple(mapEntry->MapID), std::forward_as_tuple()); - if (mapEntry->rootPhaseMap != -1) - mapData[mapEntry->rootPhaseMap].push_back(mapEntry->MapID); + mapData.emplace(std::piecewise_construct, std::forward_as_tuple(mapEntry->ID), std::forward_as_tuple()); + if (mapEntry->ParentMapID != -1) + mapData[mapEntry->ParentMapID].push_back(mapEntry->ID); } sMapMgr->InitializeParentMapData(mapData); diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index bb8c183e35b..fada070d3ba 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -1530,7 +1530,7 @@ public: } if (!mEntry->IsDungeon()) { - handler->PSendSysMessage("'%s' is not a dungeon map.", mEntry->name[LOCALE_enUS]); + handler->PSendSysMessage("'%s' is not a dungeon map.", mEntry->Name[LOCALE_enUS]); return true; } int32 difficulty = difficulty_str ? atoi(difficulty_str) : -1; @@ -1539,32 +1539,32 @@ public: handler->PSendSysMessage("Invalid difficulty %d - specify in range [0,%d).", difficulty, MAX_RAID_DIFFICULTY); return false; } - if (difficulty >= 0 && !GetMapDifficultyData(mEntry->MapID, Difficulty(difficulty))) + if (difficulty >= 0 && !GetMapDifficultyData(mEntry->ID, Difficulty(difficulty))) { - handler->PSendSysMessage("Difficulty %d is not valid for '%s'.", difficulty, mEntry->name[LOCALE_enUS]); + handler->PSendSysMessage("Difficulty %d is not valid for '%s'.", difficulty, mEntry->Name[LOCALE_enUS]); return true; } if (difficulty == -1) { - handler->PSendSysMessage("Resetting all difficulties for '%s'.", mEntry->name[LOCALE_enUS]); + handler->PSendSysMessage("Resetting all difficulties for '%s'.", mEntry->Name[LOCALE_enUS]); for (uint8 diff = (mEntry->IsRaid() ? 0 : 1); diff < (mEntry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY); ++diff) { - if (GetMapDifficultyData(mEntry->MapID, Difficulty(diff))) + if (GetMapDifficultyData(mEntry->ID, Difficulty(diff))) { - handler->PSendSysMessage("Resetting difficulty %d for '%s'.", diff, mEntry->name[LOCALE_enUS]); - sInstanceSaveMgr->ForceGlobalReset(mEntry->MapID, Difficulty(diff)); + handler->PSendSysMessage("Resetting difficulty %d for '%s'.", diff, mEntry->Name[LOCALE_enUS]); + sInstanceSaveMgr->ForceGlobalReset(mEntry->ID, Difficulty(diff)); } } } else if (mEntry->IsNonRaidDungeon() && difficulty == DUNGEON_DIFFICULTY_NORMAL) { - handler->PSendSysMessage("'%s' does not have any permanent saves for difficulty %d.", mEntry->name[LOCALE_enUS], difficulty); + handler->PSendSysMessage("'%s' does not have any permanent saves for difficulty %d.", mEntry->Name[LOCALE_enUS], difficulty); } else { - handler->PSendSysMessage("Resetting difficulty %d for '%s'.", difficulty, mEntry->name[LOCALE_enUS]); - sInstanceSaveMgr->ForceGlobalReset(mEntry->MapID, Difficulty(difficulty)); + handler->PSendSysMessage("Resetting difficulty %d for '%s'.", difficulty, mEntry->Name[LOCALE_enUS]); + sInstanceSaveMgr->ForceGlobalReset(mEntry->ID, Difficulty(difficulty)); } return true; } diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp index 8383c6c574e..eb02148bf36 100644 --- a/src/server/scripts/Commands/cs_lookup.cpp +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -1129,7 +1129,7 @@ public: { if (MapEntry const* mapInfo = sMapStore.LookupEntry(id)) { - std::string name = mapInfo->name; + std::string name = mapInfo->Name; if (name.empty()) continue; @@ -1147,7 +1147,7 @@ public: if (mapInfo->IsContinent()) ss << handler->GetTrinityString(LANG_CONTINENT); - switch (mapInfo->map_type) + switch (mapInfo->MapType) { case MAP_INSTANCE: ss << handler->GetTrinityString(LANG_INSTANCE); diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 04407cdf857..b239593e431 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -277,7 +277,7 @@ public: char const* unknown = handler->GetTrinityString(LANG_UNKNOWN); handler->PSendSysMessage(LANG_MAP_POSITION, - mapId, (mapEntry ? mapEntry->name : unknown), + mapId, (mapEntry ? mapEntry->Name : unknown), zoneId, (zoneEntry ? zoneEntry->area_name : unknown), areaId, (areaEntry ? areaEntry->area_name : unknown), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation()); @@ -1848,7 +1848,7 @@ public: } if (target) - handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map->name, + handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map->Name, (!zoneName.empty() ? zoneName.c_str() : handler->GetTrinityString(LANG_UNKNOWN)), (!areaName.empty() ? areaName.c_str() : handler->GetTrinityString(LANG_UNKNOWN))); diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index e55e80f0ccb..362f8f69bab 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -852,7 +852,7 @@ public: if (visibleMapId) { MapEntry const* visibleMap = sMapStore.LookupEntry(visibleMapId); - if (!visibleMap || visibleMap->rootPhaseMap != int32(target->GetMapId())) + if (!visibleMap || visibleMap->ParentMapID != int32(target->GetMapId())) { handler->SendSysMessage(LANG_PHASE_NOTFOUND); handler->SetSentErrorMessage(true); diff --git a/src/server/scripts/Pet/pet_generic.cpp b/src/server/scripts/Pet/pet_generic.cpp index fbe7075c195..e08259b2a05 100644 --- a/src/server/scripts/Pet/pet_generic.cpp +++ b/src/server/scripts/Pet/pet_generic.cpp @@ -109,7 +109,7 @@ public: npc_pet_gen_egbertAI(Creature* creature) : NullCreatureAI(creature) { if (Unit* owner = me->GetCharmerOrOwner()) - if (owner->GetMap()->GetEntry()->addon > 1) + if (owner->GetMap()->GetEntry()->ExpansionID > 1) me->SetCanFly(true); } diff --git a/src/tools/mmaps_generator/MapBuilder.cpp b/src/tools/mmaps_generator/MapBuilder.cpp index a7cd22ee1e3..65ed983bff0 100644 --- a/src/tools/mmaps_generator/MapBuilder.cpp +++ b/src/tools/mmaps_generator/MapBuilder.cpp @@ -648,6 +648,12 @@ namespace MMAP continue; } + if (!rcMedianFilterWalkableArea(m_rcContext, *tile.chf)) + { + printf("%s Failed filtering area! \n", tileString.c_str()); + continue; + } + if (!rcBuildDistanceField(m_rcContext, *tile.chf)) { printf("%s Failed building distance field! \n", tileString.c_str());