Core/Dungeon Finder: Code cleanup and minor optimizations

- Extend LfgState to keep control of the state of group and players using LFG
- Move scripts to its own class and initialize only if Dungeon finder is enabled
- Updated comments to doxygen format
- Use constructor initialization list
- All variables are declared in the inner most scope
- Fix some mem leaks
- Remove no longer needed code (Cleaner)
- Normalize handler function names

--HG--
branch : trunk
This commit is contained in:
Spp
2010-12-05 17:50:26 +01:00
parent 71c2698faf
commit e621f5fe98
16 changed files with 1015 additions and 1024 deletions
+2 -2
View File
@@ -22190,13 +22190,13 @@ PartyResult Player::CanUninviteFromGroup() const
if (grp->GetLfgKicks() == GROUP_MAX_LFG_KICKS)
return ERR_PARTY_LFG_BOOT_LIMIT;
if (grp->isLfgKickActive())
if (GetLfgState() == LFG_STATE_BOOT)
return ERR_PARTY_LFG_BOOT_IN_PROGRESS;
if (grp->GetMembersCount() <= GROUP_LFG_KICK_VOTES_NEEDED)
return ERR_PARTY_LFG_BOOT_TOO_FEW_PLAYERS;
if (grp->isLfgDungeonComplete())
if (GetLfgState() == LFG_STATE_FINISHED_DUNGEON)
return ERR_PARTY_LFG_BOOT_DUNGEON_COMPLETE;
if (grp->isRollLootActive())
+21 -4
View File
@@ -2260,10 +2260,27 @@ class Player : public Unit, public GridObject<Player>
void SetLfgComment(std::string _comment) { m_LookingForGroup.comment = _comment; }
uint8 GetLfgRoles() { return m_LookingForGroup.roles; }
void SetLfgRoles(uint8 _roles) { m_LookingForGroup.roles = _roles; }
bool GetLfgUpdate() { return m_LookingForGroup.update; }
void SetLfgUpdate(bool update) { m_LookingForGroup.update = update; }
LfgState GetLfgState() { return m_LookingForGroup.state; }
void SetLfgState(LfgState state) { m_LookingForGroup.state = state; }
LfgState GetLfgState() const { return m_LookingForGroup.state; }
void SetLfgState(LfgState state)
{
switch(state)
{
case LFG_STATE_NONE:
case LFG_STATE_DUNGEON:
case LFG_STATE_FINISHED_DUNGEON:
m_LookingForGroup.oldState = state;
// No break on purpose
default:
m_LookingForGroup.state = state;
}
}
void ClearLfgState()
{
m_LookingForGroup.applyDungeons.clear();
m_LookingForGroup.roles = ROLE_NONE;
m_LookingForGroup.state = m_LookingForGroup.oldState;
}
bool isUsingLfg() { return GetLfgState() != LFG_STATE_NONE; }
typedef std::set<uint32> DFQuestsDoneList;