diff options
| author | Subv <s.v.h21@hotmail.com> | 2012-10-21 17:18:35 -0500 |
|---|---|---|
| committer | Subv <s.v.h21@hotmail.com> | 2012-10-21 17:18:35 -0500 |
| commit | 1fc3aad9d73df53173f2f186bf5cc94923c77c99 (patch) | |
| tree | 8d3a3d6ea24d2722a9b7ba8c8dfa98dc0d8427d1 /src/server/game/DungeonFinding | |
| parent | c343448989916df4fa41f42b57c5629e9997603d (diff) | |
| parent | 4fd9f8693b238866634c651e71798e7a4d3a7a1a (diff) | |
Merge branch 'master' of https://github.com/TrinityCore/TrinityCore into 4.3.4
Conflicts:
src/server/game/DataStores/DBCfmt.h
src/server/game/DungeonFinding/LFGMgr.h
src/server/scripts/Kalimdor/feralas.cpp
Diffstat (limited to 'src/server/game/DungeonFinding')
| -rwxr-xr-x | src/server/game/DungeonFinding/LFGMgr.cpp | 40 | ||||
| -rw-r--r--[-rwxr-xr-x] | src/server/game/DungeonFinding/LFGMgr.h | 17 |
2 files changed, 29 insertions, 28 deletions
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 16fda8952ac..357b7f1ecee 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -31,17 +31,20 @@ #include "GroupMgr.h" #include "GameEventMgr.h" -LFGMgr::LFGMgr(): m_QueueTimer(0), m_lfgProposalId(1), - m_options(sWorld->getBoolConfig(CONFIG_DUNGEON_FINDER_ENABLE)), - m_lfgPlayerScript(new LFGPlayerScript()), m_lfgGroupScript(new LFGGroupScript()) -{ } +LFGMgr::LFGMgr(): m_QueueTimer(0), m_lfgProposalId(1) +{ + m_options = sWorld->getBoolConfig(CONFIG_DUNGEON_FINDER_ENABLE); + if (m_options) + { + new LFGPlayerScript(); + new LFGGroupScript(); + } +} LFGMgr::~LFGMgr() { for (LfgRewardMap::iterator itr = m_RewardMap.begin(); itr != m_RewardMap.end(); ++itr) delete itr->second; - delete m_lfgPlayerScript; - delete m_lfgGroupScript; } void LFGMgr::_LoadFromDB(Field* fields, uint64 guid) @@ -239,7 +242,7 @@ void LFGMgr::LoadRewards() sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } -LFGDungeonEntry const* LFGMgr::GetLFGDungeon(uint32 id) +LFGDungeonData const* LFGMgr::GetLFGDungeon(uint32 id) { LFGDungeonMap::const_iterator itr = m_LfgDungeonMap.find(id); if (itr != m_LfgDungeonMap.end()) @@ -262,7 +265,7 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */) // Initialize Dungeon map with data from dbcs for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i) { - LFGDungeonEntryDbc const* dungeon = sLFGDungeonStore.LookupEntry(i); + LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(i); if (!dungeon) continue; @@ -272,7 +275,7 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */) case LFG_TYPE_HEROIC: case LFG_TYPE_RAID: case LFG_TYPE_RANDOM: - m_LfgDungeonMap[dungeon->ID] = LFGDungeonEntry(dungeon); + m_LfgDungeonMap[dungeon->ID] = LFGDungeonData(dungeon); break; } } @@ -299,7 +302,7 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */) continue; } - LFGDungeonEntry& data = dungeonItr->second; + LFGDungeonData& data = dungeonItr->second; data.x = fields[1].GetFloat(); data.y = fields[2].GetFloat(); data.z = fields[3].GetFloat(); @@ -314,7 +317,10 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */) // Fill all other teleport coords from areatriggers for (LFGDungeonMap::iterator itr = m_LfgDungeonMap.begin(); itr != m_LfgDungeonMap.end(); ++itr) { - LFGDungeonEntry& dungeon = itr->second; + LFGDungeonData& dungeon = itr->second; + if (dungeon.type == LFG_TYPE_RANDOM) + continue; + // No teleport coords in database, load from areatriggers if (dungeon.x == 0.0f && dungeon.y == 0.0f && dungeon.z == 0.0f) { @@ -462,7 +468,7 @@ void LFGMgr::InitializeLockedDungeons(Player* player, uint8 level /* = 0 */) for (LfgDungeonSet::const_iterator it = dungeons.begin(); it != dungeons.end(); ++it) { - LFGDungeonEntry const* dungeon = GetLFGDungeon(*it); + LFGDungeonData const* dungeon = GetLFGDungeon(*it); if (!dungeon) // should never happen - We provide a list from sLFGDungeonStore continue; @@ -1014,7 +1020,7 @@ void LFGMgr::MakeNewGroup(const LfgProposal& proposal) } // Set the dungeon difficulty - LFGDungeonEntry const* dungeon = GetLFGDungeon(proposal.dungeonId); + LFGDungeonData const* dungeon = GetLFGDungeon(proposal.dungeonId); ASSERT(dungeon); Group* grp = proposal.group ? sGroupMgr->GetGroupByGUID(GUID_LOPART(proposal.group)) : NULL; @@ -1384,7 +1390,7 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false* Group* grp = player->GetGroup(); uint64 gguid = grp->GetGUID(); - LFGDungeonEntry const* dungeon = GetLFGDungeon(GetDungeon(gguid)); + LFGDungeonData const* dungeon = GetLFGDungeon(GetDungeon(gguid)); if (!dungeon || (out && player->GetMapId() != uint32(dungeon->map))) return; @@ -1501,7 +1507,7 @@ void LFGMgr::RewardDungeonDoneFor(const uint32 dungeonId, Player* player) SetState(guid, LFG_STATE_FINISHED_DUNGEON); // Give rewards only if its a random or seasonal dungeon - LFGDungeonEntry const* dungeon = GetLFGDungeon(rDungeonId); + LFGDungeonData const* dungeon = GetLFGDungeon(rDungeonId); if (!dungeon || (dungeon->type != LFG_TYPE_RANDOM && !dungeon->seasonal)) { sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RewardDungeonDoneFor: [" UI64FMTD "] dungeon %u is not random nor seasonal", guid, rDungeonId); @@ -1551,7 +1557,7 @@ void LFGMgr::RewardDungeonDoneFor(const uint32 dungeonId, Player* player) */ const LfgDungeonSet& LFGMgr::GetDungeonsByRandom(uint32 randomdungeon) { - LFGDungeonEntry const* dungeon = GetLFGDungeon(randomdungeon); + LFGDungeonData const* dungeon = GetLFGDungeon(randomdungeon); uint32 group = dungeon ? dungeon->group : 0; return m_CachedDungeonMap[group]; } @@ -1586,7 +1592,7 @@ LfgReward const* LFGMgr::GetRandomDungeonReward(uint32 dungeon, uint8 level) */ LfgType LFGMgr::GetDungeonType(uint32 dungeonId) { - LFGDungeonEntry const* dungeon = GetLFGDungeon(dungeonId); + LFGDungeonData const* dungeon = GetLFGDungeon(dungeonId); if (!dungeon) return LFG_TYPE_NONE; diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index 4fb03bfe701..e60f144a94f 100755..100644 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.h @@ -25,8 +25,6 @@ #include "LFGGroupData.h" #include "LFGPlayerData.h" -class LFGPlayerScript; -class LFGGroupScript; class Group; class Player; @@ -117,7 +115,7 @@ enum LfgRoleCheckState }; // Forward declaration (just to have all typedef together) -struct LFGDungeonEntry; +struct LFGDungeonData; struct LfgReward; struct LfgQueueInfo; struct LfgRoleCheck; @@ -136,7 +134,7 @@ typedef std::map<uint64, LfgProposalPlayer> LfgProposalPlayerMap; typedef std::map<uint64, LfgPlayerBoot> LfgPlayerBootMap; typedef std::map<uint64, LfgGroupData> LfgGroupDataMap; typedef std::map<uint64, LfgPlayerData> LfgPlayerDataMap; -typedef UNORDERED_MAP<uint32, LFGDungeonEntry> LFGDungeonMap; +typedef UNORDERED_MAP<uint32, LFGDungeonData> LFGDungeonMap; // Data needed by SMSG_LFG_JOIN_RESULT struct LfgJoinResultData @@ -251,12 +249,12 @@ struct LfgPlayerBoot std::string reason; ///< kick reason }; -struct LFGDungeonEntry +struct LFGDungeonData { - LFGDungeonEntry(): id(0), name(""), map(0), type(0), expansion(0), group(0), minlevel(0), + LFGDungeonData(): id(0), name(""), map(0), type(0), expansion(0), group(0), minlevel(0), maxlevel(0), difficulty(REGULAR_DIFFICULTY), seasonal(false), x(0.0f), y(0.0f), z(0.0f), o(0.0f) { } - LFGDungeonEntry(LFGDungeonEntryDbc const* dbc): id(dbc->ID), name(dbc->name), map(dbc->map), + LFGDungeonData(LFGDungeonEntry const* dbc): id(dbc->ID), name(dbc->name), map(dbc->map), type(dbc->type), expansion(dbc->expansion), group(dbc->grouptype), minlevel(dbc->minlevel), maxlevel(dbc->maxlevel), difficulty(Difficulty(dbc->difficulty)), seasonal(dbc->flags & LFG_FLAG_SEASONAL), x(0.0f), y(0.0f), z(0.0f), o(0.0f) @@ -358,7 +356,7 @@ class LFGMgr static char const * GetStateString(LfgState state); void LoadLFGDungeons(bool reload = false); - LFGDungeonEntry const* GetLFGDungeon(uint32 id); + LFGDungeonData const* GetLFGDungeon(uint32 id); LFGDungeonMap& GetLFGDungeonMap(); void ClearState(uint64 guid, char const *debugMsg); @@ -406,9 +404,6 @@ class LFGMgr LfgPlayerDataMap m_Players; ///< Player data LfgGroupDataMap m_Groups; ///< Group data LfgGuidList m_teleport; ///< Players being teleported - - LFGPlayerScript *m_lfgPlayerScript; - LFGGroupScript *m_lfgGroupScript; }; #define sLFGMgr ACE_Singleton<LFGMgr, ACE_Null_Mutex>::instance() |
