Skip to content

Commit

Permalink
Core/Misc: remove win32-specific logging (The-Legion-Preservation-Pro…
Browse files Browse the repository at this point in the history
  • Loading branch information
jasongdove authored Nov 21, 2024
1 parent f9cfbdb commit e469ac1
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 112 deletions.
56 changes: 18 additions & 38 deletions src/server/game/Entities/AreaTrigger/AreaTrigger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@ void AreaTrigger::AddToWorld()

void AreaTrigger::RemoveFromWorld()
{
#ifdef WIN32
TC_LOG_DEBUG("entities.areatrigger", "AreaTrigger::RemoveFromWorld Entry: %u CustomEntry: %u", GetRealEntry(), GetCustomEntry());
#endif

///- Remove the AreaTrigger from the accessor and from all lists of objects in world
if (IsInWorld())
Expand Down Expand Up @@ -226,9 +224,7 @@ bool AreaTrigger::CreateAreaTrigger(ObjectGuid::LowType guidlow, uint32 triggerE
else
return false;

#ifdef WIN32
TC_LOG_DEBUG("entities.areatrigger", "AreaTrigger (spell %u) coordinates (X: %f Y: %f) _actionInfo %u", info ? info->Id : 0, GetPositionX(), GetPositionY(), _actionInfo.size());
#endif
TC_LOG_DEBUG("entities.areatrigger", "AreaTrigger (spell %u) coordinates (X: %f Y: %f) _actionInfo %zu", info ? info->Id : 0, GetPositionX(), GetPositionY(), _actionInfo.size());

Object::_Create(ObjectGuid::Create<HighGuid::AreaTrigger>(GetMapId(), atInfo.customEntry, guidlow));
if (caster)
Expand Down Expand Up @@ -359,11 +355,9 @@ bool AreaTrigger::CreateAreaTrigger(ObjectGuid::LowType guidlow, uint32 triggerE
if (!GetMap()->AddToMap(this))
return false;

#ifdef WIN32
TC_LOG_DEBUG("entities.areatrigger", "AreaTrigger::Create AreaTrigger caster %s spellID %u spell rage %f dist %f dest - X:%f,Y:%f,Z:%f _nextMoveTime %i duration %i",
caster ? caster->GetGUID().ToString().c_str() : ObjectGuid::Empty.ToString().c_str(), info ? info->Id : 0, _radius, GetSpellInfo() ? GetSpellInfo()->GetMaxRange() : 0.0f, _spline.VerticesPoints.empty() ? 0.0f : _spline.VerticesPoints[0].x, _spline.VerticesPoints.empty() ? 0.0f : _spline.VerticesPoints[0].y, _spline.VerticesPoints.empty() ? 0.0f : _spline.VerticesPoints[0].z, _nextMoveTime, duration);
TC_LOG_DEBUG("entities.areatrigger", "AreaTrigger::Create isMoving %i _range %f _spline.VerticesPoints %i moveType %i", isMoving(), _range, _spline.VerticesPoints.size(), atInfo.moveType);
#endif
TC_LOG_DEBUG("entities.areatrigger", "AreaTrigger::Create isMoving %i _range %f _spline.VerticesPoints %zu moveType %i", isMoving(), _range, _spline.VerticesPoints.size(), atInfo.moveType);

if (atInfo.maxCount && info && caster)
{
Expand All @@ -380,8 +374,8 @@ bool AreaTrigger::CreateAreaTrigger(ObjectGuid::LowType guidlow, uint32 triggerE
}
UpdateAffectedList(0, AT_ACTION_MOMENT_SPAWN);

#ifdef WIN32
TC_LOG_DEBUG("entities.areatrigger", "AreaTrigger end (spell %u) coordinates (X: %f Y: %f)", info ? info->Id : 0, GetPositionX(), GetPositionY());
#ifdef TRINITY_DEBUG
DebugVisualizePolygon();
#endif

Expand Down Expand Up @@ -724,9 +718,7 @@ void AreaTrigger::AffectOwner(AreaTriggerActionMoment actionM)

void AreaTrigger::ActionOnUpdate(uint32 /*p_time*/)
{
#ifdef WIN32
TC_LOG_DEBUG("entities.areatrigger", "ActionOnUpdate");
#endif

// Action for AOE spell with cast on dest
for (auto & itr : _actionInfo)
Expand Down Expand Up @@ -810,10 +802,8 @@ void AreaTrigger::DoAction(Unit* unit, ActionInfo& action)
if (!caster || !unit || !action.charges && action.action->maxCharges)
return;

#ifdef WIN32
TC_LOG_DEBUG("entities.areatrigger", "AreaTrigger::DoAction caster %s unit %s type %u spellID %u, moment %u, targetFlags %u",
caster->GetGUID().ToString().c_str(), unit->GetGUID().ToString().c_str(), action.action->actionType, action.action->spellId, action.action->moment, action.action->targetFlags);
#endif

if (action.action->targetFlags & AT_TARGET_FLAG_FRIENDLY)
if (!caster || !caster->IsFriendlyTo(unit) || unit->isTotem())
Expand Down Expand Up @@ -1321,10 +1311,8 @@ void AreaTrigger::DoActionLeave(ActionInfo& action)
if (!caster || !action.charges && action.action->maxCharges)
return;

#ifdef WIN32
TC_LOG_DEBUG("entities.areatrigger", "AreaTrigger::DoActionLeave caster %s type %u spellID %u, moment %u, targetFlags %u",
caster->GetGUID().ToString().c_str(), action.action->actionType, action.action->spellId, action.action->moment, action.action->targetFlags);
#endif

switch (action.action->actionType)
{
Expand Down Expand Up @@ -1640,9 +1628,7 @@ void AreaTrigger::InitSplines()
if (_CircleData)
_CircleData->TimeToTarget = _spline.TimeToTarget;

#ifdef WIN32
TC_LOG_DEBUG("entities.areatrigger", "InitSplines TimeToTarget %i _liveTime %u RePatchSpeed %f Speed %f movespline %s", _spline.TimeToTarget, _liveTime, atInfo.RePatchSpeed, atInfo.Speed, movespline->ToString().c_str());
#endif
TC_LOG_DEBUG("entities.areatrigger", "InitSplines TimeToTarget %i _liveTime %u RePatchSpeed %f Speed %f movespline %s", _spline.TimeToTarget, _liveTime, atInfo.RePatchSpeed, atInfo.Speed, movespline->ToString().c_str());

if (_reachedDestination)
{
Expand Down Expand Up @@ -1722,8 +1708,8 @@ void AreaTrigger::UpdateSplinePosition(uint32 diff)
ReCalculateSplinePosition();
}

#ifdef WIN32
TC_LOG_DEBUG("entities.areatrigger", "AreaTrigger::UpdateSplinePosition %f %f %f %i _reachedDestination %u", GetPositionX(), GetPositionY(), GetPositionZ(), _movementTime, _reachedDestination);
#ifdef TRINITY_DEBUG
DebugVisualizePosition();
#endif
}
Expand Down Expand Up @@ -1944,16 +1930,16 @@ bool AreaTrigger::UpdatePosition(ObjectGuid targetGuid)
if (relocated)
{
GetMap()->AreaTriggerRelocation(this, caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ(), caster->GetOrientation());
#ifdef WIN32
#ifdef TRINITY_DEBUG
DebugVisualizePolygon();
#endif
#endif
}
else if (turn)
{
SetOrientation(caster->GetOrientation());
#ifdef WIN32
#ifdef TRINITY_DEBUG
DebugVisualizePolygon();
#endif
#endif
}
}
else
Expand Down Expand Up @@ -2184,9 +2170,7 @@ void AreaTrigger::GetCollisionPosition(Position &_dest, float dist, float angle)
Position pos;
pos.Relocate(GetPositionX(), GetPositionY(), GetPositionZ() + 2.0f);

#ifdef WIN32
TC_LOG_DEBUG("entities.areatrigger", "GetCollisionPosition coordinates (X: %f Y: %f) ", pos.m_positionX, pos.m_positionY, pos.m_positionZ);
#endif
TC_LOG_DEBUG("entities.areatrigger", "GetCollisionPosition coordinates (X: %f Y: %f Z: %f) ", pos.m_positionX, pos.m_positionY, pos.m_positionZ);

float destx = pos.m_positionX + dist * std::cos(angle);
float desty = pos.m_positionY + dist * std::sin(angle);
Expand All @@ -2195,19 +2179,15 @@ void AreaTrigger::GetCollisionPosition(Position &_dest, float dist, float angle)
bool col = VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(GetMapId(), pos.m_positionX, pos.m_positionY, pos.m_positionZ + 0.5f, destx, desty, destz + 0.5f, destx, desty, destz, -0.5f);
if (!col)
{
#ifdef WIN32
TC_LOG_DEBUG("entities.areatrigger", "GetCollisionPosition coordinates !col dest (X: %f Y: %f) ", destx, desty, destz);
#endif
TC_LOG_DEBUG("entities.areatrigger", "GetCollisionPosition coordinates !col dest (X: %f Y: %f Z: %f) ", destx, desty, destz);

dist += 200.0f;
destx = pos.m_positionX + dist * std::cos(angle);
desty = pos.m_positionY + dist * std::sin(angle);
VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(GetMapId(), pos.m_positionX, pos.m_positionY, pos.m_positionZ + 0.5f, destx, desty, destz + 0.5f, destx, desty, destz, -0.5f);
}

#ifdef WIN32
TC_LOG_DEBUG("entities.areatrigger", "GetCollisionPosition coordinates dest (X: %f Y: %f) Z %f", destx, desty, destz, GetPositionZ());
#endif
TC_LOG_DEBUG("entities.areatrigger", "GetCollisionPosition coordinates dest (X: %f Y: %f Z: %f) Z %f", destx, desty, destz, GetPositionZ());

destx -= (CONTACT_DISTANCE + _radius) * std::cos(angle);
desty -= (CONTACT_DISTANCE + _radius) * std::sin(angle);
Expand Down Expand Up @@ -2664,10 +2644,8 @@ void AreaTrigger::CalculateSplinePosition(Position const& pos, Position const& p

m_moveAngleLos = _dest.GetAngle(&_destAngle) - static_cast<float>(M_PI / 2);

#ifdef WIN32
TC_LOG_DEBUG("entities.areatrigger", "AT_MOVE_TYPE_RE_PATH_LOS _timeToTarget %i _dest (%f %f %f) %f",
_spline.TimeToTarget, _dest.GetPositionX(), _dest.GetPositionY(), _dest.GetPositionZ(), m_moveAngleLos);
#endif
}
break;
}
Expand Down Expand Up @@ -2775,10 +2753,10 @@ void AreaTrigger::ReCalculateSplinePosition(bool setReach /*= false*/)
InitSplines();
}

#ifdef WIN32
TC_LOG_DEBUG("entities.areatrigger", "AreaTrigger::UpdateMovement AT_MOVE_TYPE_RE_PATH size %i _timeToTarget %i dist %f", _spline.VerticesPoints.size(), _spline.TimeToTarget, dist);
DebugVisualizePosition();
#endif
TC_LOG_DEBUG("entities.areatrigger", "AreaTrigger::UpdateMovement AT_MOVE_TYPE_RE_PATH size %zu _timeToTarget %i dist %f", _spline.VerticesPoints.size(), _spline.TimeToTarget, dist);
#ifdef TRINITY_DEBUG
DebugVisualizePosition();
#endif
break;
}
case AT_MOVE_TYPE_RE_PATH_LOS: //8
Expand All @@ -2804,7 +2782,9 @@ void AreaTrigger::ReCalculateSplinePosition(bool setReach /*= false*/)

TC_LOG_DEBUG("entities.areatrigger", "AreaTrigger::UpdateMovement AT_MOVE_TYPE_RE_PATH_LOS size %zu _timeToTarget %i _dest (%f %f %f) %f",
_spline.VerticesPoints.size(), _spline.TimeToTarget, _dest.GetPositionX(), _dest.GetPositionY(), _dest.GetPositionZ(), m_moveAngleLos);
#ifdef TRINITY_DEBUG
DebugVisualizePosition();
#endif
break;
}
default:
Expand Down
4 changes: 1 addition & 3 deletions src/server/game/Entities/Creature/CreatureGroups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,8 @@ void CreatureGroup::MemberAttackStart(Creature* member, Unit* target)
if(!member || !target)
return;

#ifdef WIN32
if(m_leader)
TC_LOG_DEBUG("entities.unit", "CreatureGroup::MemberAttackStart: GetDBTableGUIDLow %u GetGUIDLow %u entry %u m_leader %u %u", member->GetDBTableGUIDLow(), member->GetGUIDLow(), member->GetEntry(), m_leader->GetEntry(), m_leader->GetGUIDLow());
#endif
TC_LOG_DEBUG("entities.unit", "CreatureGroup::MemberAttackStart: GetDBTableGUIDLow %lu GetGUIDLow %u entry %u m_leader %u %u", member->GetDBTableGUIDLow(), member->GetGUIDLow(), member->GetEntry(), m_leader->GetEntry(), m_leader->GetGUIDLow());

uint8 groupAI = 0;

Expand Down
2 changes: 0 additions & 2 deletions src/server/game/Entities/Player/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10519,9 +10519,7 @@ void Player::_ApplyItemBonuses(Item* item, uint8 slot, bool apply)
if (val == 0)
continue;

#ifdef WIN32
TC_LOG_DEBUG("entities.player.items", "_ApplyItemBonuses statType %i val %i apply %u GetEntry %u", statType, val, apply, item->GetEntry());
#endif

switch (statType)
{
Expand Down
8 changes: 2 additions & 6 deletions src/server/game/Entities/Unit/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17917,9 +17917,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
}
}

