Core/Player: Log more information when Player::StopCastingCharm() fails

(cherry picked from commit af815e991d)
This commit is contained in:
jackpoz
2021-06-05 18:41:51 +02:00
committed by Shauren
parent 9a17ac108c
commit 89ea13ed46
4 changed files with 36 additions and 2 deletions

View File

@@ -22031,7 +22031,8 @@ void Player::StopCastingCharm()
TC_LOG_FATAL("entities.player", "Player::StopCastingCharm: Player '%s' (%s) is not able to uncharm unit (%s)", GetName().c_str(), GetGUID().ToString().c_str(), GetCharmedGUID().ToString().c_str());
if (!charm->GetCharmerGUID().IsEmpty())
{
TC_LOG_FATAL("entities.player", "Player::StopCastingCharm: Charmed unit has charmer %s", charm->GetCharmerGUID().ToString().c_str());
TC_LOG_FATAL("entities.player", "Player::StopCastingCharm: Charmed unit has charmer %s\nPlayer debug info: %s\nCharm debug info: %s",
charm->GetCharmerGUID().ToString().c_str(), GetDebugInfo().c_str(), charm->GetDebugInfo().c_str());
ABORT();
}

View File

@@ -13458,6 +13458,9 @@ std::string Unit::GetDebugInfo() const
<< "IsAIEnabled: " << IsAIEnabled() << " DeathState: " << std::to_string(getDeathState())
<< " UnitMovementFlags: " << GetUnitMovementFlags() << " ExtraUnitMovementFlags: " << GetExtraUnitMovementFlags()
<< " Class: " << std::to_string(GetClass()) << "\n"
<< " " << (movespline ? movespline->ToString() : "Movespline: <none>");
<< "" << (movespline ? movespline->ToString() : "Movespline: <none>\n")
<< "GetCharmedGUID(): " << GetCharmedGUID().ToString() << "\n"
<< "GetCharmerGUID(): " << GetCharmerGUID().ToString() << "\n"
<< "" << (GetVehicleKit() ? GetVehicleKit()->GetDebugInfo() : "No vehicle kit");
return sstr.str();
}

View File

@@ -31,6 +31,7 @@
#include "SpellAuraEffects.h"
#include "TemporarySummon.h"
#include "Unit.h"
#include <sstream>
Vehicle::Vehicle(Unit* unit, VehicleEntry const* vehInfo, uint32 creatureEntry) :
UsableSeatNum(0), _me(unit), _vehicleInfo(vehInfo), _creatureEntry(creatureEntry), _status(STATUS_NONE), _lastShootPos()
@@ -956,3 +957,30 @@ Milliseconds Vehicle::GetDespawnDelay()
return 1ms;
}
std::string Vehicle::GetDebugInfo() const
{
std::stringstream sstr;
sstr << "Vehicle seats:\n";
for (SeatMap::const_iterator itr = Seats.begin(); itr != Seats.end(); itr++)
{
sstr << "seat " << std::to_string(itr->first) << ": " << (itr->second.IsEmpty() ? "empty" : itr->second.Passenger.Guid.ToString()) << "\n";
}
sstr << "Vehicle pending events:";
if (_pendingJoinEvents.empty())
{
sstr << " none";
}
else
{
sstr << "\n";
for (PendingJoinEventContainer::const_iterator itr = _pendingJoinEvents.begin(); itr != _pendingJoinEvents.end(); ++itr)
{
sstr << "seat " << std::to_string((*itr)->Seat->first) << ": " << (*itr)->Passenger->GetGUID().ToString() << "\n";
}
}
return sstr.str();
}

View File

@@ -79,6 +79,8 @@ class TC_GAME_API Vehicle : public TransportBase
Milliseconds GetDespawnDelay();
std::string GetDebugInfo() const;
protected:
friend class VehicleJoinEvent;
uint32 UsableSeatNum; ///< Number of seats that match VehicleSeatEntry::UsableByPlayer, used for proper display flags