mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-28 12:52:25 +01:00
Core/Conditions: Prevent unneccessary copying condition list on every check
This commit is contained in:
@@ -252,9 +252,9 @@ ConditionList ConditionMgr::GetConditionReferences(uint32 refId)
|
||||
return conditions;
|
||||
}
|
||||
|
||||
bool ConditionMgr::IsPlayerMeetToConditionList(Player* player, const ConditionList& conditions, Unit* invoker)
|
||||
bool ConditionMgr::IsPlayerMeetToConditionList(Player* player, ConditionList const& conditions, Unit* invoker /*= NULL*/)
|
||||
{
|
||||
std::map<uint32, bool>ElseGroupMap;
|
||||
std::map<uint32, bool> ElseGroupMap;
|
||||
for (ConditionList::const_iterator i = conditions.begin(); i != conditions.end(); ++i)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_CONDITIONSYS, "ConditionMgr::IsPlayerMeetToConditionList condType: %u val1: %u", (*i)->mConditionType, (*i)->mConditionValue1);
|
||||
@@ -295,19 +295,19 @@ bool ConditionMgr::IsPlayerMeetToConditionList(Player* player, const ConditionLi
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ConditionMgr::IsPlayerMeetToConditions(Player* player, ConditionList conditions, Unit* invoker)
|
||||
bool ConditionMgr::IsPlayerMeetToConditions(Player* player, ConditionList const& conditions, Unit* invoker /*= NULL*/)
|
||||
{
|
||||
if (conditions.empty())
|
||||
return true;
|
||||
|
||||
if(player)
|
||||
if (player)
|
||||
player->m_ConditionErrorMsgId = 0;
|
||||
|
||||
sLog->outDebug(LOG_FILTER_CONDITIONSYS, "ConditionMgr::IsPlayerMeetToConditions");
|
||||
bool result = IsPlayerMeetToConditionList(player, conditions, invoker);
|
||||
|
||||
if (player && player->m_ConditionErrorMsgId && player->GetSession() && !result)
|
||||
player->GetSession()->SendNotification(player->m_ConditionErrorMsgId);//m_ConditionErrorMsgId is set only if a condition was not met
|
||||
player->GetSession()->SendNotification(player->m_ConditionErrorMsgId); //m_ConditionErrorMsgId is set only if a condition was not met
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ class ConditionMgr
|
||||
bool isConditionTypeValid(Condition* cond);
|
||||
ConditionList GetConditionReferences(uint32 refId);
|
||||
|
||||
bool IsPlayerMeetToConditions(Player* player, ConditionList conditions, Unit* invoker = NULL);
|
||||
bool IsPlayerMeetToConditions(Player* player, ConditionList const& conditions, Unit* invoker = NULL);
|
||||
ConditionList GetConditionsForNotGroupedEntry(ConditionSourceType sType, uint32 uEntry);
|
||||
ConditionList GetConditionsForVehicleSpell(uint32 creatureID, uint32 spellID);
|
||||
|
||||
@@ -166,7 +166,7 @@ class ConditionMgr
|
||||
bool addToLootTemplate(Condition* cond, LootTemplate* loot);
|
||||
bool addToGossipMenus(Condition* cond);
|
||||
bool addToGossipMenuItems(Condition* cond);
|
||||
bool IsPlayerMeetToConditionList(Player* player, const ConditionList& conditions, Unit* invoker = NULL);
|
||||
bool IsPlayerMeetToConditionList(Player* player, ConditionList const& conditions, Unit* invoker = NULL);
|
||||
|
||||
bool isGroupable(ConditionSourceType sourceType) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user