#ifdef WIN32
TC_LOG_DEBUG("spells", "ProcDamageAndSpell: procSpell %u procTriggered %u procFlag %u procExtra %u isVictim %u", procSpell ? procSpell->Id : 0, procTriggered.size(), procFlag, procExtra, isVictim);
#endif
TC_LOG_DEBUG("spells", "ProcDamageAndSpell: procSpell %u procTriggered %zu procFlag %u procExtra %u isVictim %u", procSpell ? procSpell->Id : 0, procTriggered.size(), procFlag, procExtra, isVictim);

// Nothing found
if (procTriggered.empty())
Expand Down Expand Up @@ -19351,12 +19349,10 @@ bool Unit::SpellProcTriggered(Unit* victim, DamageInfo* dmgInfoProc, AuraEffect*
if (!itr->randList.empty())
spell_trigger = Trinity::Containers::SelectRandomContainerElement(itr->randList);

#ifdef WIN32
TC_LOG_DEBUG("spells", "SpellTriggered target %u, caster %u, spell_trigger %i, chance %i, triggerAmount %i, damage %i, GetAbsorb %i, GetResist %i, GetBlock %i",
TC_LOG_DEBUG("spells", "SpellTriggered target %u, caster %u, spell_trigger %i, chance %i, triggerAmount %f, damage %i, GetAbsorb %i, GetResist %i, GetBlock %i",
itr->target, itr->caster, itr->spell_trigger, itr->chance, triggerAmount, damage, dmgInfoProc->GetAbsorb(), dmgInfoProc->GetResist(), dmgInfoProc->GetBlock());
TC_LOG_DEBUG("spells", " group %i, effIndex %i, effectmask %i, option %i, (1<<effIndex) %i, procFlag %i addpowertype %i addptype %i procEx %i cooldown %f cooldown_spell_id %i",
itr->group, effIndex, itr->effectmask, itr->option, (1<<effIndex), procFlag, addpowertype, itr->addptype, procEx, cooldown, cooldown_spell_id);
#endif

if (G3D::fuzzyGt(cooldown, 0.0))
{
Expand Down
8 changes: 2 additions & 6 deletions src/server/game/Maps/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,7 @@ void Map::LoadMapImpl(Map* map, int gx, int gy, bool reload)
//map already load, delete it before reloading (Is it necessary? Do we really need the ability the reload maps during runtime?)
if (map->GridMaps[gx][gy])
{
#ifdef WIN32
TC_LOG_INFO("maps", "Unloading previously loaded map %u before reloading.", map->GetId());
#endif
TC_LOG_DEBUG("maps", "Unloading previously loaded map %u before reloading.", map->GetId());
sScriptMgr->OnUnloadGridMap(map, map->GridMaps[gx][gy], gx, gy);

delete (map->GridMaps[gx][gy]);
Expand All @@ -435,9 +433,7 @@ void Map::LoadMapImpl(Map* map, int gx, int gy, bool reload)

// map file name
std::string fileName = Trinity::StringFormat("%smaps/%04u_%02u_%02u.map", sWorld->GetDataPath().c_str(), map->GetId(), gx, gy);
#ifdef WIN32
TC_LOG_INFO("maps", "Loading map %s gx: %i, gy: %i", fileName.c_str(), gx, gy);
#endif
TC_LOG_DEBUG("maps", "Loading map %s gx: %i, gy: %i", fileName.c_str(), gx, gy);
// loading data
map->GridMaps[gx][gy] = new GridMap();
GridMap::LoadResult gridMapLoadResult = map->GridMaps[gx][gy]->loadData(fileName.c_str());
Expand Down
10 changes: 0 additions & 10 deletions src/server/game/Server/WorldSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,8 @@ void WorldSession::QueuePacket(WorldPacket* new_packet)
/// Logging helper for unexpected opcodes
void WorldSession::LogUnexpectedOpcode(WorldPacket* packet, const char* status, const char *reason)
{
#ifdef WIN32
TC_LOG_ERROR("network.opcode", "Received unexpected opcode %s Status: %s Reason: %s from %s",
GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())).c_str(), status, reason, GetPlayerName(false).c_str());
#endif
}

/// Logging helper for unexpected opcodes
Expand All @@ -271,11 +269,9 @@ void WorldSession::LogUnprocessedTail(WorldPacket const* packet)
if (!sLog->ShouldLog("network", LOG_LEVEL_TRACE) || packet->rpos() >= packet->wpos())
return;

#ifdef WIN32
TC_LOG_ERROR("network.opcode", "Unprocessed tail data (read stop at %u from %u) Opcode %s from %s",
uint32(packet->rpos()), uint32(packet->wpos()), GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())).c_str(), GetPlayerName(false).c_str());
packet->print_storage();
#endif
}

