Core: Get rid of dirty operator workaround for ACE_Singleton class implementation

--HG--
branch : trunk
This commit is contained in:
Shauren
2010-12-22 21:25:23 +01:00
parent 0948fc5bbe
commit 0f3b9019a8
159 changed files with 1943 additions and 1939 deletions
+1 -1
View File
@@ -147,7 +147,7 @@ bool SmartAI::LoadPath(uint32 entry)
{
if (HasEscortState(SMART_ESCORT_ESCORTING))
return false;
mWayPoints = sSmartWaypointMgr.GetPath(entry);
mWayPoints = sSmartWaypointMgr->GetPath(entry);
if (!mWayPoints)
{
GetScript()->SetPathId(0);
+15 -15
View File
@@ -143,7 +143,7 @@ void SmartScript::ProcessAction(SmartScriptHolder &e, Unit* unit, uint32 var0, u
mTextTimer = e.action.talk.duration;
mTextGUID = IsPlayer(mLastInvoker)? mLastInvoker->GetGUID() : NULL;//invoker, used for $vars in texts
mUseTextTimer = true;
sCreatureTextMgr.SendChat(talker, uint8(e.action.talk.textGroupID), mTextGUID);
sCreatureTextMgr->SendChat(talker, uint8(e.action.talk.textGroupID), mTextGUID);
break;
}
case SMART_ACTION_SIMPLE_TALK:
@@ -155,10 +155,10 @@ void SmartScript::ProcessAction(SmartScriptHolder &e, Unit* unit, uint32 var0, u
{
if (IsCreature((*itr)))
{
sCreatureTextMgr.SendChat((*itr)->ToCreature(), uint8(e.action.talk.textGroupID), IsPlayer(mLastInvoker)? mLastInvoker->GetGUID() : NULL);
sCreatureTextMgr->SendChat((*itr)->ToCreature(), uint8(e.action.talk.textGroupID), IsPlayer(mLastInvoker)? mLastInvoker->GetGUID() : NULL);
} else if (IsPlayer((*itr)))
{
sCreatureTextMgr.SendChat(me, uint8(e.action.talk.textGroupID),IsPlayer(mLastInvoker)? mLastInvoker->GetGUID() : NULL,CHAT_TYPE_END,LANG_ADDON,TEXT_RANGE_NORMAL,NULL,TEAM_OTHER,false, (*itr)->ToPlayer());
sCreatureTextMgr->SendChat(me, uint8(e.action.talk.textGroupID),IsPlayer(mLastInvoker)? mLastInvoker->GetGUID() : NULL,CHAT_TYPE_END,LANG_ADDON,TEXT_RANGE_NORMAL,NULL,TEAM_OTHER,false, (*itr)->ToPlayer());
}
}
}
@@ -179,7 +179,7 @@ void SmartScript::ProcessAction(SmartScriptHolder &e, Unit* unit, uint32 var0, u
if (targets)
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); itr++)
if (IsCreature((*itr)))
sCreatureTextMgr.SendSound((*itr)->ToCreature(), e.action.sound.sound, CHAT_TYPE_SAY, 0, TextRange(e.action.sound.range), Team(NULL), false);
sCreatureTextMgr->SendSound((*itr)->ToCreature(), e.action.sound.sound, CHAT_TYPE_SAY, 0, TextRange(e.action.sound.range), Team(NULL), false);
break;
}
case SMART_ACTION_SET_FACTION:
@@ -222,7 +222,7 @@ void SmartScript::ProcessAction(SmartScriptHolder &e, Unit* unit, uint32 var0, u
{
if (CreatureInfo const* ci = GetCreatureTemplateStore(e.action.morphOrMount.creature))
{
uint32 display_id = sObjectMgr.ChooseDisplayId(0, ci);
uint32 display_id = sObjectMgr->ChooseDisplayId(0, ci);
(*itr)->ToCreature()->SetDisplayId(display_id);
}
}
@@ -253,7 +253,7 @@ void SmartScript::ProcessAction(SmartScriptHolder &e, Unit* unit, uint32 var0, u
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); itr++)
{
if (IsPlayer((*itr)))
if (const Quest* q = sObjectMgr.GetQuestTemplate(e.action.quest.quest))
if (const Quest* q = sObjectMgr->GetQuestTemplate(e.action.quest.quest))
(*itr)->ToPlayer()->AddQuest(q, NULL);
}
break;
@@ -640,7 +640,7 @@ void SmartScript::ProcessAction(SmartScriptHolder &e, Unit* unit, uint32 var0, u
{
if (CreatureInfo const* cInfo = GetCreatureTemplateStore(e.action.morphOrMount.creature))
{
uint32 display_id = sObjectMgr.ChooseDisplayId(0, cInfo);
uint32 display_id = sObjectMgr->ChooseDisplayId(0, cInfo);
(*itr)->ToUnit()->Mount(display_id);
}
}
@@ -945,7 +945,7 @@ void SmartScript::ProcessAction(SmartScriptHolder &e, Unit* unit, uint32 var0, u
uint32 slot[3];
if (e.action.equip.entry)
{
EquipmentInfo const *einfo = sObjectMgr.GetEquipmentInfo(e.action.equip.entry);
EquipmentInfo const *einfo = sObjectMgr->GetEquipmentInfo(e.action.equip.entry);
if (!einfo)
{
sLog.outErrorDb("SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info entry %u", e.action.equip.entry);
@@ -1279,7 +1279,7 @@ void SmartScript::InstallTemplate(SmartScriptHolder e)
//phase 1: despawn after time on movepoint reached
AddEvent(SMART_EVENT_MOVEMENTINFORM,0, POINT_MOTION_TYPE,SMART_RANDOM_POINT,0,0,SMART_ACTION_FORCE_DESPAWN,e.action.installTtemplate.param2,0,0,0,0,0,SMART_TARGET_NONE,0,0,0,1);
if (sCreatureTextMgr.TextExist(me->GetEntry(), (uint8)e.action.installTtemplate.param5))
if (sCreatureTextMgr->TextExist(me->GetEntry(), (uint8)e.action.installTtemplate.param5))
AddEvent(SMART_EVENT_MOVEMENTINFORM,0, POINT_MOTION_TYPE,SMART_RANDOM_POINT,0,0,SMART_ACTION_TALK,e.action.installTtemplate.param5,0,0,0,0,0,SMART_TARGET_NONE,0,0,0,1);
break;
}
@@ -2154,21 +2154,21 @@ void SmartScript::GetScript()
SmartAIEventList e;
if (me)
{
e = sSmartScriptMgr.GetScript(-((int32)me->GetDBTableGUIDLow()), mScriptType);
e = sSmartScriptMgr->GetScript(-((int32)me->GetDBTableGUIDLow()), mScriptType);
if (e.empty())
e = sSmartScriptMgr.GetScript((int32)me->GetEntry(), mScriptType);
e = sSmartScriptMgr->GetScript((int32)me->GetEntry(), mScriptType);
FillScript(e, me, NULL);
}
else if (go)
{
e = sSmartScriptMgr.GetScript(-((int32)go->GetDBTableGUIDLow()), mScriptType);
e = sSmartScriptMgr->GetScript(-((int32)go->GetDBTableGUIDLow()), mScriptType);
if (e.empty())
e = sSmartScriptMgr.GetScript((int32)go->GetEntry(), mScriptType);
e = sSmartScriptMgr->GetScript((int32)go->GetEntry(), mScriptType);
FillScript(e, go, NULL);
}
else if (trigger)
{
e = sSmartScriptMgr.GetScript((int32)trigger->id, mScriptType);
e = sSmartScriptMgr->GetScript((int32)trigger->id, mScriptType);
FillScript(e, NULL, trigger);
}
}
@@ -2328,7 +2328,7 @@ void SmartScript::DoFindFriendlyMissingBuff(std::list<Creature*>& _list, float r
void SmartScript::SetScript9(SmartScriptHolder &e, uint32 entry)
{
mTimedActionList.clear();
mTimedActionList = sSmartScriptMgr.GetScript(entry, SMART_SCRIPT_TYPE_TIMED_ACTIONLIST);
mTimedActionList = sSmartScriptMgr->GetScript(entry, SMART_SCRIPT_TYPE_TIMED_ACTIONLIST);
if (mTimedActionList.empty())
return;
for (SmartAIEventList::iterator i = mTimedActionList.begin(); i != mTimedActionList.end(); ++i)
@@ -163,7 +163,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
}
}else
{
if (!sObjectMgr.GetCreatureData(uint32(abs(temp.entryOrGuid))))
if (!sObjectMgr->GetCreatureData(uint32(abs(temp.entryOrGuid))))
{
sLog.outErrorDb("SmartAIMgr::LoadSmartAIFromDB: Creature guid (%u) does not exist, skipped loading.", uint32(abs(temp.entryOrGuid)));
continue;
@@ -563,7 +563,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder &e)
break;
case SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS:
case SMART_ACTION_CALL_GROUPEVENTHAPPENS:
if (Quest const* qid = sObjectMgr.GetQuestTemplate(e.action.quest.quest))
if (Quest const* qid = sObjectMgr->GetQuestTemplate(e.action.quest.quest))
{
if (!qid->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
{
@@ -692,7 +692,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder &e)
break;
case SMART_ACTION_WP_START:
{
if (!sSmartWaypointMgr.GetPath(e.action.wpStart.pathID))
if (!sSmartWaypointMgr->GetPath(e.action.wpStart.pathID))
{
sLog.outErrorDb("SmartAIMgr: Creature %d Event %u Action %u uses non-existent WaypointPath id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.pathID);
return false;
@@ -783,7 +783,7 @@ bool SmartAIMgr::IsTextValid(SmartScriptHolder e, uint32 id)
entry = uint32(e.entryOrGuid);
else {
entry = uint32(abs(e.entryOrGuid));
CreatureData const* data = sObjectMgr.GetCreatureData(entry);
CreatureData const* data = sObjectMgr->GetCreatureData(entry);
if (!data)
{
sLog.outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Creature guid %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
@@ -792,7 +792,7 @@ bool SmartAIMgr::IsTextValid(SmartScriptHolder e, uint32 id)
else
entry = data->id;
}
if (!entry || !sCreatureTextMgr.TextExist(entry, uint8(id)))
if (!entry || !sCreatureTextMgr->TextExist(entry, uint8(id)))
error = true;
if (error)
{
@@ -1239,7 +1239,7 @@ class SmartAIMgr
}
inline bool IsQuestValid(SmartScriptHolder e, uint32 entry)
{
if (!sObjectMgr.GetQuestTemplate(entry))
if (!sObjectMgr->GetQuestTemplate(entry))
{
sLog.outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
@@ -1283,7 +1283,7 @@ class SmartAIMgr
cond.mConditionValue1 = uint32(v1);
cond.mConditionValue2 = uint32(v2);
cond.mConditionValue3 = uint32(v3);
if (!sConditionMgr.isConditionTypeValid(&cond))
if (!sConditionMgr->isConditionTypeValid(&cond))
error = true;
}
if (error)
@@ -1323,6 +1323,6 @@ class SmartAIMgr
bool IsTextValid(SmartScriptHolder e, uint32 id);
};
#define sSmartScriptMgr (*ACE_Singleton<SmartAIMgr, ACE_Null_Mutex>::instance())
#define sSmartWaypointMgr (*ACE_Singleton<SmartWaypointMgr, ACE_Null_Mutex>::instance())
#define sSmartScriptMgr ACE_Singleton<SmartAIMgr, ACE_Null_Mutex>::instance()
#define sSmartWaypointMgr ACE_Singleton<SmartWaypointMgr, ACE_Null_Mutex>::instance()
#endif