diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/collision/Management/VMapManager2.cpp | 10 | ||||
-rwxr-xr-x | src/server/game/Achievements/AchievementMgr.cpp | 4 | ||||
-rwxr-xr-x | src/server/game/Battlegrounds/BattlegroundMgr.cpp | 2 | ||||
-rwxr-xr-x | src/server/game/Conditions/DisableMgr.cpp | 31 | ||||
-rwxr-xr-x | src/server/game/Conditions/DisableMgr.h | 35 | ||||
-rwxr-xr-x | src/server/game/DungeonFinding/LFGMgr.cpp | 2 | ||||
-rwxr-xr-x | src/server/game/Entities/Player/Player.cpp | 8 | ||||
-rwxr-xr-x | src/server/game/Globals/ObjectMgr.cpp | 6 | ||||
-rwxr-xr-x | src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp | 2 | ||||
-rwxr-xr-x | src/server/game/Server/Protocol/Handlers/BattleGroundHandler.cpp | 4 | ||||
-rwxr-xr-x | src/server/game/Spells/Spell.cpp | 2 | ||||
-rwxr-xr-x | src/server/game/World/World.cpp | 4 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_reload.cpp | 4 |
13 files changed, 51 insertions, 63 deletions
diff --git a/src/server/collision/Management/VMapManager2.cpp b/src/server/collision/Management/VMapManager2.cpp index b6dc8c7bac4..7c41a5bed41 100644 --- a/src/server/collision/Management/VMapManager2.cpp +++ b/src/server/collision/Management/VMapManager2.cpp @@ -143,7 +143,7 @@ namespace VMAP bool VMapManager2::isInLineOfSight(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2) { - if (!isLineOfSightCalcEnabled() || sDisableMgr->IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LOS)) + if (!isLineOfSightCalcEnabled() || DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LOS)) return true; InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId); @@ -166,7 +166,7 @@ namespace VMAP */ bool VMapManager2::getObjectHitPos(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float modifyDist) { - if (isLineOfSightCalcEnabled() && !sDisableMgr->IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LOS)) + if (isLineOfSightCalcEnabled() && !DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LOS)) { InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId); if (instanceTree != iInstanceMapTrees.end()) @@ -196,7 +196,7 @@ namespace VMAP float VMapManager2::getHeight(unsigned int mapId, float x, float y, float z, float maxSearchDist) { - if (isHeightCalcEnabled() && !sDisableMgr->IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_HEIGHT)) + if (isHeightCalcEnabled() && !DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_HEIGHT)) { InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId); if (instanceTree != iInstanceMapTrees.end()) @@ -215,7 +215,7 @@ namespace VMAP bool VMapManager2::getAreaInfo(unsigned int mapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const { - if (!sDisableMgr->IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_AREAFLAG)) + if (!DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_AREAFLAG)) { InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(mapId); if (instanceTree != iInstanceMapTrees.end()) @@ -233,7 +233,7 @@ namespace VMAP bool VMapManager2::GetLiquidLevel(uint32 mapId, float x, float y, float z, uint8 reqLiquidType, float& level, float& floor, uint32& type) const { - if (!sDisableMgr->IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LIQUIDSTATUS)) + if (!DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LIQUIDSTATUS)) { InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(mapId); if (instanceTree != iInstanceMapTrees.end()) diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index 3262af05f5f..037949c8d2e 100755 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -2133,7 +2133,7 @@ bool AchievementMgr::HasAchieved(AchievementEntry const* achievement) const bool AchievementMgr::CanUpdateCriteria(AchievementCriteriaEntry const* criteria, AchievementEntry const* achievement) { - if (sDisableMgr->IsDisabledFor(DISABLE_TYPE_ACHIEVEMENT_CRITERIA, criteria->ID, NULL)) + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_ACHIEVEMENT_CRITERIA, criteria->ID, NULL)) return false; if (achievement->mapID != -1 && GetPlayer()->GetMapId() != uint32(achievement->mapID)) @@ -2366,7 +2366,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() continue; } - if (!GetCriteriaDataSet(criteria) && !sDisableMgr->IsDisabledFor(DISABLE_TYPE_ACHIEVEMENT_CRITERIA, entryId, NULL)) + if (!GetCriteriaDataSet(criteria) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_ACHIEVEMENT_CRITERIA, entryId, NULL)) sLog->outErrorDb("Table `achievement_criteria_data` does not have expected data for criteria (Entry: %u Type: %u) for achievement %u.", criteria->ID, criteria->requiredType, criteria->referredAchievement); } diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index ce7fa8d81a4..bd45fee29f5 100755 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -691,7 +691,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds() Field *fields = result->Fetch(); uint32 bgTypeID_ = fields[0].GetUInt32(); - if (sDisableMgr->IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, bgTypeID_, NULL)) + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, bgTypeID_, NULL)) continue; // can be overwrite by values from DB diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp index e9e7a9f4d2b..dafb0ebc11f 100755 --- a/src/server/game/Conditions/DisableMgr.cpp +++ b/src/server/game/Conditions/DisableMgr.cpp @@ -16,25 +16,34 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "DisableMgr.h" #include "ObjectMgr.h" #include "OutdoorPvP.h" #include "SpellMgr.h" #include "VMapManager2.h" -#include "DisableMgr.h" -DisableMgr::DisableMgr() +namespace DisableMgr { -} -DisableMgr::~DisableMgr() +namespace { - for (DisableMap::iterator itr = m_DisableMap.begin(); itr != m_DisableMap.end(); ++itr) - itr->second.clear(); + struct DisableData + { + uint8 flags; + std::set<uint32> params[2]; // params0, params1 + }; - m_DisableMap.clear(); + // single disables here with optional data + typedef std::map<uint32, DisableData> DisableTypeMap; + // global disable map by source + typedef std::map<DisableType, DisableTypeMap> DisableMap; + + DisableMap m_DisableMap; + + uint8 MAX_DISABLE_TYPES = 7; } -void DisableMgr::LoadDisables() +void LoadDisables() { uint32 oldMSTime = getMSTime(); @@ -223,7 +232,7 @@ void DisableMgr::LoadDisables() sLog->outString(); } -void DisableMgr::CheckQuestDisables() +void CheckQuestDisables() { uint32 oldMSTime = getMSTime(); @@ -254,7 +263,7 @@ void DisableMgr::CheckQuestDisables() sLog->outString(); } -bool DisableMgr::IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags) +bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags) { ASSERT(type < MAX_DISABLE_TYPES); if (m_DisableMap[type].empty()) @@ -345,3 +354,5 @@ bool DisableMgr::IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, return false; } + +} // Namespace diff --git a/src/server/game/Conditions/DisableMgr.h b/src/server/game/Conditions/DisableMgr.h index 53373bfe58d..2931c5ea4ad 100755 --- a/src/server/game/Conditions/DisableMgr.h +++ b/src/server/game/Conditions/DisableMgr.h @@ -19,7 +19,7 @@ #ifndef TRINITY_DISABLEMGR_H #define TRINITY_DISABLEMGR_H -#include <ace/Singleton.h> +#include "Define.h" class Unit; @@ -54,34 +54,11 @@ enum VmapDisableTypes VMAP_DISABLE_LIQUIDSTATUS = 0x8, }; -#define MAX_DISABLE_TYPES 7 - -struct DisableData -{ - uint8 flags; - std::set<uint32> params[2]; // params0, params1 -}; - -typedef std::map<uint32, DisableData> DisableTypeMap; // single disables here with optional data -typedef std::map<DisableType, DisableTypeMap> DisableMap; // global disable map by source - -class DisableMgr +namespace DisableMgr { - friend class ACE_Singleton<DisableMgr, ACE_Null_Mutex>; - DisableMgr(); - ~DisableMgr(); - - public: - - void LoadDisables(); - bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags = 0); - void CheckQuestDisables(); - - protected: - - DisableMap m_DisableMap; -}; - -#define sDisableMgr ACE_Singleton<DisableMgr, ACE_Null_Mutex>::instance() + void LoadDisables(); + bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags = 0); + void CheckQuestDisables(); +} #endif //TRINITY_DISABLEMGR_H diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index c9752c6377b..348388b72a4 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -379,7 +379,7 @@ void LFGMgr::InitializeLockedDungeons(Player* plr) LfgLockStatusType locktype = LFG_LOCKSTATUS_OK; if (dungeon->expansion > expansion) locktype = LFG_LOCKSTATUS_INSUFFICIENT_EXPANSION; - else if (sDisableMgr->IsDisabledFor(DISABLE_TYPE_MAP, dungeon->map, plr)) + else if (DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, dungeon->map, plr)) locktype = LFG_LOCKSTATUS_RAID_LOCKED; else if (dungeon->difficulty > DUNGEON_DIFFICULTY_NORMAL && plr->GetBoundInstance(dungeon->map, Difficulty(dungeon->difficulty))) locktype = LFG_LOCKSTATUS_RAID_LOCKED; diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 89516bf45c9..ca5c3f2f132 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -2086,7 +2086,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati return false; } - if (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()) && sDisableMgr->IsDisabledFor(DISABLE_TYPE_MAP, mapid, this)) + if (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()) && DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, mapid, this)) { sLog->outError("Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName(), mapid); SendTransferAborted(mapid, TRANSFER_ABORT_MAP_NOT_ALLOWED); @@ -14531,7 +14531,7 @@ bool Player::CanSeeStartQuest(Quest const *pQuest) SatisfyQuestExclusiveGroup(pQuest, false) && SatisfyQuestReputation(pQuest, false) && SatisfyQuestPreviousQuest(pQuest, false) && SatisfyQuestNextChain(pQuest, false) && SatisfyQuestPrevChain(pQuest, false) && SatisfyQuestDay(pQuest, false) && SatisfyQuestWeek(pQuest, false) && - !sDisableMgr->IsDisabledFor(DISABLE_TYPE_QUEST, pQuest->GetQuestId(), this)) + !DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, pQuest->GetQuestId(), this)) { return getLevel() + sWorld->getIntConfig(CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF) >= pQuest->GetMinLevel(); } @@ -14547,7 +14547,7 @@ bool Player::CanTakeQuest(Quest const *pQuest, bool msg) && SatisfyQuestPreviousQuest(pQuest, msg) && SatisfyQuestTimed(pQuest, msg) && SatisfyQuestNextChain(pQuest, msg) && SatisfyQuestPrevChain(pQuest, msg) && SatisfyQuestDay(pQuest, msg) && SatisfyQuestWeek(pQuest, msg) - && !sDisableMgr->IsDisabledFor(DISABLE_TYPE_QUEST, pQuest->GetQuestId(), this) + && !DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, pQuest->GetQuestId(), this) && SatisfyQuestConditions(pQuest, msg); } @@ -18147,7 +18147,7 @@ bool Player::Satisfy(AccessRequirement const* ar, uint32 target_map, bool report else if (ar->item2 && !HasItemCount(ar->item2, 1)) missingItem = ar->item2; - if (sDisableMgr->IsDisabledFor(DISABLE_TYPE_MAP, target_map, this)) + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, target_map, this)) { GetSession()->SendAreaTriggerMessage("%s", GetSession()->GetTrinityString(LANG_INSTANCE_CLOSED)); return false; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 9de51cd6358..a7f92e1e649 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -2486,7 +2486,7 @@ void ObjectMgr::LoadItemTemplates() else if (itemTemplate.Spells[1].SpellId != -1) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate.Spells[1].SpellId); - if (!spellInfo && !sDisableMgr->IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[1].SpellId, NULL)) + if (!spellInfo && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[1].SpellId, NULL)) { sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId); itemTemplate.Spells[0].SpellId = 0; @@ -2534,7 +2534,7 @@ void ObjectMgr::LoadItemTemplates() if (itemTemplate.Spells[j].SpellId && itemTemplate.Spells[j].SpellId != -1) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate.Spells[j].SpellId); - if (!spellInfo && !sDisableMgr->IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[j].SpellId, NULL)) + if (!spellInfo && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[j].SpellId, NULL)) { sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId); itemTemplate.Spells[j].SpellId = 0; @@ -3752,7 +3752,7 @@ void ObjectMgr::LoadQuests() for (QuestMap::iterator iter = mQuestTemplates.begin(); iter != mQuestTemplates.end(); ++iter) { // skip post-loading checks for disabled quests - if (sDisableMgr->IsDisabledFor(DISABLE_TYPE_QUEST, iter->first, NULL)) + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, iter->first, NULL)) continue; Quest * qinfo = iter->second; diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp index 11675edd3ff..7626845e2c7 100755 --- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp @@ -60,7 +60,7 @@ void OutdoorPvPMgr::InitOutdoorPvP() typeId = fields[0].GetUInt32(); - if (sDisableMgr->IsDisabledFor(DISABLE_TYPE_OUTDOORPVP, typeId, NULL)) + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_OUTDOORPVP, typeId, NULL)) continue; if (typeId >= MAX_OUTDOORPVP_TYPES) diff --git a/src/server/game/Server/Protocol/Handlers/BattleGroundHandler.cpp b/src/server/game/Server/Protocol/Handlers/BattleGroundHandler.cpp index 20847ad0fd7..5d18e3309a3 100755 --- a/src/server/game/Server/Protocol/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/BattleGroundHandler.cpp @@ -91,7 +91,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data) return; } - if (sDisableMgr->IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, bgTypeId_, NULL)) + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, bgTypeId_, NULL)) { ChatHandler(this).PSendSysMessage(LANG_BG_DISABLED); return; @@ -669,7 +669,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data) return; } - if (sDisableMgr->IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, BATTLEGROUND_AA, NULL)) + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, BATTLEGROUND_AA, NULL)) { ChatHandler(this).PSendSysMessage(LANG_ARENA_DISABLED); return; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index d456cfdcf47..d005f5b2404 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2903,7 +2903,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered return; } - if (sDisableMgr->IsDisabledFor(DISABLE_TYPE_SPELL, m_spellInfo->Id, m_caster)) + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, m_spellInfo->Id, m_caster)) { SendCastResult(SPELL_FAILED_SPELL_UNAVAILABLE); finish(false); diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index d16e49b6b36..2a592969b4a 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1337,7 +1337,7 @@ void World::SetInitialWorldSettings() LoadRandomEnchantmentsTable(); sLog->outString("Loading Disables"); - sDisableMgr->LoadDisables(); // must be before loading quests and items + DisableMgr::LoadDisables(); // must be before loading quests and items sLog->outString("Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts sObjectMgr->LoadItemTemplates(); @@ -1403,7 +1403,7 @@ void World::SetInitialWorldSettings() sObjectMgr->LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables sLog->outString("Checking Quest Disables"); - sDisableMgr->CheckQuestDisables(); // must be after loading quests + DisableMgr::CheckQuestDisables(); // must be after loading quests sLog->outString("Loading Quest POI"); sObjectMgr->LoadQuestPOI(); diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp index 214e624fb22..fcdd30402e6 100644 --- a/src/server/scripts/Commands/cs_reload.cpp +++ b/src/server/scripts/Commands/cs_reload.cpp @@ -1104,9 +1104,9 @@ public: static bool HandleReloadDisablesCommand(ChatHandler* handler, const char* /*args*/) { sLog->outString("Re-Loading disables table..."); - sDisableMgr->LoadDisables(); + DisableMgr::LoadDisables(); sLog->outString("Checking quest disables..."); - sDisableMgr->CheckQuestDisables(); + DisableMgr::CheckQuestDisables(); handler->SendGlobalGMSysMessage("DB table `disables` reloaded."); return true; } |