/// Update the WorldSession (triggered by World update)
Expand Down Expand Up @@ -344,9 +340,7 @@ bool WorldSession::Update(uint32 diff, Map* map)
{
requeuePackets.push_back(packet);
deletePacket = false;
#ifdef WIN32
TC_LOG_ERROR("network", "Re-enqueueing packet with opcode %s with with status STATUS_LOGGEDIN. Player is currently not in world yet.", GetOpcodeNameForLogging(opcode).c_str());
#endif
}
}
else if (_player->IsInWorld())
Expand Down Expand Up @@ -383,14 +377,10 @@ bool WorldSession::Update(uint32 diff, Map* map)
opHandle->Call(this, *packet);
break;
case STATUS_NEVER:
#ifdef WIN32
TC_LOG_ERROR("network.opcode", "Received not allowed opcode %s from %s", GetOpcodeNameForLogging(opcode).c_str(), GetPlayerName(false).c_str());
#endif
break;
case STATUS_UNHANDLED:
#ifdef WIN32
TC_LOG_ERROR("network.opcode", "Received not handled opcode %s from %s", GetOpcodeNameForLogging(opcode).c_str(), GetPlayerName(false).c_str());
#endif
break;
}
}
Expand Down
4 changes: 1 addition & 3 deletions src/server/game/Spells/Auras/SpellAuraEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1362,9 +1362,7 @@ float AuraEffect::CalculateAmount(Unit* caster)
if (target && target->IsPlayer() && (target->getRace() == RACE_PANDAREN_ALLIANCE || target->getRace() == RACE_PANDAREN_HORDE || target->getRace() == RACE_PANDAREN_NEUTRAL))
amount *= 2;

