Core: Move FormationMgr to namespace
Also... - Warning fixes - Make Singleton constructors private
This commit is contained in:
@@ -196,7 +196,7 @@ void Creature::RemoveFromWorld()
|
||||
if (m_zoneScript)
|
||||
m_zoneScript->OnCreatureRemove(this);
|
||||
if (m_formation)
|
||||
sFormationMgr->RemoveCreatureFromGroup(m_formation, this);
|
||||
FormationMgr::RemoveCreatureFromGroup(m_formation, this);
|
||||
Unit::RemoveFromWorld();
|
||||
sObjectAccessor->RemoveObject(this);
|
||||
}
|
||||
@@ -223,7 +223,7 @@ void Creature::SearchFormation()
|
||||
|
||||
CreatureGroupInfoType::iterator frmdata = CreatureGroupMap.find(lowguid);
|
||||
if (frmdata != CreatureGroupMap.end())
|
||||
sFormationMgr->AddCreatureToGroup(frmdata->second->leaderGUID, this);
|
||||
FormationMgr::AddCreatureToGroup(frmdata->second->leaderGUID, this);
|
||||
}
|
||||
|
||||
void Creature::RemoveCorpse(bool setSpawnTime)
|
||||
|
||||
@@ -26,7 +26,10 @@
|
||||
|
||||
CreatureGroupInfoType CreatureGroupMap;
|
||||
|
||||
void CreatureGroupManager::AddCreatureToGroup(uint32 groupId, Creature* member)
|
||||
namespace FormationMgr
|
||||
{
|
||||
|
||||
void AddCreatureToGroup(uint32 groupId, Creature* member)
|
||||
{
|
||||
Map* map = member->FindMap();
|
||||
if (!map)
|
||||
@@ -50,7 +53,7 @@ void CreatureGroupManager::AddCreatureToGroup(uint32 groupId, Creature* member)
|
||||
}
|
||||
}
|
||||
|
||||
void CreatureGroupManager::RemoveCreatureFromGroup(CreatureGroup* group, Creature* member)
|
||||
void RemoveCreatureFromGroup(CreatureGroup* group, Creature* member)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_UNITS, "Deleting member pointer to GUID: %u from group %u", group->GetId(), member->GetDBTableGUIDLow());
|
||||
group->RemoveMember(member);
|
||||
@@ -67,7 +70,7 @@ void CreatureGroupManager::RemoveCreatureFromGroup(CreatureGroup* group, Creatur
|
||||
}
|
||||
}
|
||||
|
||||
void CreatureGroupManager::LoadCreatureFormations()
|
||||
void LoadCreatureFormations()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -151,6 +154,8 @@ void CreatureGroupManager::LoadCreatureFormations()
|
||||
sLog->outString();
|
||||
}
|
||||
|
||||
} // Namespace
|
||||
|
||||
void CreatureGroup::AddMember(Creature* member)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_UNITS, "CreatureGroup::AddMember: Adding unit GUID: %u.", member->GetGUIDLow());
|
||||
|
||||
@@ -19,8 +19,11 @@
|
||||
#ifndef _FORMATIONS_H
|
||||
#define _FORMATIONS_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "Define.h"
|
||||
#include "UnorderedMap.h"
|
||||
#include <map>
|
||||
|
||||
class Creature;
|
||||
class CreatureGroup;
|
||||
|
||||
struct FormationInfo
|
||||
@@ -31,20 +34,16 @@ struct FormationInfo
|
||||
uint8 groupAI;
|
||||
};
|
||||
|
||||
class CreatureGroupManager
|
||||
namespace FormationMgr
|
||||
{
|
||||
friend class ACE_Singleton<CreatureGroupManager, ACE_Null_Mutex>;
|
||||
public:
|
||||
void AddCreatureToGroup(uint32 group_id, Creature* creature);
|
||||
void RemoveCreatureFromGroup(CreatureGroup* group, Creature* creature);
|
||||
void LoadCreatureFormations();
|
||||
void AddCreatureToGroup(uint32 group_id, Creature* creature);
|
||||
void RemoveCreatureFromGroup(CreatureGroup* group, Creature* creature);
|
||||
void LoadCreatureFormations();
|
||||
};
|
||||
|
||||
#define sFormationMgr ACE_Singleton<CreatureGroupManager, ACE_Null_Mutex>::instance()
|
||||
|
||||
typedef UNORDERED_MAP<uint32/*memberDBGUID*/, FormationInfo*> CreatureGroupInfoType;
|
||||
|
||||
extern CreatureGroupInfoType CreatureGroupMap;
|
||||
extern CreatureGroupInfoType CreatureGroupMap;
|
||||
|
||||
class CreatureGroup
|
||||
{
|
||||
@@ -59,7 +58,7 @@ class CreatureGroup
|
||||
public:
|
||||
//Group cannot be created empty
|
||||
explicit CreatureGroup(uint32 id) : m_leader(NULL), m_groupID(id), m_Formed(false) {}
|
||||
~CreatureGroup() { sLog->outDebug(LOG_FILTER_UNITS, "Destroying group"); }
|
||||
~CreatureGroup() {}
|
||||
|
||||
Creature* getLeader() const { return m_leader; }
|
||||
uint32 GetId() const { return m_groupID; }
|
||||
|
||||
@@ -221,7 +221,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
|
||||
{
|
||||
case GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING:
|
||||
m_goValue->Building.Health = goinfo->building.intactNumHits + goinfo->building.damagedNumHits;
|
||||
m_goValue->Building.MaxHealth = goinfo->building.intactNumHits + goinfo->building.damagedNumHits;
|
||||
m_goValue->Building.MaxHealth = m_goValue->Building.Health;
|
||||
SetGoAnimProgress(255);
|
||||
break;
|
||||
case GAMEOBJECT_TYPE_TRANSPORT:
|
||||
|
||||
@@ -139,9 +139,12 @@ class PlayerSocial
|
||||
class SocialMgr
|
||||
{
|
||||
friend class ACE_Singleton<SocialMgr, ACE_Null_Mutex>;
|
||||
SocialMgr();
|
||||
public:
|
||||
|
||||
private:
|
||||
SocialMgr();
|
||||
~SocialMgr();
|
||||
|
||||
public:
|
||||
// Misc
|
||||
void RemovePlayerSocial(uint32 guid) { m_socialMap.erase(guid); }
|
||||
|
||||
|
||||
@@ -12120,7 +12120,7 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) co
|
||||
|
||||
// can't attack unattackable units or GMs
|
||||
if (target->HasUnitState(UNIT_STAT_UNATTACKABLE)
|
||||
|| target->GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->isGameMaster())
|
||||
|| (target->GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->isGameMaster()))
|
||||
return false;
|
||||
|
||||
// can't attack own vehicle or passenger
|
||||
@@ -12214,7 +12214,7 @@ bool Unit::_IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) co
|
||||
|
||||
// can't assist unattackable units or GMs
|
||||
if (target->HasUnitState(UNIT_STAT_UNATTACKABLE)
|
||||
|| target->GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->isGameMaster())
|
||||
|| (target->GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->isGameMaster()))
|
||||
return false;
|
||||
|
||||
// can't assist own vehicle or passenger
|
||||
|
||||
Reference in New Issue
Block a user