Dungeon Finder: Change ASSERT with returns wherever is possible. If it affects packets then make sure it fills the correct data.
Thanks to a553r7fa1|3d for spotting the packet problem --HG-- branch : trunk
This commit is contained in:
@@ -368,7 +368,6 @@ void LFGMgr::Join(Player *plr)
|
|||||||
void LFGMgr::Leave(Player *plr, Group *grp /* = NULL*/)
|
void LFGMgr::Leave(Player *plr, Group *grp /* = NULL*/)
|
||||||
{
|
{
|
||||||
uint64 guid = grp ? grp->GetGUID() : plr ? plr->GetGUID() : 0;
|
uint64 guid = grp ? grp->GetGUID() : plr ? plr->GetGUID() : 0;
|
||||||
ASSERT(guid);
|
|
||||||
|
|
||||||
// Remove from Role Checks
|
// Remove from Role Checks
|
||||||
if (grp)
|
if (grp)
|
||||||
@@ -418,9 +417,7 @@ void LFGMgr::Leave(Player *plr, Group *grp /* = NULL*/)
|
|||||||
/// <param name="Group *">Group than needs new players</param>
|
/// <param name="Group *">Group than needs new players</param>
|
||||||
void LFGMgr::OfferContinue(Group *grp)
|
void LFGMgr::OfferContinue(Group *grp)
|
||||||
{
|
{
|
||||||
ASSERT(grp);
|
if (grp && grp->GetLfgStatus() != LFG_STATUS_COMPLETE)
|
||||||
|
|
||||||
if (grp->GetLfgStatus() != LFG_STATUS_COMPLETE)
|
|
||||||
if (Player *leader = sObjectMgr.GetPlayer(grp->GetLeaderGUID()))
|
if (Player *leader = sObjectMgr.GetPlayer(grp->GetLeaderGUID()))
|
||||||
leader->GetSession()->SendLfgOfferContinue(grp->GetLfgDungeonEntry(false));
|
leader->GetSession()->SendLfgOfferContinue(grp->GetLfgDungeonEntry(false));
|
||||||
}
|
}
|
||||||
@@ -433,8 +430,8 @@ void LFGMgr::OfferContinue(Group *grp)
|
|||||||
/// <param name="LfgDungeonSet *">Selected dungeons</param>
|
/// <param name="LfgDungeonSet *">Selected dungeons</param>
|
||||||
void LFGMgr::AddToQueue(uint64 guid, LfgRolesMap *roles, LfgDungeonSet *dungeons)
|
void LFGMgr::AddToQueue(uint64 guid, LfgRolesMap *roles, LfgDungeonSet *dungeons)
|
||||||
{
|
{
|
||||||
ASSERT(roles);
|
if (!roles || !dungeons)
|
||||||
ASSERT(dungeons);
|
return;
|
||||||
|
|
||||||
LfgQueueInfo *pqInfo = new LfgQueueInfo();
|
LfgQueueInfo *pqInfo = new LfgQueueInfo();
|
||||||
pqInfo->joinTime = time_t(time(NULL));
|
pqInfo->joinTime = time_t(time(NULL));
|
||||||
@@ -693,7 +690,8 @@ void LFGMgr::FindNewGroups(LfgGuidList &check, LfgGuidList all, LfgProposalList
|
|||||||
/// <param name="Player *">Player (optional, default NULL)</param>
|
/// <param name="Player *">Player (optional, default NULL)</param>
|
||||||
void LFGMgr::UpdateRoleCheck(Group *grp, Player *plr /* = NULL*/)
|
void LFGMgr::UpdateRoleCheck(Group *grp, Player *plr /* = NULL*/)
|
||||||
{
|
{
|
||||||
ASSERT(grp);
|
if (!grp)
|
||||||
|
return;
|
||||||
|
|
||||||
uint32 rolecheckId = grp->GetLowGUID();
|
uint32 rolecheckId = grp->GetLowGUID();
|
||||||
LfgRoleCheck *pRoleCheck = NULL;
|
LfgRoleCheck *pRoleCheck = NULL;
|
||||||
@@ -1191,11 +1189,14 @@ void LFGMgr::BuildLfgRoleCheck(WorldPacket &data, LfgRoleCheck *pRoleCheck)
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
void LFGMgr::SendUpdateProposal(Player *plr, uint32 proposalId, LfgProposal *pProp)
|
void LFGMgr::SendUpdateProposal(Player *plr, uint32 proposalId, LfgProposal *pProp)
|
||||||
{
|
{
|
||||||
ASSERT(pProp);
|
if (!plr || !pProp)
|
||||||
ASSERT(plr);
|
return;
|
||||||
|
|
||||||
uint32 pLogGuid = plr->GetGUIDLow();
|
uint32 pLogGuid = plr->GetGUIDLow();
|
||||||
LfgProposalPlayerMap::const_iterator itPlayer = pProp->players.find(pLogGuid);
|
LfgProposalPlayerMap::const_iterator itPlayer = pProp->players.find(pLogGuid);
|
||||||
ASSERT(itPlayer != pProp->players.end()); // Player MUST be in the proposal
|
if (itPlayer != pProp->players.end()) // Player MUST be in the proposal
|
||||||
|
return;
|
||||||
|
|
||||||
LfgProposalPlayer *ppPlayer = itPlayer->second;
|
LfgProposalPlayer *ppPlayer = itPlayer->second;
|
||||||
uint32 pLowGroupGuid = ppPlayer->groupLowGuid;
|
uint32 pLowGroupGuid = ppPlayer->groupLowGuid;
|
||||||
uint32 dLowGuid = pProp->groupLowGuid;
|
uint32 dLowGuid = pProp->groupLowGuid;
|
||||||
@@ -1282,8 +1283,7 @@ void LFGMgr::SendLfgPlayerInfo(Player *plr)
|
|||||||
randomlist->clear();
|
randomlist->clear();
|
||||||
delete randomlist;
|
delete randomlist;
|
||||||
}
|
}
|
||||||
if (lockSet)
|
BuildPlayerLockDungeonBlock(data, lockSet);
|
||||||
BuildPlayerLockDungeonBlock(data, lockSet);
|
|
||||||
plr->GetSession()->SendPacket(&data);
|
plr->GetSession()->SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1320,7 +1320,9 @@ void LFGMgr::SendLfgPlayerReward(Player *plr)
|
|||||||
sdungeonId = plr->GetGroup()->GetLfgDungeonEntry(false);
|
sdungeonId = plr->GetGroup()->GetLfgDungeonEntry(false);
|
||||||
bool done = plr->isLfgDungeonDone(rdungeonId);
|
bool done = plr->isLfgDungeonDone(rdungeonId);
|
||||||
LfgReward *reward = GetRandomDungeonReward(rdungeonId, done, plr->getLevel());
|
LfgReward *reward = GetRandomDungeonReward(rdungeonId, done, plr->getLevel());
|
||||||
ASSERT(reward);
|
if (!reward)
|
||||||
|
return;
|
||||||
|
|
||||||
uint8 itemNum = uint8(reward->itemId != 0);
|
uint8 itemNum = uint8(reward->itemId != 0);
|
||||||
|
|
||||||
sLog.outDebug("SMSG_LFG_PLAYER_REWARD");
|
sLog.outDebug("SMSG_LFG_PLAYER_REWARD");
|
||||||
@@ -1350,19 +1352,17 @@ void LFGMgr::SendLfgPlayerReward(Player *plr)
|
|||||||
/// <param name="LfgLockStatusMap *">lock status map</param>
|
/// <param name="LfgLockStatusMap *">lock status map</param>
|
||||||
void LFGMgr::BuildPartyLockDungeonBlock(WorldPacket &data, LfgLockStatusMap *lockMap)
|
void LFGMgr::BuildPartyLockDungeonBlock(WorldPacket &data, LfgLockStatusMap *lockMap)
|
||||||
{
|
{
|
||||||
ASSERT(lockMap);
|
if (!lockMap || !lockMap->size())
|
||||||
|
{
|
||||||
|
data << uint8(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
data << uint8(lockMap->size());
|
data << uint8(lockMap->size());
|
||||||
|
|
||||||
LfgLockStatusSet *lockSet;
|
|
||||||
for (LfgLockStatusMap::const_iterator it = lockMap->begin(); it != lockMap->end(); ++it)
|
for (LfgLockStatusMap::const_iterator it = lockMap->begin(); it != lockMap->end(); ++it)
|
||||||
{
|
{
|
||||||
lockSet = it->second;
|
|
||||||
if (!lockSet)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
data << uint64(MAKE_NEW_GUID(it->first, 0, HIGHGUID_PLAYER)); // Player guid
|
data << uint64(MAKE_NEW_GUID(it->first, 0, HIGHGUID_PLAYER)); // Player guid
|
||||||
BuildPlayerLockDungeonBlock(data, lockSet);
|
BuildPlayerLockDungeonBlock(data, it->second);
|
||||||
}
|
}
|
||||||
lockMap->clear();
|
lockMap->clear();
|
||||||
delete lockMap;
|
delete lockMap;
|
||||||
@@ -1375,7 +1375,11 @@ void LFGMgr::BuildPartyLockDungeonBlock(WorldPacket &data, LfgLockStatusMap *loc
|
|||||||
/// <param name="LfgLockStatusSet *">lock status list</param>
|
/// <param name="LfgLockStatusSet *">lock status list</param>
|
||||||
void LFGMgr::BuildPlayerLockDungeonBlock(WorldPacket &data, LfgLockStatusSet *lockSet)
|
void LFGMgr::BuildPlayerLockDungeonBlock(WorldPacket &data, LfgLockStatusSet *lockSet)
|
||||||
{
|
{
|
||||||
ASSERT(lockSet);
|
if (!lockSet || !lockSet->size())
|
||||||
|
{
|
||||||
|
data << uint8(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
data << uint32(lockSet->size()); // Size of lock dungeons
|
data << uint32(lockSet->size()); // Size of lock dungeons
|
||||||
for (LfgLockStatusSet::iterator it = lockSet->begin(); it != lockSet->end(); ++it)
|
for (LfgLockStatusSet::iterator it = lockSet->begin(); it != lockSet->end(); ++it)
|
||||||
{
|
{
|
||||||
@@ -1399,8 +1403,8 @@ void LFGMgr::BuildPlayerLockDungeonBlock(WorldPacket &data, LfgLockStatusSet *lo
|
|||||||
/// <returns>LfgLockStatusMap*</returns>
|
/// <returns>LfgLockStatusMap*</returns>
|
||||||
LfgLockStatusMap* LFGMgr::GetGroupLockStatusDungeons(PlayerSet *pPlayers, LfgDungeonSet *dungeons)
|
LfgLockStatusMap* LFGMgr::GetGroupLockStatusDungeons(PlayerSet *pPlayers, LfgDungeonSet *dungeons)
|
||||||
{
|
{
|
||||||
ASSERT(pPlayers);
|
if (!pPlayers || !dungeons)
|
||||||
ASSERT(dungeons);
|
return NULL;
|
||||||
|
|
||||||
LfgLockStatusSet *dungeonSet = NULL;
|
LfgLockStatusSet *dungeonSet = NULL;
|
||||||
LfgLockStatusMap *dungeonMap = new LfgLockStatusMap();
|
LfgLockStatusMap *dungeonMap = new LfgLockStatusMap();
|
||||||
@@ -1428,8 +1432,9 @@ LfgLockStatusMap* LFGMgr::GetGroupLockStatusDungeons(PlayerSet *pPlayers, LfgDun
|
|||||||
/// <returns>LfgLockStatusMap*</returns>
|
/// <returns>LfgLockStatusMap*</returns>
|
||||||
LfgLockStatusMap* LFGMgr::GetPartyLockStatusDungeons(Player *plr, LfgDungeonSet *dungeons)
|
LfgLockStatusMap* LFGMgr::GetPartyLockStatusDungeons(Player *plr, LfgDungeonSet *dungeons)
|
||||||
{
|
{
|
||||||
ASSERT(plr);
|
if (!plr || !dungeons)
|
||||||
ASSERT(dungeons);
|
return NULL;
|
||||||
|
|
||||||
Group *grp = plr->GetGroup();
|
Group *grp = plr->GetGroup();
|
||||||
if (!grp)
|
if (!grp)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1467,7 +1472,9 @@ LfgLockStatusSet* LFGMgr::GetPlayerLockStatusDungeons(Player *plr, LfgDungeonSet
|
|||||||
for (LfgDungeonSet::const_iterator it = dungeons->begin(); it != dungeons->end(); ++it)
|
for (LfgDungeonSet::const_iterator it = dungeons->begin(); it != dungeons->end(); ++it)
|
||||||
{
|
{
|
||||||
dungeon = sLFGDungeonStore.LookupEntry(*it);
|
dungeon = sLFGDungeonStore.LookupEntry(*it);
|
||||||
ASSERT(dungeon); // Will never happen - We provide a list from sLFGDungeonStore
|
if (!dungeon) // should never happen - We provide a list from sLFGDungeonStore
|
||||||
|
continue;
|
||||||
|
|
||||||
ar = sObjectMgr.GetAccessRequirement(dungeon->map, Difficulty(dungeon->difficulty));
|
ar = sObjectMgr.GetAccessRequirement(dungeon->map, Difficulty(dungeon->difficulty));
|
||||||
|
|
||||||
locktype = LFG_LOCKSTATUS_OK;
|
locktype = LFG_LOCKSTATUS_OK;
|
||||||
|
|||||||
Reference in New Issue
Block a user