aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2021-12-27 16:16:58 +0100
committerShauren <shauren.trinity@gmail.com>2021-12-27 16:16:58 +0100
commitb2b83d49ad379547da874afef04317a0fef4de0d (patch)
treef4f158ab02a41d56a22f88278d6abeb528e90949 /src
parent792dab8f052f7cfb018ba2bafb68a3fe8154b764 (diff)
Core/ObjectMgr: Replace manually constructed uint32 map key with pair<mapid, difficulty>
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp8
-rw-r--r--src/server/game/Globals/ObjectMgr.h10
2 files changed, 9 insertions, 9 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 9273c826ec0..ec2bf4b499b 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -2312,7 +2312,7 @@ void ObjectMgr::AddCreatureToGrid(ObjectGuid::LowType guid, CreatureData const*
for (Difficulty difficulty : data->spawnDifficulties)
{
CellCoord cellCoord = Trinity::ComputeCellCoord(data->spawnPoint.GetPositionX(), data->spawnPoint.GetPositionY());
- CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapId, difficulty)][cellCoord.GetId()];
+ CellObjectGuids& cell_guids = _mapObjectGuidsStore[{ data->mapId, difficulty }][cellCoord.GetId()];
cell_guids.creatures.insert(guid);
}
}
@@ -2322,7 +2322,7 @@ void ObjectMgr::RemoveCreatureFromGrid(ObjectGuid::LowType guid, CreatureData co
for (Difficulty difficulty : data->spawnDifficulties)
{
CellCoord cellCoord = Trinity::ComputeCellCoord(data->spawnPoint.GetPositionX(), data->spawnPoint.GetPositionY());
- CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapId, difficulty)][cellCoord.GetId()];
+ CellObjectGuids& cell_guids = _mapObjectGuidsStore[{ data->mapId, difficulty }][cellCoord.GetId()];
cell_guids.creatures.erase(guid);
}
}
@@ -2890,7 +2890,7 @@ void ObjectMgr::AddGameobjectToGrid(ObjectGuid::LowType guid, GameObjectData con
for (Difficulty difficulty : data->spawnDifficulties)
{
CellCoord cellCoord = Trinity::ComputeCellCoord(data->spawnPoint.GetPositionX(), data->spawnPoint.GetPositionY());
- CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapId, difficulty)][cellCoord.GetId()];
+ CellObjectGuids& cell_guids = _mapObjectGuidsStore[{ data->mapId, difficulty }][cellCoord.GetId()];
cell_guids.gameobjects.insert(guid);
}
}
@@ -2900,7 +2900,7 @@ void ObjectMgr::RemoveGameobjectFromGrid(ObjectGuid::LowType guid, GameObjectDat
for (Difficulty difficulty : data->spawnDifficulties)
{
CellCoord cellCoord = Trinity::ComputeCellCoord(data->spawnPoint.GetPositionX(), data->spawnPoint.GetPositionY());
- CellObjectGuids& cell_guids = _mapObjectGuidsStore[MAKE_PAIR32(data->mapId, difficulty)][cellCoord.GetId()];
+ CellObjectGuids& cell_guids = _mapObjectGuidsStore[{ data->mapId, difficulty }][cellCoord.GetId()];
cell_guids.gameobjects.erase(guid);
}
}
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index ff914354413..52eefdec97c 100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -486,7 +486,7 @@ struct CellObjectGuids
CellGuidSet gameobjects;
};
typedef std::unordered_map<uint32/*cell_id*/, CellObjectGuids> CellObjectGuidsMap;
-typedef std::unordered_map<uint32/*(mapid, spawnMode) pair*/, CellObjectGuidsMap> MapObjectGuids;
+typedef std::unordered_map<std::pair<uint32 /*mapId*/, Difficulty>, CellObjectGuidsMap> MapObjectGuids;
struct TrinityString
{
@@ -1454,14 +1454,14 @@ class TC_GAME_API ObjectMgr
return nullptr;
}
- CellObjectGuids const& GetCellObjectGuids(uint16 mapid, uint8 spawnMode, uint32 cell_id)
+ CellObjectGuids const& GetCellObjectGuids(uint16 mapid, Difficulty spawnMode, uint32 cell_id)
{
- return _mapObjectGuidsStore[MAKE_PAIR32(mapid, spawnMode)][cell_id];
+ return _mapObjectGuidsStore[{ mapid, spawnMode }][cell_id];
}
- CellObjectGuidsMap const& GetMapObjectGuids(uint16 mapid, uint8 spawnMode)
+ CellObjectGuidsMap const& GetMapObjectGuids(uint16 mapid, Difficulty spawnMode)
{
- return _mapObjectGuidsStore[MAKE_PAIR32(mapid, spawnMode)];
+ return _mapObjectGuidsStore[{ mapid, spawnMode }];
}
/**