mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[11922] Add ASSERT helper function to print entry and guid info
Use this in first cases: GetAngle and in PathFinder::BuildPolyPath Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
parent
b03443c425
commit
49bd484a41
6 changed files with 23 additions and 11 deletions
|
|
@ -942,6 +942,9 @@ void GameObject::SwitchDoorOrButton(bool activate, bool alternative /* = false *
|
||||||
|
|
||||||
void GameObject::Use(Unit* user)
|
void GameObject::Use(Unit* user)
|
||||||
{
|
{
|
||||||
|
// user must be provided
|
||||||
|
MANGOS_ASSERT(user || PrintEntryError("GameObject::Use (without user)"));
|
||||||
|
|
||||||
// by default spell caster is user
|
// by default spell caster is user
|
||||||
Unit* spellCaster = user;
|
Unit* spellCaster = user;
|
||||||
uint32 spellId = 0;
|
uint32 spellId = 0;
|
||||||
|
|
|
||||||
|
|
@ -3214,11 +3214,9 @@ uint32 Map::GenerateLocalLowGuid(HighGuid guidhigh)
|
||||||
case HIGHGUID_VEHICLE:
|
case HIGHGUID_VEHICLE:
|
||||||
return m_VehicleGuids.Generate();
|
return m_VehicleGuids.Generate();
|
||||||
default:
|
default:
|
||||||
MANGOS_ASSERT(0);
|
MANGOS_ASSERT(false);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
MANGOS_ASSERT(0);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -883,6 +883,15 @@ bool Object::PrintIndexError(uint32 index, bool set) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Object::PrintEntryError(char const* descr) const
|
||||||
|
{
|
||||||
|
sLog.outError("Object Type %u, Entry %u (lowguid %u) with invalid call for %s", GetTypeId(), GetEntry(), GetObjectGuid().GetCounter(), descr);
|
||||||
|
|
||||||
|
// always false for continue assert fail
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Object::BuildUpdateDataForPlayer(Player* pl, UpdateDataMapType& update_players)
|
void Object::BuildUpdateDataForPlayer(Player* pl, UpdateDataMapType& update_players)
|
||||||
{
|
{
|
||||||
UpdateDataMapType::iterator iter = update_players.find(pl);
|
UpdateDataMapType::iterator iter = update_players.find(pl);
|
||||||
|
|
@ -1190,7 +1199,7 @@ float WorldObject::GetAngle(const WorldObject* obj) const
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
|
||||||
MANGOS_ASSERT(obj != this);
|
MANGOS_ASSERT(obj != this || PrintEntryError("GetAngle (for self)"));
|
||||||
|
|
||||||
return GetAngle(obj->GetPositionX(), obj->GetPositionY());
|
return GetAngle(obj->GetPositionX(), obj->GetPositionY());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -359,7 +359,6 @@ class MANGOS_DLL_SPEC Object
|
||||||
virtual bool HasInvolvedQuest(uint32 /* quest_id */) const { return false; }
|
virtual bool HasInvolvedQuest(uint32 /* quest_id */) const { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Object ( );
|
Object ( );
|
||||||
|
|
||||||
void _InitValues();
|
void _InitValues();
|
||||||
|
|
@ -396,10 +395,13 @@ class MANGOS_DLL_SPEC Object
|
||||||
|
|
||||||
PackedGuid m_PackGUID;
|
PackedGuid m_PackGUID;
|
||||||
|
|
||||||
// for output helpfull error messages from ASSERTs
|
|
||||||
bool PrintIndexError(uint32 index, bool set) const;
|
|
||||||
Object(const Object&); // prevent generation copy constructor
|
Object(const Object&); // prevent generation copy constructor
|
||||||
Object& operator=(Object const&); // prevent generation assigment operator
|
Object& operator=(Object const&); // prevent generation assigment operator
|
||||||
|
|
||||||
|
public:
|
||||||
|
// for output helpfull error messages from ASSERTs
|
||||||
|
bool PrintIndexError(uint32 index, bool set) const;
|
||||||
|
bool PrintEntryError(char const* descr) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct WorldObjectChangeAccumulator;
|
struct WorldObjectChangeAccumulator;
|
||||||
|
|
|
||||||
|
|
@ -259,8 +259,8 @@ void PathFinder::BuildPolyPath(const Vector3 &startPos, const Vector3 &endPos)
|
||||||
{
|
{
|
||||||
for (pathStartIndex = 0; pathStartIndex < m_polyLength; ++pathStartIndex)
|
for (pathStartIndex = 0; pathStartIndex < m_polyLength; ++pathStartIndex)
|
||||||
{
|
{
|
||||||
// here to carch few bugs
|
// here to catch few bugs
|
||||||
MANGOS_ASSERT(m_pathPolyRefs[pathStartIndex] != INVALID_POLYREF);
|
MANGOS_ASSERT(m_pathPolyRefs[pathStartIndex] != INVALID_POLYREF || m_sourceUnit->PrintEntryError("PathFinder::BuildPolyPath"));
|
||||||
|
|
||||||
if (m_pathPolyRefs[pathStartIndex] == startPoly)
|
if (m_pathPolyRefs[pathStartIndex] == startPoly)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "11921"
|
#define REVISION_NR "11922"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue