aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/ScriptedAI
diff options
context:
space:
mode:
authorSpp <spp@jorge.gr>2013-05-13 15:07:36 +0200
committerSpp <spp@jorge.gr>2013-05-13 15:07:36 +0200
commitd1677b2db08f71a5bddedd9659cc5a66f325f47f (patch)
treeafb68e15d84d4e64de9f80b9bbbeb126c4aa8c54 /src/server/game/AI/ScriptedAI
parent243c325ca4323feb4f7f80c0ecd3873c78cbf887 (diff)
Core/Logging: Performance-related tweaks to logging system
All sLog->out* functions (except outCommand atm) are replaced with TC_LOG_* macros. Memleak fix
Diffstat (limited to 'src/server/game/AI/ScriptedAI')
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.cpp8
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp36
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp20
3 files changed, 32 insertions, 32 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
index d2c62176daf..7d7ae278b43 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
@@ -159,7 +159,7 @@ void ScriptedAI::DoPlaySoundToSet(WorldObject* source, uint32 soundId)
if (!sSoundEntriesStore.LookupEntry(soundId))
{
- sLog->outError(LOG_FILTER_TSCR, "Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", soundId, source->GetTypeId(), source->GetGUIDLow());
+ TC_LOG_ERROR(LOG_FILTER_TSCR, "Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", soundId, source->GetTypeId(), source->GetGUIDLow());
return;
}
@@ -252,7 +252,7 @@ void ScriptedAI::DoResetThreat()
{
if (!me->CanHaveThreatList() || me->getThreatManager().isThreatListEmpty())
{
- sLog->outError(LOG_FILTER_TSCR, "DoResetThreat called for creature that either cannot have threat list or has empty threat list (me entry = %d)", me->GetEntry());
+ TC_LOG_ERROR(LOG_FILTER_TSCR, "DoResetThreat called for creature that either cannot have threat list or has empty threat list (me entry = %d)", me->GetEntry());
return;
}
@@ -300,7 +300,7 @@ void ScriptedAI::DoTeleportPlayer(Unit* unit, float x, float y, float z, float o
if (Player* player = unit->ToPlayer())
player->TeleportTo(unit->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT);
else
- sLog->outError(LOG_FILTER_TSCR, "Creature " UI64FMTD " (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: " UI64FMTD ") to x: %f y:%f z: %f o: %f. Aborted.",
+ TC_LOG_ERROR(LOG_FILTER_TSCR, "Creature " UI64FMTD " (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: " UI64FMTD ") to x: %f y:%f z: %f o: %f. Aborted.",
me->GetGUID(), me->GetEntry(), unit->GetTypeId(), unit->GetGUID(), x, y, z, o);
}
@@ -433,7 +433,7 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea(uint32 const diff)
return false;
break;
default: // For most of creatures that certain area is their home area.
- sLog->outInfo(LOG_FILTER_GENERAL, "TSCR: EnterEvadeIfOutOfCombatArea used for creature entry %u, but does not have any definition. Using the default one.", me->GetEntry());
+ TC_LOG_INFO(LOG_FILTER_GENERAL, "TSCR: EnterEvadeIfOutOfCombatArea used for creature entry %u, but does not have any definition. Using the default one.", me->GetEntry());
uint32 homeAreaId = me->GetMap()->GetAreaId(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY(), me->GetHomePosition().GetPositionZ());
if (me->GetAreaId() == homeAreaId)
return false;
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
index 0f0e461e4cf..59de2baaed2 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
@@ -176,7 +176,7 @@ void npc_escortAI::EnterEvadeMode()
{
AddEscortState(STATE_ESCORT_RETURNING);
ReturnToLastPoint();
- sLog->outDebug(LOG_FILTER_TSCR, "EscortAI has left combat and is now returning to last point");
+ TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI has left combat and is now returning to last point");
}
else
{
@@ -217,7 +217,7 @@ void npc_escortAI::UpdateAI(uint32 diff)
{
if (DespawnAtEnd)
{
- sLog->outDebug(LOG_FILTER_TSCR, "EscortAI reached end of waypoints");
+ TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI reached end of waypoints");
if (m_bCanReturnToStart)
{
@@ -228,7 +228,7 @@ void npc_escortAI::UpdateAI(uint32 diff)
m_uiWPWaitTimer = 0;
- sLog->outDebug(LOG_FILTER_TSCR, "EscortAI are returning home to spawn location: %u, %f, %f, %f", POINT_HOME, fRetX, fRetY, fRetZ);
+ TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI are returning home to spawn location: %u, %f, %f, %f", POINT_HOME, fRetX, fRetY, fRetZ);
return;
}
@@ -244,7 +244,7 @@ void npc_escortAI::UpdateAI(uint32 diff)
}
else
{
- sLog->outDebug(LOG_FILTER_TSCR, "EscortAI reached end of waypoints with Despawn off");
+ TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI reached end of waypoints with Despawn off");
return;
}
@@ -253,7 +253,7 @@ void npc_escortAI::UpdateAI(uint32 diff)
if (!HasEscortState(STATE_ESCORT_PAUSED))
{
me->GetMotionMaster()->MovePoint(CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
- sLog->outDebug(LOG_FILTER_TSCR, "EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
+ TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
WaypointStart(CurrentWP->id);
@@ -271,7 +271,7 @@ void npc_escortAI::UpdateAI(uint32 diff)
{
if (DespawnAtFar && !IsPlayerOrGroupInRange())
{
- sLog->outDebug(LOG_FILTER_TSCR, "EscortAI failed because player/group was to far away or not found");
+ TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI failed because player/group was to far away or not found");
if (m_bCanInstantRespawn)
{
@@ -309,7 +309,7 @@ void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId)
//Combat start position reached, continue waypoint movement
if (pointId == POINT_LAST_POINT)
{
- sLog->outDebug(LOG_FILTER_TSCR, "EscortAI has returned to original position before combat");
+ TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI has returned to original position before combat");
me->SetWalk(!m_bIsRunning);
RemoveEscortState(STATE_ESCORT_RETURNING);
@@ -319,7 +319,7 @@ void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId)
}
else if (pointId == POINT_HOME)
{
- sLog->outDebug(LOG_FILTER_TSCR, "EscortAI has returned to original home location and will continue from beginning of waypoint list.");
+ TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI has returned to original home location and will continue from beginning of waypoint list.");
CurrentWP = WaypointList.begin();
m_uiWPWaitTimer = 1;
@@ -329,11 +329,11 @@ void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId)
//Make sure that we are still on the right waypoint
if (CurrentWP->id != pointId)
{
- sLog->outError(LOG_FILTER_GENERAL, "TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u, creature entry %u", pointId, CurrentWP->id, me->GetEntry());
+ TC_LOG_ERROR(LOG_FILTER_GENERAL, "TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u, creature entry %u", pointId, CurrentWP->id, me->GetEntry());
return;
}
- sLog->outDebug(LOG_FILTER_TSCR, "EscortAI Waypoint %u reached", CurrentWP->id);
+ TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI Waypoint %u reached", CurrentWP->id);
//Call WP function
WaypointReached(CurrentWP->id);
@@ -402,14 +402,14 @@ void npc_escortAI::SetRun(bool on)
if (!m_bIsRunning)
me->SetWalk(false);
else
- sLog->outDebug(LOG_FILTER_TSCR, "EscortAI attempt to set run mode, but is already running.");
+ TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI attempt to set run mode, but is already running.");
}
else
{
if (m_bIsRunning)
me->SetWalk(true);
else
- sLog->outDebug(LOG_FILTER_TSCR, "EscortAI attempt to set walk mode, but is already walking.");
+ TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI attempt to set walk mode, but is already walking.");
}
m_bIsRunning = on;
@@ -420,13 +420,13 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
{
if (me->getVictim())
{
- sLog->outError(LOG_FILTER_GENERAL, "TSCR ERROR: EscortAI (script: %s, creature entry: %u) attempts to Start while in combat", me->GetScriptName().c_str(), me->GetEntry());
+ TC_LOG_ERROR(LOG_FILTER_GENERAL, "TSCR ERROR: EscortAI (script: %s, creature entry: %u) attempts to Start while in combat", me->GetScriptName().c_str(), me->GetEntry());
return;
}
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
- sLog->outError(LOG_FILTER_TSCR, "EscortAI (script: %s, creature entry: %u) attempts to Start while already escorting", me->GetScriptName().c_str(), me->GetEntry());
+ TC_LOG_ERROR(LOG_FILTER_TSCR, "EscortAI (script: %s, creature entry: %u) attempts to Start while already escorting", me->GetScriptName().c_str(), me->GetEntry());
return;
}
@@ -439,7 +439,7 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
if (WaypointList.empty())
{
- sLog->outError(LOG_FILTER_TSCR, "EscortAI (script: %s, creature entry: %u) starts with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).",
+ TC_LOG_ERROR(LOG_FILTER_TSCR, "EscortAI (script: %s, creature entry: %u) starts with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).",
me->GetScriptName().c_str(), me->GetEntry(), quest ? quest->GetQuestId() : 0);
return;
}
@@ -455,13 +455,13 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
m_bCanReturnToStart = canLoopPath;
if (m_bCanReturnToStart && m_bCanInstantRespawn)
- sLog->outDebug(LOG_FILTER_TSCR, "EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn.");
+ TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn.");
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
{
me->GetMotionMaster()->MovementExpired();
me->GetMotionMaster()->MoveIdle();
- sLog->outDebug(LOG_FILTER_TSCR, "EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle.");
+ TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle.");
}
//disable npcflags
@@ -472,7 +472,7 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
}
- sLog->outDebug(LOG_FILTER_TSCR, "EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = " UI64FMTD "", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID);
+ TC_LOG_DEBUG(LOG_FILTER_TSCR, "EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = " UI64FMTD "", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID);
CurrentWP = WaypointList.begin();
diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
index 887714a6ce2..6160fe68ce0 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
@@ -166,7 +166,7 @@ void FollowerAI::EnterEvadeMode()
if (HasFollowState(STATE_FOLLOW_INPROGRESS))
{
- sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI left combat, returning to CombatStartPosition.");
+ TC_LOG_DEBUG(LOG_FILTER_TSCR, "FollowerAI left combat, returning to CombatStartPosition.");
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE)
{
@@ -192,7 +192,7 @@ void FollowerAI::UpdateAI(uint32 uiDiff)
{
if (HasFollowState(STATE_FOLLOW_COMPLETE) && !HasFollowState(STATE_FOLLOW_POSTEVENT))
{
- sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI is set completed, despawns.");
+ TC_LOG_DEBUG(LOG_FILTER_TSCR, "FollowerAI is set completed, despawns.");
me->DespawnOrUnsummon();
return;
}
@@ -203,7 +203,7 @@ void FollowerAI::UpdateAI(uint32 uiDiff)
{
if (HasFollowState(STATE_FOLLOW_RETURNING))
{
- sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI is returning to leader.");
+ TC_LOG_DEBUG(LOG_FILTER_TSCR, "FollowerAI is returning to leader.");
RemoveFollowState(STATE_FOLLOW_RETURNING);
me->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
@@ -232,7 +232,7 @@ void FollowerAI::UpdateAI(uint32 uiDiff)
if (bIsMaxRangeExceeded)
{
- sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI failed because player/group was to far away or not found");
+ TC_LOG_DEBUG(LOG_FILTER_TSCR, "FollowerAI failed because player/group was to far away or not found");
me->DespawnOrUnsummon();
return;
}
@@ -275,13 +275,13 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu
{
if (me->getVictim())
{
- sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI attempt to StartFollow while in combat.");
+ TC_LOG_DEBUG(LOG_FILTER_TSCR, "FollowerAI attempt to StartFollow while in combat.");
return;
}
if (HasFollowState(STATE_FOLLOW_INPROGRESS))
{
- sLog->outError(LOG_FILTER_TSCR, "FollowerAI attempt to StartFollow while already following.");
+ TC_LOG_ERROR(LOG_FILTER_TSCR, "FollowerAI attempt to StartFollow while already following.");
return;
}
@@ -297,7 +297,7 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu
{
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
- sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle.");
+ TC_LOG_DEBUG(LOG_FILTER_TSCR, "FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle.");
}
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
@@ -306,7 +306,7 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu
me->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
- sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI start follow %s (GUID " UI64FMTD ")", player->GetName().c_str(), m_uiLeaderGUID);
+ TC_LOG_DEBUG(LOG_FILTER_TSCR, "FollowerAI start follow %s (GUID " UI64FMTD ")", player->GetName().c_str(), m_uiLeaderGUID);
}
Player* FollowerAI::GetLeaderForFollower()
@@ -325,7 +325,7 @@ Player* FollowerAI::GetLeaderForFollower()
if (member && member->isAlive() && me->IsWithinDistInMap(member, MAX_PLAYER_DISTANCE))
{
- sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI GetLeader changed and returned new leader.");
+ TC_LOG_DEBUG(LOG_FILTER_TSCR, "FollowerAI GetLeader changed and returned new leader.");
m_uiLeaderGUID = member->GetGUID();
return member;
}
@@ -334,7 +334,7 @@ Player* FollowerAI::GetLeaderForFollower()
}
}
- sLog->outDebug(LOG_FILTER_TSCR, "FollowerAI GetLeader can not find suitable leader.");
+ TC_LOG_DEBUG(LOG_FILTER_TSCR, "FollowerAI GetLeader can not find suitable leader.");
return NULL;
}