Core/ObjectMgr: Replace manually constructed uint32 map key with pair<mapid, difficulty>
Port From (https://github.com/TrinityCore/TrinityCore/commit/b2b83d49ad379547da874afef04317a0fef4de0d)
This commit is contained in:
@@ -10212,29 +10212,29 @@ namespace Game
|
|||||||
}
|
}
|
||||||
CellObjectGuids CreateCellObjectGuids(uint mapid, Difficulty difficulty, uint cellid)
|
CellObjectGuids CreateCellObjectGuids(uint mapid, Difficulty difficulty, uint cellid)
|
||||||
{
|
{
|
||||||
uint newid = MathFunctions.MakePair32(mapid, (uint)difficulty);
|
var key = (mapid, difficulty);
|
||||||
|
|
||||||
if (!mapObjectGuidsStore.ContainsKey(newid))
|
if (!mapObjectGuidsStore.ContainsKey(key))
|
||||||
mapObjectGuidsStore.Add(newid, new Dictionary<uint, CellObjectGuids>());
|
mapObjectGuidsStore.Add(key, new Dictionary<uint, CellObjectGuids>());
|
||||||
|
|
||||||
if (!mapObjectGuidsStore[newid].ContainsKey(cellid))
|
if (!mapObjectGuidsStore[key].ContainsKey(cellid))
|
||||||
mapObjectGuidsStore[newid].Add(cellid, new CellObjectGuids());
|
mapObjectGuidsStore[key].Add(cellid, new CellObjectGuids());
|
||||||
|
|
||||||
return mapObjectGuidsStore[newid][cellid];
|
return mapObjectGuidsStore[key][cellid];
|
||||||
}
|
}
|
||||||
public CellObjectGuids GetCellObjectGuids(uint mapid, Difficulty difficulty, uint cellid)
|
public CellObjectGuids GetCellObjectGuids(uint mapid, Difficulty difficulty, uint cellid)
|
||||||
{
|
{
|
||||||
uint newid = MathFunctions.MakePair32(mapid, (uint)difficulty);
|
var key = (mapid, difficulty);
|
||||||
|
|
||||||
if (mapObjectGuidsStore.ContainsKey(newid) && mapObjectGuidsStore[newid].ContainsKey(cellid))
|
if (mapObjectGuidsStore.ContainsKey(key) && mapObjectGuidsStore[key].ContainsKey(cellid))
|
||||||
return mapObjectGuidsStore[newid][cellid];
|
return mapObjectGuidsStore[key][cellid];
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
public Dictionary<uint, CellObjectGuids> GetMapObjectGuids(uint mapid, byte spawnMode)
|
public Dictionary<uint, CellObjectGuids> GetMapObjectGuids(uint mapid, Difficulty difficulty)
|
||||||
{
|
{
|
||||||
var pair = MathFunctions.MakePair32(mapid, spawnMode);
|
var key = (mapid, difficulty);
|
||||||
return mapObjectGuidsStore.LookupByKey(pair);
|
return mapObjectGuidsStore.LookupByKey(key);
|
||||||
}
|
}
|
||||||
public PageText GetPageText(uint pageEntry)
|
public PageText GetPageText(uint pageEntry)
|
||||||
{
|
{
|
||||||
@@ -10665,7 +10665,7 @@ namespace Game
|
|||||||
|
|
||||||
//Maps
|
//Maps
|
||||||
public Dictionary<uint, GameTele> gameTeleStorage = new();
|
public Dictionary<uint, GameTele> gameTeleStorage = new();
|
||||||
Dictionary<uint, Dictionary<uint, CellObjectGuids>> mapObjectGuidsStore = new();
|
Dictionary<(uint mapId, Difficulty difficulty), Dictionary<uint, CellObjectGuids>> mapObjectGuidsStore = new();
|
||||||
Dictionary<uint, InstanceTemplate> instanceTemplateStorage = new();
|
Dictionary<uint, InstanceTemplate> instanceTemplateStorage = new();
|
||||||
public MultiMap<uint, GraveYardData> GraveYardStorage = new();
|
public MultiMap<uint, GraveYardData> GraveYardStorage = new();
|
||||||
List<ushort> _transportMaps = new();
|
List<ushort> _transportMaps = new();
|
||||||
|
|||||||
Reference in New Issue
Block a user