mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-25 19:31:59 +01:00
Core/Conditions: Add const to methods not modifying ConditionMgr
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
#include "SpellAuras.h"
|
||||
#include "SpellMgr.h"
|
||||
|
||||
char const* ConditionMgr::StaticSourceTypeData[CONDITION_SOURCE_TYPE_MAX] =
|
||||
char const* const ConditionMgr::StaticSourceTypeData[CONDITION_SOURCE_TYPE_MAX] =
|
||||
{
|
||||
"None",
|
||||
"Creature Loot",
|
||||
@@ -107,7 +107,7 @@ ConditionMgr::ConditionTypeInfo const ConditionMgr::StaticConditionTypeData[COND
|
||||
|
||||
// Checks if object meets the condition
|
||||
// Can have CONDITION_SOURCE_TYPE_NONE && !mReferenceId if called from a special event (ie: SmartAI)
|
||||
bool Condition::Meets(ConditionSourceInfo& sourceInfo)
|
||||
bool Condition::Meets(ConditionSourceInfo& sourceInfo) const
|
||||
{
|
||||
ASSERT(ConditionTarget < MAX_CONDITION_TARGETS);
|
||||
WorldObject* object = sourceInfo.mConditionTargets[ConditionTarget];
|
||||
@@ -452,7 +452,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
|
||||
return condMeets && script;
|
||||
}
|
||||
|
||||
uint32 Condition::GetSearcherTypeMaskForCondition()
|
||||
uint32 Condition::GetSearcherTypeMaskForCondition() const
|
||||
{
|
||||
// build mask of types for which condition can return true
|
||||
// this is used for speeding up gridsearches
|
||||
@@ -622,7 +622,7 @@ uint32 Condition::GetSearcherTypeMaskForCondition()
|
||||
return mask;
|
||||
}
|
||||
|
||||
uint32 Condition::GetMaxAvailableConditionTargets()
|
||||
uint32 Condition::GetMaxAvailableConditionTargets() const
|
||||
{
|
||||
// returns number of targets which are available for given source type
|
||||
switch (SourceType)
|
||||
@@ -718,7 +718,7 @@ uint32 ConditionMgr::GetSearcherTypeMaskForConditionList(ConditionContainer cons
|
||||
return mask;
|
||||
}
|
||||
|
||||
bool ConditionMgr::IsObjectMeetToConditionList(ConditionSourceInfo& sourceInfo, ConditionContainer const& conditions)
|
||||
bool ConditionMgr::IsObjectMeetToConditionList(ConditionSourceInfo& sourceInfo, ConditionContainer const& conditions) const
|
||||
{
|
||||
// groupId, groupCheckPassed
|
||||
std::map<uint32, bool> ElseGroupStore;
|
||||
@@ -764,19 +764,19 @@ bool ConditionMgr::IsObjectMeetToConditionList(ConditionSourceInfo& sourceInfo,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ConditionMgr::IsObjectMeetToConditions(WorldObject* object, ConditionContainer const& conditions)
|
||||
bool ConditionMgr::IsObjectMeetToConditions(WorldObject* object, ConditionContainer const& conditions) const
|
||||
{
|
||||
ConditionSourceInfo srcInfo = ConditionSourceInfo(object);
|
||||
return IsObjectMeetToConditions(srcInfo, conditions);
|
||||
}
|
||||
|
||||
bool ConditionMgr::IsObjectMeetToConditions(WorldObject* object1, WorldObject* object2, ConditionContainer const& conditions)
|
||||
bool ConditionMgr::IsObjectMeetToConditions(WorldObject* object1, WorldObject* object2, ConditionContainer const& conditions) const
|
||||
{
|
||||
ConditionSourceInfo srcInfo = ConditionSourceInfo(object1, object2);
|
||||
return IsObjectMeetToConditions(srcInfo, conditions);
|
||||
}
|
||||
|
||||
bool ConditionMgr::IsObjectMeetToConditions(ConditionSourceInfo& sourceInfo, ConditionContainer const& conditions)
|
||||
bool ConditionMgr::IsObjectMeetToConditions(ConditionSourceInfo& sourceInfo, ConditionContainer const& conditions) const
|
||||
{
|
||||
if (conditions.empty())
|
||||
return true;
|
||||
@@ -814,7 +814,7 @@ bool ConditionMgr::CanHaveSourceIdSet(ConditionSourceType sourceType)
|
||||
return (sourceType == CONDITION_SOURCE_TYPE_SMART_EVENT);
|
||||
}
|
||||
|
||||
ConditionContainer ConditionMgr::GetConditionsForNotGroupedEntry(ConditionSourceType sourceType, uint32 entry)
|
||||
ConditionContainer ConditionMgr::GetConditionsForNotGroupedEntry(ConditionSourceType sourceType, uint32 entry) const
|
||||
{
|
||||
ConditionContainer spellCond;
|
||||
if (sourceType > CONDITION_SOURCE_TYPE_NONE && sourceType < CONDITION_SOURCE_TYPE_MAX)
|
||||
@@ -833,7 +833,7 @@ ConditionContainer ConditionMgr::GetConditionsForNotGroupedEntry(ConditionSource
|
||||
return spellCond;
|
||||
}
|
||||
|
||||
ConditionContainer ConditionMgr::GetConditionsForSpellClickEvent(uint32 creatureId, uint32 spellId)
|
||||
ConditionContainer ConditionMgr::GetConditionsForSpellClickEvent(uint32 creatureId, uint32 spellId) const
|
||||
{
|
||||
ConditionContainer cond;
|
||||
ConditionEntriesByCreatureIdMap::const_iterator itr = SpellClickEventConditionStore.find(creatureId);
|
||||
@@ -849,7 +849,7 @@ ConditionContainer ConditionMgr::GetConditionsForSpellClickEvent(uint32 creature
|
||||
return cond;
|
||||
}
|
||||
|
||||
ConditionContainer ConditionMgr::GetConditionsForVehicleSpell(uint32 creatureId, uint32 spellId)
|
||||
ConditionContainer ConditionMgr::GetConditionsForVehicleSpell(uint32 creatureId, uint32 spellId) const
|
||||
{
|
||||
ConditionContainer cond;
|
||||
ConditionEntriesByCreatureIdMap::const_iterator itr = VehicleSpellConditionStore.find(creatureId);
|
||||
@@ -865,7 +865,7 @@ ConditionContainer ConditionMgr::GetConditionsForVehicleSpell(uint32 creatureId,
|
||||
return cond;
|
||||
}
|
||||
|
||||
ConditionContainer ConditionMgr::GetConditionsForSmartEvent(int64 entryOrGuid, uint32 eventId, uint32 sourceType)
|
||||
ConditionContainer ConditionMgr::GetConditionsForSmartEvent(int64 entryOrGuid, uint32 eventId, uint32 sourceType) const
|
||||
{
|
||||
ConditionContainer cond;
|
||||
SmartEventConditionContainer::const_iterator itr = SmartEventConditionStore.find(std::make_pair(entryOrGuid, sourceType));
|
||||
@@ -881,7 +881,7 @@ ConditionContainer ConditionMgr::GetConditionsForSmartEvent(int64 entryOrGuid, u
|
||||
return cond;
|
||||
}
|
||||
|
||||
ConditionContainer ConditionMgr::GetConditionsForNpcVendorEvent(uint32 creatureId, uint32 itemId)
|
||||
ConditionContainer ConditionMgr::GetConditionsForNpcVendorEvent(uint32 creatureId, uint32 itemId) const
|
||||
{
|
||||
ConditionContainer cond;
|
||||
ConditionEntriesByCreatureIdMap::const_iterator itr = NpcVendorConditionContainerStore.find(creatureId);
|
||||
@@ -1174,7 +1174,7 @@ void ConditionMgr::LoadConditions(bool isReload)
|
||||
TC_LOG_INFO("server.loading", ">> Loaded %u conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
|
||||
bool ConditionMgr::addToLootTemplate(Condition* cond, LootTemplate* loot)
|
||||
bool ConditionMgr::addToLootTemplate(Condition* cond, LootTemplate* loot) const
|
||||
{
|
||||
if (!loot)
|
||||
{
|
||||
@@ -1189,7 +1189,7 @@ bool ConditionMgr::addToLootTemplate(Condition* cond, LootTemplate* loot)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ConditionMgr::addToGossipMenus(Condition* cond)
|
||||
bool ConditionMgr::addToGossipMenus(Condition* cond) const
|
||||
{
|
||||
GossipMenusMapBoundsNonConst pMenuBounds = sObjectMgr->GetGossipMenusMapBoundsNonConst(cond->SourceGroup);
|
||||
|
||||
@@ -1209,7 +1209,7 @@ bool ConditionMgr::addToGossipMenus(Condition* cond)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ConditionMgr::addToGossipMenuItems(Condition* cond)
|
||||
bool ConditionMgr::addToGossipMenuItems(Condition* cond) const
|
||||
{
|
||||
GossipMenuItemsMapBoundsNonConst pMenuItemBounds = sObjectMgr->GetGossipMenuItemsMapBoundsNonConst(cond->SourceGroup);
|
||||
if (pMenuItemBounds.first != pMenuItemBounds.second)
|
||||
@@ -1228,7 +1228,7 @@ bool ConditionMgr::addToGossipMenuItems(Condition* cond)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ConditionMgr::addToSpellImplicitTargetConditions(Condition* cond)
|
||||
bool ConditionMgr::addToSpellImplicitTargetConditions(Condition* cond) const
|
||||
{
|
||||
uint32 conditionEffMask = cond->SourceGroup;
|
||||
SpellInfo* spellInfo = const_cast<SpellInfo*>(sSpellMgr->AssertSpellInfo(cond->SourceEntry));
|
||||
@@ -1343,7 +1343,7 @@ static bool addToTerrainSwapStore(TerrainPhaseInfo& swaps, Condition* cond)
|
||||
return added;
|
||||
}
|
||||
|
||||
bool ConditionMgr::addToTerrainSwaps(Condition* cond)
|
||||
bool ConditionMgr::addToTerrainSwaps(Condition* cond) const
|
||||
{
|
||||
bool added = false;
|
||||
added = addToTerrainSwapStore(sObjectMgr->GetPhaseTerrainSwapStoreForLoading(), cond);
|
||||
@@ -1355,7 +1355,7 @@ bool ConditionMgr::addToTerrainSwaps(Condition* cond)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ConditionMgr::addToPhases(Condition* cond)
|
||||
bool ConditionMgr::addToPhases(Condition* cond) const
|
||||
{
|
||||
if (!cond->SourceEntry)
|
||||
{
|
||||
@@ -1388,7 +1388,7 @@ bool ConditionMgr::addToPhases(Condition* cond)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ConditionMgr::isSourceTypeValid(Condition* cond)
|
||||
bool ConditionMgr::isSourceTypeValid(Condition* cond) const
|
||||
{
|
||||
if (cond->SourceType == CONDITION_SOURCE_TYPE_NONE || cond->SourceType >= CONDITION_SOURCE_TYPE_MAX)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user