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
+2 -2
View File
@@ -337,7 +337,7 @@ void VehicleAI::OnCharmed(bool apply)
void VehicleAI::LoadConditions()
{
conditions = sConditionMgr.GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE, me->GetEntry());
conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE, me->GetEntry());
if (!conditions.empty())
{
sLog.outDebug("VehicleAI::LoadConditions: loaded %u conditions", uint32(conditions.size()));
@@ -355,7 +355,7 @@ void VehicleAI::CheckConditions(const uint32 diff)
{
if (Player* plr = passenger->ToPlayer())
{
if (!sConditionMgr.IsPlayerMeetToConditions(plr, conditions))
if (!sConditionMgr->IsPlayerMeetToConditions(plr, conditions))
{
plr->ExitVehicle();
return;//check other pessanger in next tick
+1 -1
View File
@@ -37,7 +37,7 @@ AISpellInfoType * UnitAI::AISpellInfo;
void CreatureAI::Talk(uint8 id, uint64 WhisperGuid)
{
sCreatureTextMgr.SendChat(me, id, WhisperGuid);
sCreatureTextMgr->SendChat(me, id, WhisperGuid);
}
void CreatureAI::DoZoneInCombat(Creature* creature)
+1 -1
View File
@@ -38,7 +38,7 @@ namespace FactorySelector
//scriptname in db
if (!ai_factory)
if (CreatureAI* scriptedAI = sScriptMgr.GetCreatureAI(creature))
if (CreatureAI* scriptedAI = sScriptMgr->GetCreatureAI(creature))
return scriptedAI;
// AIname in db
@@ -58,8 +58,8 @@ int CreatureEventAI::Permissible(const Creature *creature)
CreatureEventAI::CreatureEventAI(Creature *c) : CreatureAI(c)
{
// Need make copy for filter unneeded steps and safe in case table reload
CreatureEventAI_Event_Map::const_iterator CreatureEvents = sEventAIMgr.GetCreatureEventAIMap().find(me->GetEntry());
if (CreatureEvents != sEventAIMgr.GetCreatureEventAIMap().end())
CreatureEventAI_Event_Map::const_iterator CreatureEvents = sEventAIMgr->GetCreatureEventAIMap().find(me->GetEntry());
if (CreatureEvents != sEventAIMgr->GetCreatureEventAIMap().end())
{
std::vector<CreatureEventAI_Event>::const_iterator i;
for (i = (*CreatureEvents).second.begin(); i != (*CreatureEvents).second.end(); ++i)
@@ -410,7 +410,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
{
if (CreatureInfo const* ci = GetCreatureTemplateStore(action.morph.creatureId))
{
uint32 display_id = sObjectMgr.ChooseDisplayId(0,ci);
uint32 display_id = sObjectMgr->ChooseDisplayId(0,ci);
me->SetDisplayId(display_id);
}
}
@@ -672,8 +672,8 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
{
Unit* target = GetTargetByType(action.summon_id.target, pActionInvoker);
CreatureEventAI_Summon_Map::const_iterator i = sEventAIMgr.GetCreatureEventAISummonMap().find(action.summon_id.spawnId);
if (i == sEventAIMgr.GetCreatureEventAISummonMap().end())
CreatureEventAI_Summon_Map::const_iterator i = sEventAIMgr->GetCreatureEventAISummonMap().find(action.summon_id.spawnId);
if (i == sEventAIMgr->GetCreatureEventAISummonMap().end())
{
sLog.outErrorDb("CreatureEventAI: failed to spawn creature %u. Summon map index %u does not exist. EventID %d. CreatureID %d", action.summon_id.creatureId, action.summon_id.spawnId, EventId, me->GetEntry());
return;
@@ -833,7 +833,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
{
if (CreatureInfo const* cInfo = GetCreatureTemplateStore(action.mount.creatureId))
{
uint32 display_id = sObjectMgr.ChooseDisplayId(0, cInfo);
uint32 display_id = sObjectMgr->ChooseDisplayId(0, cInfo);
me->Mount(display_id);
}
}
@@ -1248,9 +1248,9 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit*
return;
}
CreatureEventAI_TextMap::const_iterator i = sEventAIMgr.GetCreatureEventAITextMap().find(textEntry);
CreatureEventAI_TextMap::const_iterator i = sEventAIMgr->GetCreatureEventAITextMap().find(textEntry);
if (i == sEventAIMgr.GetCreatureEventAITextMap().end())
if (i == sEventAIMgr->GetCreatureEventAITextMap().end())
{
sLog.outErrorDb("CreatureEventAI: DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.",pSource->GetEntry(),pSource->GetTypeId(),pSource->GetGUIDLow(),textEntry);
return;
@@ -35,7 +35,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
m_CreatureEventAI_TextMap.clear();
// Load EventAI Text
sObjectMgr.LoadTrinityStrings("creature_ai_texts",MIN_CREATURE_AI_TEXT_STRING_ID,MAX_CREATURE_AI_TEXT_STRING_ID);
sObjectMgr->LoadTrinityStrings("creature_ai_texts",MIN_CREATURE_AI_TEXT_STRING_ID,MAX_CREATURE_AI_TEXT_STRING_ID);
// Gather Additional data from EventAI Texts
QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM creature_ai_texts");
@@ -68,7 +68,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
}
// range negative (don't must be happen, loaded from same table)
if (!sObjectMgr.GetTrinityStringLocale(i))
if (!sObjectMgr->GetTrinityStringLocale(i))
{
sLog.outErrorDb("CreatureEventAI: Entry %i in table `creature_ai_texts` not found",i);
continue;
@@ -329,7 +329,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
break;
case EVENT_T_QUEST_ACCEPT:
case EVENT_T_QUEST_COMPLETE:
if (!sObjectMgr.GetQuestTemplate(temp.quest.questId))
if (!sObjectMgr->GetQuestTemplate(temp.quest.questId))
sLog.outErrorDb("CreatureEventAI: Creature %u are using event(%u) with not existed qyest id (%u) in param1, skipped.", temp.creature_id, i, temp.quest.questId);
sLog.outErrorDb("CreatureEventAI: Creature %u using not implemented event (%u) in event %u.", temp.creature_id, temp.event_id, i);
continue;
@@ -361,7 +361,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
cond.mConditionType = ConditionType(temp.receive_emote.condition);
cond.mConditionValue1 = temp.receive_emote.conditionValue1;
cond.mConditionValue2 = temp.receive_emote.conditionValue2;
if (!sConditionMgr.isConditionTypeValid(&cond))
if (!sConditionMgr->isConditionTypeValid(&cond))
{
sLog.outErrorDb("CreatureEventAI: Creature %u using event %u: param2 (Condition: %u) are not valid.",temp.creature_id, i, temp.receive_emote.condition);
continue;
@@ -541,7 +541,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses invalid percent value %u.", i, j+1, action.threat_all_pct.percent);
break;
case ACTION_T_QUEST_EVENT:
if (Quest const* qid = sObjectMgr.GetQuestTemplate(action.quest_event.questId))
if (Quest const* qid = sObjectMgr->GetQuestTemplate(action.quest_event.questId))
{
if (!qid->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
sLog.outErrorDb("CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, action.quest_event.questId);
@@ -583,7 +583,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
sLog.outErrorDb("CreatureEventAI: Event %u Action %u is change phase by too large for any use %i.", i, j+1, action.set_inc_phase.step);
break;
case ACTION_T_QUEST_EVENT_ALL:
if (Quest const* qid = sObjectMgr.GetQuestTemplate(action.quest_event_all.questId))
if (Quest const* qid = sObjectMgr->GetQuestTemplate(action.quest_event_all.questId))
{
if (!qid->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
sLog.outErrorDb("CreatureEventAI: Event %u Action %u. SpecialFlags for quest entry %u does not include |2, Action will not have any effect.", i, j+1, action.quest_event_all.questId);
@@ -43,5 +43,5 @@ class CreatureEventAIMgr
CreatureEventAI_TextMap m_CreatureEventAI_TextMap;
};
#define sEventAIMgr (*ACE_Singleton<CreatureEventAIMgr, ACE_Null_Mutex>::instance())
#define sEventAIMgr ACE_Singleton<CreatureEventAIMgr, ACE_Null_Mutex>::instance()
#endif
@@ -395,7 +395,7 @@ void npc_escortAI::AddWaypoint(uint32 id, float x, float y, float z, uint32 Wait
void npc_escortAI::FillPointMovementListForCreature()
{
std::vector<ScriptPointMove> const &pPointsEntries = sScriptSystemMgr.GetPointMoveList(me->GetEntry());
std::vector<ScriptPointMove> const &pPointsEntries = sScriptSystemMgr->GetPointMoveList(me->GetEntry());
if (pPointsEntries.empty())
return;
+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