Core/Loading: Speedup on the creature loading code

Signed-off-by: Subv <s.v.h21@hotmail.com>
This commit is contained in:
Subv
2012-02-12 17:34:41 -05:00
parent 11d9f8e161
commit 06df126bd0
2 changed files with 1 additions and 24 deletions

View File

@@ -427,14 +427,10 @@ void ObjectMgr::LoadCreatureTemplates()
creatureTemplate.Entry = entry;
for (uint8 i = 0; i < MAX_DIFFICULTY - 1; ++i)
{
creatureTemplate.DifficultyEntry[i] = fields[1 + i].GetUInt32();
}
for (uint8 i = 0; i < MAX_KILL_CREDIT; ++i)
{
creatureTemplate.KillCredit[i] = fields[4 + i].GetUInt32();
}
creatureTemplate.Modelid1 = fields[6].GetUInt32();
creatureTemplate.Modelid2 = fields[7].GetUInt32();
@@ -479,14 +475,10 @@ void ObjectMgr::LoadCreatureTemplates()
creatureTemplate.SkinLootId = fields[46].GetUInt32();
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
{
creatureTemplate.resistance[i] = fields[47 + i -1].GetInt32();
}
for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
{
creatureTemplate.spells[i] = fields[53 + i].GetUInt32();
}
creatureTemplate.PetSpellDataId = fields[61].GetUInt32();
creatureTemplate.VehicleId = fields[62].GetUInt32();
@@ -501,9 +493,7 @@ void ObjectMgr::LoadCreatureTemplates()
creatureTemplate.RacialLeader = fields[71].GetBool();
for (uint8 i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i)
{
creatureTemplate.questItems[i] = fields[72 + i].GetUInt32();
}
creatureTemplate.movementId = fields[78].GetUInt32();
creatureTemplate.RegenHealth = fields[79].GetBool();
@@ -518,9 +508,7 @@ void ObjectMgr::LoadCreatureTemplates()
// Checking needs to be done after loading because of the difficulty self referencing
for (CreatureTemplateContainer::const_iterator itr = CreatureTemplateStore.begin(); itr != CreatureTemplateStore.end(); ++itr)
{
CheckCreatureTemplate(&itr->second);
}
sLog->outString(">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
@@ -1426,15 +1414,6 @@ void ObjectMgr::LoadCreatures()
return;
}
// Build single time for check creature data
std::set<uint32> difficultyCreatures[MAX_DIFFICULTY - 1];
CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1; ++diff)
if (itr->second.DifficultyEntry[diff])
difficultyCreatures[diff].insert(itr->second.DifficultyEntry[diff]);
// Build single time for check spawnmask
std::map<uint32, uint32> spawnMasks;
for (uint32 i = 0; i < sMapStore.GetNumRows(); ++i)
@@ -1495,7 +1474,7 @@ void ObjectMgr::LoadCreatures()
bool ok = true;
for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1 && ok; ++diff)
{
if (difficultyCreatures[diff].find(data.id) != difficultyCreatures[diff].end())
if (difficultyEntries[diff].find(data.id) != difficultyEntries[diff].end())
{
sLog->outErrorDb("Table `creature` have creature (GUID: %u) that listed as difficulty %u template (entry: %u) in `creature_template`, skipped.",
guid, diff + 1, data.id);

View File

@@ -102,9 +102,7 @@ uint32 LootStore::LoadLootTable()
QueryResult result = WorldDatabase.PQuery("SELECT entry, item, ChanceOrQuestChance, lootmode, groupid, mincountOrRef, maxcount FROM %s", GetName());
if (!result)
{
return 0;
}
uint32 count = 0;