Core/Conditions: fix a memory leak for CONDITION_SOURCE_TYPE_TERRAIN_SWAP
Reported by Aokromes. (cherry picked from commit 3a7f311547bd4301abd102eb785c050d5436dce9) Conflicts: src/server/game/Entities/Object/Object.cpp
This commit is contained in:
1 parent
efdaa4201f
commit
691b0df6ae
5 files changed
+22
-61
No files matched your search
@@ -2877,26 +2877,26 @@ void WorldObject::RebuildTerrainSwaps()
|
||||
// Check all applied phases for terrain swap and add it only once
|
||||
for (uint32 phaseId : _phases)
|
||||
{
|
||||
if (std::vector<PhaseInfoStruct> const* swaps = sObjectMgr->GetPhaseTerrainSwaps(phaseId))
|
||||
if (std::vector<uint32> const* swaps = sObjectMgr->GetPhaseTerrainSwaps(phaseId))
|
||||
{
|
||||
for (PhaseInfoStruct const& swap : *swaps)
|
||||
for (uint32 const& swap : *swaps)
|
||||
{
|
||||
// only add terrain swaps for current map
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(swap.Id);
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(swap);
|
||||
if (!mapEntry || mapEntry->rootPhaseMap != int32(GetMapId()))
|
||||
continue;
|
||||
|
||||
if (sConditionMgr->IsObjectMeetToConditions(this, swap.Conditions))
|
||||
_terrainSwaps.insert(swap.Id);
|
||||
if (sConditionMgr->IsObjectMeetingNotGroupedConditions(CONDITION_SOURCE_TYPE_TERRAIN_SWAP, swap, this))
|
||||
_terrainSwaps.insert(swap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get default terrain swaps, only for current map always
|
||||
if (std::vector<PhaseInfoStruct> const* mapSwaps = sObjectMgr->GetDefaultTerrainSwaps(GetMapId()))
|
||||
for (PhaseInfoStruct const& swap : *mapSwaps)
|
||||
if (sConditionMgr->IsObjectMeetToConditions(this, swap.Conditions))
|
||||
_terrainSwaps.insert(swap.Id);
|
||||
if (std::vector<uint32> const* mapSwaps = sObjectMgr->GetDefaultTerrainSwaps(GetMapId()))
|
||||
for (uint32 const& swap : *mapSwaps)
|
||||
if (sConditionMgr->IsObjectMeetingNotGroupedConditions(CONDITION_SOURCE_TYPE_TERRAIN_SWAP, swap, this))
|
||||
_terrainSwaps.insert(swap);
|
||||
|
||||
// online players have a game client with world map display
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
@@ -2912,18 +2912,18 @@ void WorldObject::RebuildWorldMapAreaSwaps()
|
||||
// send the worldmaparea for it, to see swapped worldmaparea in client from other maps too, not just from our current
|
||||
TerrainPhaseInfo const& defaults = sObjectMgr->GetDefaultTerrainSwapStore();
|
||||
for (TerrainPhaseInfo::const_iterator itr = defaults.begin(); itr != defaults.end(); ++itr)
|
||||
for (PhaseInfoStruct const& swap : itr->second)
|
||||
if (std::vector<uint32> const* uiMapSwaps = sObjectMgr->GetTerrainWorldMaps(swap.Id))
|
||||
if (sConditionMgr->IsObjectMeetToConditions(this, swap.Conditions))
|
||||
for (uint32 const& swap : itr->second)
|
||||
if (std::vector<uint32> const* uiMapSwaps = sObjectMgr->GetTerrainWorldMaps(swap))
|
||||
if (sConditionMgr->IsObjectMeetingNotGroupedConditions(CONDITION_SOURCE_TYPE_TERRAIN_SWAP, swap, this))
|
||||
for (uint32 worldMapAreaId : *uiMapSwaps)
|
||||
_worldMapAreaSwaps.insert(worldMapAreaId);
|
||||
|
||||
// Check all applied phases for world map area swaps
|
||||
for (uint32 phaseId : _phases)
|
||||
if (std::vector<PhaseInfoStruct> const* swaps = sObjectMgr->GetPhaseTerrainSwaps(phaseId))
|
||||
for (PhaseInfoStruct const& swap : *swaps)
|
||||
if (std::vector<uint32> const* uiMapSwaps = sObjectMgr->GetTerrainWorldMaps(swap.Id))
|
||||
if (sConditionMgr->IsObjectMeetToConditions(this, swap.Conditions))
|
||||
if (std::vector<uint32> const* swaps = sObjectMgr->GetPhaseTerrainSwaps(phaseId))
|
||||
for (uint32 const& swap : *swaps)
|
||||
if (std::vector<uint32> const* uiMapSwaps = sObjectMgr->GetTerrainWorldMaps(swap))
|
||||
if (sConditionMgr->IsObjectMeetingNotGroupedConditions(CONDITION_SOURCE_TYPE_TERRAIN_SWAP, swap, this))
|
||||
for (uint32 worldMapAreaId : *uiMapSwaps)
|
||||
_worldMapAreaSwaps.insert(worldMapAreaId);
|
||||
}
|
||||
Reference in new issue
Block a user