From aaa6e73c8ca6d60e943cb964605536eb78219db2 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 15 Aug 2023 20:10:04 +0200 Subject: Core/Logging: Switch from fmt::sprintf to fmt::format (c++20 standard compatible api) (cherry picked from commit d791afae1dfcfaf592326f787755ca32d629e4d3) --- src/server/game/Movement/MotionMaster.cpp | 78 +++++++++++++++---------------- 1 file changed, 39 insertions(+), 39 deletions(-) (limited to 'src/server/game/Movement/MotionMaster.cpp') diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 4a137dcce91..96f810f3792 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -575,7 +575,7 @@ void MotionMaster::MoveTargetedHome() Creature* owner = _owner->ToCreature(); if (!owner) { - TC_LOG_ERROR("movement.motionmaster", "MotionMaster::MoveTargetedHome: '%s', attempted to move towards target home.", _owner->GetGUID().ToString().c_str()); + TC_LOG_ERROR("movement.motionmaster", "MotionMaster::MoveTargetedHome: '{}', attempted to move towards target home.", _owner->GetGUID().ToString()); return; } @@ -584,12 +584,12 @@ void MotionMaster::MoveTargetedHome() Unit* target = owner->GetCharmerOrOwner(); if (!target) { - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveTargetedHome: '%s', targeted home.", _owner->GetGUID().ToString().c_str()); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveTargetedHome: '{}', targeted home.", _owner->GetGUID().ToString()); Add(new HomeMovementGenerator()); } else { - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveTargetedHome: '%s', starts following '%s'", _owner->GetGUID().ToString().c_str(), target->GetGUID().ToString().c_str()); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveTargetedHome: '{}', starts following '{}'", _owner->GetGUID().ToString(), target->GetGUID().ToString()); Add(new FollowMovementGenerator(target, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE)); } } @@ -598,7 +598,7 @@ void MotionMaster::MoveRandom(float wanderDistance) { if (_owner->GetTypeId() == TYPEID_UNIT) { - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveRandom: '%s', started random movement (spawnDist: %f)", _owner->GetGUID().ToString().c_str(), wanderDistance); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveRandom: '{}', started random movement (spawnDist: {})", _owner->GetGUID().ToString(), wanderDistance); Add(new RandomMovementGenerator(wanderDistance), MOTION_SLOT_DEFAULT); } } @@ -609,7 +609,7 @@ void MotionMaster::MoveFollow(Unit* target, float dist, ChaseAngle angle, Moveme if (!target || target == _owner) return; - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveFollow: '%s', starts following '%s'", _owner->GetGUID().ToString().c_str(), target->GetGUID().ToString().c_str()); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveFollow: '{}', starts following '{}'", _owner->GetGUID().ToString(), target->GetGUID().ToString()); Add(new FollowMovementGenerator(target, dist, angle), slot); } @@ -619,7 +619,7 @@ void MotionMaster::MoveChase(Unit* target, Optional dist, OptionalGetGUID().ToString().c_str(), target->GetGUID().ToString().c_str()); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveChase: '{}', starts chasing '{}'", _owner->GetGUID().ToString(), target->GetGUID().ToString()); Add(new ChaseMovementGenerator(target, dist, angle)); } @@ -627,12 +627,12 @@ void MotionMaster::MoveConfused() { if (_owner->GetTypeId() == TYPEID_PLAYER) { - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveConfused: '%s', started confused movement.", _owner->GetGUID().ToString().c_str()); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveConfused: '{}', started confused movement.", _owner->GetGUID().ToString()); Add(new ConfusedMovementGenerator()); } else { - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveConfused: '%s', started confused movement.", _owner->GetGUID().ToString().c_str()); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveConfused: '{}', started confused movement.", _owner->GetGUID().ToString()); Add(new ConfusedMovementGenerator()); } } @@ -642,7 +642,7 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time) if (!enemy) return; - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveFleeing: '%s', flees from '%s' (time: %u)", _owner->GetGUID().ToString().c_str(), enemy->GetGUID().ToString().c_str(), time); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveFleeing: '{}', flees from '{}' (time: {})", _owner->GetGUID().ToString(), enemy->GetGUID().ToString(), time); if (_owner->GetTypeId() == TYPEID_UNIT) { if (time) @@ -663,12 +663,12 @@ void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generate { if (_owner->GetTypeId() == TYPEID_PLAYER) { - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MovePoint: '%s', targeted point Id: %u (X: %f, Y: %f, Z: %f)", _owner->GetGUID().ToString().c_str(), id, x, y, z); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MovePoint: '{}', targeted point Id: {} (X: {}, Y: {}, Z: {})", _owner->GetGUID().ToString(), id, x, y, z); Add(new PointMovementGenerator(id, x, y, z, generatePath, 0.0f, finalOrient)); } else { - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MovePoint: '%s', targeted point Id: %u (X: %f, Y: %f, Z: %f)", _owner->GetGUID().ToString().c_str(), id, x, y, z); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MovePoint: '{}', targeted point Id: {} (X: {}, Y: {}, Z: {})", _owner->GetGUID().ToString(), id, x, y, z); Add(new PointMovementGenerator(id, x, y, z, generatePath, 0.0f, finalOrient)); } } @@ -697,7 +697,7 @@ void MotionMaster::MoveCloserAndStop(uint32 id, Unit* target, float distance) void MotionMaster::MoveLand(uint32 id, Position const& pos, Optional velocity /*= {}*/) { - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveLand: '%s', landing point Id: %u (X: %f, Y: %f, Z: %f)", _owner->GetGUID().ToString().c_str(), id, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveLand: '{}', landing point Id: {} (X: {}, Y: {}, Z: {})", _owner->GetGUID().ToString(), id, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()); std::function initializer = [=](Movement::MoveSplineInit& init) { @@ -711,7 +711,7 @@ void MotionMaster::MoveLand(uint32 id, Position const& pos, Optional velo void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, Optional velocity /*= {}*/) { - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveTakeoff: '%s', landing point Id: %u (X: %f, Y: %f, Z: %f)", _owner->GetGUID().ToString().c_str(), id, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveTakeoff: '{}', landing point Id: {} (X: {}, Y: {}, Z: {})", _owner->GetGUID().ToString(), id, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()); std::function initializer = [=](Movement::MoveSplineInit& init) { @@ -731,7 +731,7 @@ void MotionMaster::MoveCharge(float x, float y, float z, float speed /*= SPEED_C */ if (_owner->GetTypeId() == TYPEID_PLAYER) { - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveCharge: '%s', charging point Id: %u (X: %f, Y: %f, Z: %f)", _owner->GetGUID().ToString().c_str(), id, x, y, z); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveCharge: '{}', charging point Id: {} (X: {}, Y: {}, Z: {})", _owner->GetGUID().ToString(), id, x, y, z); PointMovementGenerator* movement = new PointMovementGenerator(id, x, y, z, generatePath, speed); movement->Priority = MOTION_PRIORITY_HIGHEST; movement->BaseUnitState = UNIT_STATE_CHARGING; @@ -739,7 +739,7 @@ void MotionMaster::MoveCharge(float x, float y, float z, float speed /*= SPEED_C } else { - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveCharge: '%s', charging point Id: %u (X: %f, Y: %f, Z: %f)", _owner->GetGUID().ToString().c_str(), id, x, y, z); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveCharge: '{}', charging point Id: {} (X: {}, Y: {}, Z: {})", _owner->GetGUID().ToString(), id, x, y, z); PointMovementGenerator* movement = new PointMovementGenerator(id, x, y, z, generatePath, speed); movement->Priority = MOTION_PRIORITY_HIGHEST; movement->BaseUnitState = UNIT_STATE_CHARGING; @@ -815,7 +815,7 @@ void MotionMaster::MoveJump(Position const& pos, float speedXY, float speedZ, ui void MotionMaster::MoveJump(float x, float y, float z, float o, float speedXY, float speedZ, uint32 id, bool hasOrientation /* = false*/) { - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveJump: '%s', jumps to point Id: %u (X: %f, Y: %f, Z: %f)", _owner->GetGUID().ToString().c_str(), id, x, y, z); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveJump: '{}', jumps to point Id: {} (X: {}, Y: {}, Z: {})", _owner->GetGUID().ToString(), id, x, y, z); if (speedXY < 0.01f) return; @@ -906,13 +906,13 @@ void MotionMaster::MoveAlongSplineChain(uint32 pointId, uint16 dbChainId, bool w Creature* owner = _owner->ToCreature(); if (!owner) { - TC_LOG_ERROR("movement.motionmaster", "MotionMaster::MoveAlongSplineChain: '%s', tried to walk along DB spline chain. Ignoring.", _owner->GetGUID().ToString().c_str()); + TC_LOG_ERROR("movement.motionmaster", "MotionMaster::MoveAlongSplineChain: '{}', tried to walk along DB spline chain. Ignoring.", _owner->GetGUID().ToString()); return; } std::vector const* chain = sScriptSystemMgr->GetSplineChain(owner, dbChainId); if (!chain) { - TC_LOG_ERROR("movement.motionmaster", "MotionMaster::MoveAlongSplineChain: '%s', tried to walk along non-existing spline chain with DB Id: %u.", _owner->GetGUID().ToString().c_str(), dbChainId); + TC_LOG_ERROR("movement.motionmaster", "MotionMaster::MoveAlongSplineChain: '{}', tried to walk along non-existing spline chain with DB Id: {}.", _owner->GetGUID().ToString(), dbChainId); return; } MoveAlongSplineChain(pointId, *chain, walk); @@ -927,7 +927,7 @@ void MotionMaster::ResumeSplineChain(SplineChainResumeInfo const& info) { if (info.Empty()) { - TC_LOG_ERROR("movement.motionmaster", "MotionMaster::ResumeSplineChain: '%s', tried to resume a spline chain from empty info.", _owner->GetGUID().ToString().c_str()); + TC_LOG_ERROR("movement.motionmaster", "MotionMaster::ResumeSplineChain: '{}', tried to resume a spline chain from empty info.", _owner->GetGUID().ToString()); return; } Add(new SplineChainMovementGenerator(info)); @@ -939,8 +939,8 @@ void MotionMaster::MoveFall(uint32 id/* = 0*/) float tz = _owner->GetMapHeight(_owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ(), true, MAX_FALL_DISTANCE); if (tz <= INVALID_HEIGHT) { - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveFall: '%s', unable to retrieve a proper height at map Id: %u (X: %f, Y: %f, Z: %f)", - _owner->GetGUID().ToString().c_str(), _owner->GetMap()->GetId(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ()); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveFall: '{}', unable to retrieve a proper height at map Id: {} (X: {}, Y: {}, Z: {})", + _owner->GetGUID().ToString(), _owner->GetMap()->GetId(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ()); return; } @@ -977,7 +977,7 @@ void MotionMaster::MoveSeekAssistance(float x, float y, float z) { if (Creature* creature = _owner->ToCreature()) { - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveSeekAssistance: '%s', seeks assistance (X: %f, Y: %f, Z: %f)", creature->GetGUID().ToString().c_str(), x, y, z); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveSeekAssistance: '{}', seeks assistance (X: {}, Y: {}, Z: {})", creature->GetGUID().ToString(), x, y, z); creature->AttackStop(); creature->CastStop(); creature->DoNotReacquireSpellFocusTarget(); @@ -985,18 +985,18 @@ void MotionMaster::MoveSeekAssistance(float x, float y, float z) Add(new AssistanceMovementGenerator(EVENT_ASSIST_MOVE, x, y, z)); } else - TC_LOG_ERROR("movement.motionmaster", "MotionMaster::MoveSeekAssistance: '%s', attempted to seek assistance.", _owner->GetGUID().ToString().c_str()); + TC_LOG_ERROR("movement.motionmaster", "MotionMaster::MoveSeekAssistance: '{}', attempted to seek assistance.", _owner->GetGUID().ToString()); } void MotionMaster::MoveSeekAssistanceDistract(uint32 time) { if (_owner->GetTypeId() == TYPEID_UNIT) { - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveSeekAssistanceDistract: '%s', is distracted after assistance call (Time: %u)", _owner->GetGUID().ToString().c_str(), time); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveSeekAssistanceDistract: '{}', is distracted after assistance call (Time: {})", _owner->GetGUID().ToString(), time); Add(new AssistanceDistractMovementGenerator(time, _owner->GetOrientation())); } else - TC_LOG_ERROR("movement.motionmaster", "MotionMaster::MoveSeekAssistanceDistract: '%s', attempted to call distract assistance.", _owner->GetGUID().ToString().c_str()); + TC_LOG_ERROR("movement.motionmaster", "MotionMaster::MoveSeekAssistanceDistract: '{}', attempted to call distract assistance.", _owner->GetGUID().ToString()); } void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode) @@ -1005,7 +1005,7 @@ void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode) { if (path < sTaxiPathNodesByPath.size()) { - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveTaxiFlight: '%s', taxi to path Id: %u (node %u)", _owner->GetGUID().ToString().c_str(), path, pathnode); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveTaxiFlight: '{}', taxi to path Id: {} (node {})", _owner->GetGUID().ToString(), path, pathnode); // Only one FLIGHT_MOTION_TYPE is allowed bool hasExisting = HasMovementGenerator([](MovementGenerator const* gen) { return gen->GetMovementGeneratorType() == FLIGHT_MOTION_TYPE; }); @@ -1016,10 +1016,10 @@ void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode) Add(movement); } else - TC_LOG_ERROR("movement.motionmaster", "MotionMaster::MoveTaxiFlight: '%s', attempted taxi to non-existing path Id: %u (node: %u)", _owner->GetGUID().ToString().c_str(), path, pathnode); + TC_LOG_ERROR("movement.motionmaster", "MotionMaster::MoveTaxiFlight: '{}', attempted taxi to non-existing path Id: {} (node: {})", _owner->GetGUID().ToString(), path, pathnode); } else - TC_LOG_ERROR("movement.motionmaster", "MotionMaster::MoveTaxiFlight: '%s', attempted taxi to path Id: %u (node: %u)", _owner->GetGUID().ToString().c_str(), path, pathnode); + TC_LOG_ERROR("movement.motionmaster", "MotionMaster::MoveTaxiFlight: '{}', attempted taxi to path Id: {} (node: {})", _owner->GetGUID().ToString(), path, pathnode); } void MotionMaster::MoveDistract(uint32 timer, float orientation) @@ -1028,7 +1028,7 @@ void MotionMaster::MoveDistract(uint32 timer, float orientation) if (_slot[MOTION_SLOT_CONTROLLED]) return; */ - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveDistract: '%s', distracted (timer: %u, orientation: %f)", _owner->GetGUID().ToString().c_str(), timer, orientation); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveDistract: '{}', distracted (timer: {}, orientation: {})", _owner->GetGUID().ToString(), timer, orientation); Add(new DistractMovementGenerator(timer, orientation)); } @@ -1037,13 +1037,13 @@ void MotionMaster::MovePath(uint32 pathId, bool repeatable) if (!pathId) return; - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MovePath: '%s', starts moving over path Id: %u (repeatable: %s)", _owner->GetGUID().ToString().c_str(), pathId, repeatable ? "YES" : "NO"); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MovePath: '{}', starts moving over path Id: {} (repeatable: {})", _owner->GetGUID().ToString(), pathId, repeatable ? "YES" : "NO"); Add(new WaypointMovementGenerator(pathId, repeatable), MOTION_SLOT_DEFAULT); } void MotionMaster::MovePath(WaypointPath& path, bool repeatable) { - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MovePath: '%s', starts moving over path Id: %u (repeatable: %s)", _owner->GetGUID().ToString().c_str(), path.id, repeatable ? "YES" : "NO"); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MovePath: '{}', starts moving over path Id: {} (repeatable: {})", _owner->GetGUID().ToString(), path.id, repeatable ? "YES" : "NO"); Add(new WaypointMovementGenerator(path, repeatable), MOTION_SLOT_DEFAULT); } @@ -1052,7 +1052,7 @@ void MotionMaster::MoveRotate(uint32 id, uint32 time, RotateDirection direction) if (!time) return; - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveRotate: '%s', starts rotate (time: %u, direction: %u)", _owner->GetGUID().ToString().c_str(), time, direction); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveRotate: '{}', starts rotate (time: {}, direction: {})", _owner->GetGUID().ToString(), time, direction); Add(new RotateMovementGenerator(id, time, direction)); } @@ -1060,7 +1060,7 @@ void MotionMaster::MoveFormation(Unit* leader, float range, float angle, uint32 { if (_owner->GetTypeId() == TYPEID_UNIT && leader) { - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveFormation: '%s', started to move in a formation with leader %s", _owner->GetGUID().ToString().c_str(), leader->GetGUID().ToString().c_str()); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::MoveFormation: '{}', started to move in a formation with leader {}", _owner->GetGUID().ToString(), leader->GetGUID().ToString()); Add(new FormationMovementGenerator(leader, range, angle, point1, point2), MOTION_SLOT_DEFAULT); } } @@ -1069,11 +1069,11 @@ void MotionMaster::LaunchMoveSpline(std::functionGetGUID().ToString().c_str(), type, id, priority); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::LaunchMoveSpline: '{}', tried to launch a spline with an invalid MovementGeneratorType: {} (Id: {}, Priority: {})", _owner->GetGUID().ToString(), type, id, priority); return; } - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::LaunchMoveSpline: '%s', initiates spline Id: %u (Type: %u, Priority: %u)", _owner->GetGUID().ToString().c_str(), id, type, priority); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::LaunchMoveSpline: '{}', initiates spline Id: {} (Type: {}, Priority: {})", _owner->GetGUID().ToString(), id, type, priority); GenericMovementGenerator* movement = new GenericMovementGenerator(std::move(initializer), type, id); movement->Priority = priority; @@ -1228,8 +1228,8 @@ void MotionMaster::DirectAdd(MovementGenerator* movement, MovementSlot slot/* = void MotionMaster::Delete(MovementGenerator* movement, bool active, bool movementInform) { - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::Delete: deleting generator (Priority: %u, Flags: %u, BaseUnitState: %u, Type: %u), owner: '%s'", - movement->Priority, movement->Flags, movement->BaseUnitState, movement->GetMovementGeneratorType(), _owner->GetGUID().ToString().c_str()); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::Delete: deleting generator (Priority: {}, Flags: {}, BaseUnitState: {}, Type: {}), owner: '{}'", + movement->Priority, movement->Flags, movement->BaseUnitState, movement->GetMovementGeneratorType(), _owner->GetGUID().ToString()); movement->Finalize(_owner, active, movementInform); ClearBaseUnitState(movement); @@ -1238,8 +1238,8 @@ void MotionMaster::Delete(MovementGenerator* movement, bool active, bool movemen void MotionMaster::DeleteDefault(bool active, bool movementInform) { - TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::DeleteDefault: deleting generator (Priority: %u, Flags: %u, BaseUnitState: %u, Type: %u), owner: '%s'", - _defaultGenerator->Priority, _defaultGenerator->Flags, _defaultGenerator->BaseUnitState, _defaultGenerator->GetMovementGeneratorType(), _owner->GetGUID().ToString().c_str()); + TC_LOG_DEBUG("movement.motionmaster", "MotionMaster::DeleteDefault: deleting generator (Priority: {}, Flags: {}, BaseUnitState: {}, Type: {}), owner: '{}'", + _defaultGenerator->Priority, _defaultGenerator->Flags, _defaultGenerator->BaseUnitState, _defaultGenerator->GetMovementGeneratorType(), _owner->GetGUID().ToString()); _defaultGenerator->Finalize(_owner, active, movementInform); _defaultGenerator = MovementGeneratorPointer(GetIdleMovementGenerator()); -- cgit v1.2.3