Few small optimizations here and there

This commit is contained in:
Aokromes committed 2017-02-01 16:51:21 +01:00
1 parent 0f9c7106ce
commit 8bb777ef5c
35 files changed
+366 -373

No files matched your search

+3 -14
View File
@@ -763,7 +763,8 @@ void GameEventMgr::LoadFromDB()
uint32 questId = fields[0].GetUInt32();
uint32 eventEntry = fields[1].GetUInt32(); /// @todo Change to uint8
if (!sObjectMgr->GetQuestTemplate(questId))
Quest* questTemplate = const_cast<Quest*>(sObjectMgr->GetQuestTemplate(questId));
if (!questTemplate)
{
TC_LOG_ERROR("sql.sql", "`game_event_seasonal_questrelation`: quest id (%u) does not exist in `quest_template`.", questId);
continue;
@@ -775,7 +776,7 @@ void GameEventMgr::LoadFromDB()
continue;
}
_questToEventLinks[questId] = eventEntry;
questTemplate->SetEventIdForQuest(static_cast<uint16>(eventEntry));
++count;
}
while (result->NextRow());
@@ -1665,18 +1666,6 @@ void GameEventMgr::RunSmartAIScripts(uint16 event_id, bool activate)
});
}
uint16 GameEventMgr::GetEventIdForQuest(Quest const* quest) const
{
if (!quest)
return 0;
std::unordered_map<uint32, uint16>::const_iterator itr = _questToEventLinks.find(quest->GetQuestId());
if (itr == _questToEventLinks.end())
return 0;
return itr->second;
}
bool IsHolidayActive(HolidayIds id)
{
if (id == HOLIDAY_NONE)