*Add function Unit::OutDebugInfo for debug.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-08-11 10:53:29 -05:00
parent a944a0ea4b
commit 3fa3c8b098
4 changed files with 45 additions and 1 deletions

View File

@@ -8984,7 +8984,13 @@ void Unit::SetMinion(Minion *minion, bool apply)
if(GetCharmGUID() == (*itr)->GetGUID())
continue;
assert((*itr)->GetOwnerGUID() == GetGUID());
//assert((*itr)->GetOwnerGUID() == GetGUID());
if((*itr)->GetOwnerGUID() != GetGUID())
{
OutDebugInfo();
(*itr)->OutDebugInfo();
assert(false);
}
assert((*itr)->GetTypeId() == TYPEID_UNIT);
if(!((Creature*)(*itr))->HasSummonMask(SUMMON_MASK_CONTROLABLE_GUARDIAN))
@@ -15273,3 +15279,22 @@ void Unit::RewardRage( uint32 damage, uint32 weaponSpeedHitFactor, bool attacker
ModifyPower(POWER_RAGE, uint32(addRage*10));
}
void Unit::OutDebugInfo()
{
sLog.outError("Unit::OutDebugInfo");
sLog.outString("GUID "UI64FMTD", entry %u, type %u, name %s", GetGUID(), GetEntry(), (uint32)GetTypeId(), GetName());
sLog.outString("OwnerGUID "UI64FMTD", MinionGUID "UI64FMTD", CharmerGUID "UI64FMTD", CharmedGUID "UI64FMTD, GetOwnerGUID(), GetMinionGUID(), GetCharmerGUID(), GetCharmGUID());
sLog.outStringInLine("Summon Slot: ");
for(uint32 i = 0; i < MAX_SUMMON_SLOT; ++i)
sLog.outStringInLine(UI64FMTD", ", m_SummonSlot[i]);
sLog.outString();
sLog.outStringInLine("Controlled List: ");
for(ControlList::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
sLog.outStringInLine(UI64FMTD", ", (*itr)->GetGUID());
sLog.outString();
sLog.outStringInLine("Aura List: ");
for(AuraMap::const_iterator itr = m_Auras.begin(); itr != m_Auras.end(); ++itr)
sLog.outStringInLine("%u, ", itr->first);
sLog.outString();
}

View File

@@ -1819,6 +1819,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void RewardRage( uint32 damage, uint32 weaponSpeedHitFactor, bool attacker );
virtual float GetFollowAngle() const { return M_PI/2; }
void OutDebugInfo();
protected:
explicit Unit ();

View File

@@ -702,6 +702,22 @@ void Log::outDebug( const char * str, ... )
fflush(stdout);
}
void Log::outStringInLine( const char * str, ... )
{
if( !str )
return;
UTF8PRINTF(stdout,str,);
if(logfile)
{
va_list ap;
va_start(ap, str);
vfprintf(logfile, str, ap);
va_end(ap);
}
}
void Log::outCommand( uint32 account, const char * str, ... )
{
if( !str )

View File

@@ -98,6 +98,7 @@ class Log : public Trinity::Singleton<Log, Trinity::ClassLevelLockable<Log, ACE_
void outDB( LogTypes type, const char * str );
void outString( const char * str, ... ) ATTR_PRINTF(2,3);
void outString( );
void outStringInLine( const char * str, ... ) ATTR_PRINTF(2,3);
void outError( const char * err, ... ) ATTR_PRINTF(2,3);
void outCrash( const char * err, ... ) ATTR_PRINTF(2,3);
void outBasic( const char * str, ... ) ATTR_PRINTF(2,3);