*Fix a bug that causes crash when player data is corrupted. By Rognar.

--HG--
branch : trunk
This commit is contained in:
megamage
2008-12-19 22:46:18 -06:00
parent 8545728daa
commit d7c37e157a
2 changed files with 8 additions and 2 deletions
+1 -1
View File
@@ -473,7 +473,7 @@ Player::~Player ()
for(BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr)
itr->second.save->RemovePlayer(this);
if (isPossessing())
if (m_uint32Values && isPossessing())
RemovePossess(false);
delete m_declinedname;
+7 -1
View File
@@ -1084,7 +1084,13 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
bool isCharmed() const { return GetCharmerGUID() != 0; }
bool isPossessed() const { return m_isPossessed; }
bool isPossessedByPlayer() const { return m_isPossessed && IS_PLAYER_GUID(GetCharmerGUID()); }
bool isPossessing() const { return GetCharm() && GetCharm()->isPossessed(); }
bool isPossessing() const
{
if(Unit *u = GetCharm())
return u->isPossessed();
else
return false;
}
bool isPossessing(Unit* u) const { return u->isPossessed() && GetCharmGUID() == u->GetGUID(); }
bool isPossessingCreature() const { return isPossessing() && IS_CREATURE_GUID(GetCharmGUID()); }