#ifdef WIN32
TC_LOG_DEBUG("spells", "AuraApplication::CalculateAmount GetId %i GetAuraType %u amount %i effIndex %i m_amount_mod %f m_amount_add %i GetStackAmount %u", GetId(), GetAuraType(), amount, m_effIndex, m_amount_mod, m_amount_add, GetBase()->GetStackAmount());
#endif
TC_LOG_DEBUG("spells", "AuraApplication::CalculateAmount GetId %i GetAuraType %u amount %f effIndex %i m_amount_mod %f m_amount_add %f GetStackAmount %u", GetId(), GetAuraType(), amount, m_effIndex, m_amount_mod, m_amount_add, GetBase()->GetStackAmount());

m_calc_amount = amount;
return amount;
Expand Down
4 changes: 1 addition & 3 deletions src/server/game/Spells/Auras/SpellAuras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,8 @@ void AuraApplication::_HandleEffect(uint8 effIndex, bool apply)
if(HasEffect(effIndex) != (!apply))
return;
ASSERT((1<<effIndex) & _effectsToApply);
#ifdef WIN32
TC_LOG_DEBUG("spells", "AuraApplication::_HandleEffect: GetId %i, GetAuraType %u, apply: %u: amount: %i, m_send_baseAmount: %i, effIndex: %i GetDuration %i, guid %u GetStackAmount %u GetComboPoints %u GetCharges %u",
TC_LOG_DEBUG("spells", "AuraApplication::_HandleEffect: GetId %i, GetAuraType %u, apply: %u: amount: %f, m_send_baseAmount: %f, effIndex: %i GetDuration %i, guid %u GetStackAmount %u GetComboPoints %u GetCharges %u",
GetBase()->GetId(), aurEff->GetAuraType(), apply, aurEff->GetAmount(), aurEff->GetBaseSendAmount(), effIndex, GetBase()->GetDuration(), GetBase()->GetOwner()->GetGUIDLow(), GetBase()->GetStackAmount(), GetBase()->GetComboPoints(), GetBase()->GetCharges());
#endif

if (apply)
{
Expand Down
Loading

0 comments on commit e469ac1

Please sign in to comment.