Core/Misc: Reserve space for the data in the stores before inserting it

This commit is contained in:
Subv
2012-02-26 14:55:22 -05:00
parent fd9f185f1f
commit 95d3ea5512
2 changed files with 9 additions and 3 deletions

View File

@@ -389,6 +389,7 @@ void ObjectMgr::LoadCreatureTemplates()
return;
}
_creatureTemplateStore.rehash(result->GetRowCount());
uint32 count = 0;
do
{
@@ -1104,6 +1105,7 @@ void ObjectMgr::LoadCreatureModelInfo()
return;
}
_creatureModelStore.rehash(result->GetRowCount());
uint32 count = 0;
do
@@ -1137,9 +1139,7 @@ void ObjectMgr::LoadCreatureModelInfo()
}
if (modelInfo.combat_reach < 0.1f)
{
modelInfo.combat_reach = DEFAULT_COMBAT_REACH;
}
++count;
}
@@ -1404,6 +1404,7 @@ void ObjectMgr::LoadCreatures()
if (GetMapDifficultyData(i, Difficulty(k)))
spawnMasks[i] |= (1 << k);
_creatureDataStore.rehash(result->GetRowCount());
uint32 count = 0;
do
{
@@ -1420,7 +1421,6 @@ void ObjectMgr::LoadCreatures()
}
CreatureData& data = _creatureDataStore[guid];
data.id = entry;
data.mapid = fields[ 2].GetUInt32();
data.displayid = fields[ 3].GetUInt32();
@@ -1714,6 +1714,7 @@ void ObjectMgr::LoadGameobjects()
if (GetMapDifficultyData(i, Difficulty(k)))
spawnMasks[i] |= (1 << k);
_gameObjectDataStore.rehash(result->GetRowCount());
do
{
Field* fields = result->Fetch();
@@ -2085,6 +2086,7 @@ void ObjectMgr::LoadItemTemplates()
return;
}
_itemTemplateStore.rehash(result->GetRowCount());
uint32 count = 0;
bool enforceDBCAttributes = sWorld->getBoolConfig(CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES);
@@ -2703,6 +2705,7 @@ void ObjectMgr::LoadItemSetNames()
return;
}
_itemSetNameStore.rehash(result->GetRowCount());
uint32 count = 0;
do
@@ -5166,6 +5169,7 @@ void ObjectMgr::LoadGossipText()
sLog->outString();
return;
}
_gossipTextStore.rehash(result->GetRowCount());
int cic;
@@ -6390,6 +6394,7 @@ void ObjectMgr::LoadGameObjectTemplate()
return;
}
_gameObjectTemplateStore.rehash(result->GetRowCount());
uint32 count = 0;
do
{

View File

@@ -385,6 +385,7 @@ struct TrinityStringLocale
StringVector Content;
};
typedef std::map<uint64, uint64> LinkedRespawnContainer;
typedef UNORDERED_MAP<uint32, CreatureData> CreatureDataContainer;
typedef UNORDERED_MAP<uint32, GameObjectData> GameObjectDataContainer;