diff options
author | megamage <none@none> | 2009-08-11 10:53:29 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-08-11 10:53:29 -0500 |
commit | 3fa3c8b09897c63efa8ad55243a95ee3eff5e75e (patch) | |
tree | 92ba795b7c2e5b54ef5218338104d0f3c6a5dddd | |
parent | a944a0ea4b30dcde2eeb9ac60c8491c417b17f69 (diff) |
*Add function Unit::OutDebugInfo for debug.
--HG--
branch : trunk
-rw-r--r-- | src/game/Unit.cpp | 27 | ||||
-rw-r--r-- | src/game/Unit.h | 2 | ||||
-rw-r--r-- | src/shared/Log.cpp | 16 | ||||
-rw-r--r-- | src/shared/Log.h | 1 |
4 files changed, 45 insertions, 1 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 68d7b1fe02a..e372aafd7c0 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -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(); +} diff --git a/src/game/Unit.h b/src/game/Unit.h index 0c96f6a17e6..9ae293a577a 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -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 (); diff --git a/src/shared/Log.cpp b/src/shared/Log.cpp index 8dc23066245..117eabffb4a 100644 --- a/src/shared/Log.cpp +++ b/src/shared/Log.cpp @@ -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 ) diff --git a/src/shared/Log.h b/src/shared/Log.h index b3fb9f00b2e..40f09e4b29e 100644 --- a/src/shared/Log.h +++ b/src/shared/Log.h @@ -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); |