diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 286c9731692..11fcd32ee36 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -942,6 +942,9 @@ void GameObject::SwitchDoorOrButton(bool activate, bool alternative /* = false * void GameObject::Use(Unit* user) { + // user must be provided + MANGOS_ASSERT(user || PrintEntryError("GameObject::Use (without user)")); + // by default spell caster is user Unit* spellCaster = user; uint32 spellId = 0; diff --git a/src/game/Map.cpp b/src/game/Map.cpp index d6c5ac878e2..0b6cedfd476 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -3214,11 +3214,9 @@ uint32 Map::GenerateLocalLowGuid(HighGuid guidhigh) case HIGHGUID_VEHICLE: return m_VehicleGuids.Generate(); default: - MANGOS_ASSERT(0); + MANGOS_ASSERT(false); + return 0; } - - MANGOS_ASSERT(0); - return 0; } /** diff --git a/src/game/Object.cpp b/src/game/Object.cpp index b40c0e2facc..ea5cd2b9126 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -883,6 +883,15 @@ bool Object::PrintIndexError(uint32 index, bool set) const 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) { UpdateDataMapType::iterator iter = update_players.find(pl); @@ -1190,7 +1199,7 @@ float WorldObject::GetAngle(const WorldObject* obj) const if (!obj) return 0.0f; - MANGOS_ASSERT(obj != this); + MANGOS_ASSERT(obj != this || PrintEntryError("GetAngle (for self)")); return GetAngle(obj->GetPositionX(), obj->GetPositionY()); } diff --git a/src/game/Object.h b/src/game/Object.h index 98e0738aff5..9e3ac08923c 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -359,7 +359,6 @@ class MANGOS_DLL_SPEC Object virtual bool HasInvolvedQuest(uint32 /* quest_id */) const { return false; } protected: - Object ( ); void _InitValues(); @@ -396,10 +395,13 @@ class MANGOS_DLL_SPEC Object 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& 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; diff --git a/src/game/PathFinder.cpp b/src/game/PathFinder.cpp index 673c00622e4..1c0b5441476 100644 --- a/src/game/PathFinder.cpp +++ b/src/game/PathFinder.cpp @@ -259,8 +259,8 @@ void PathFinder::BuildPolyPath(const Vector3 &startPos, const Vector3 &endPos) { for (pathStartIndex = 0; pathStartIndex < m_polyLength; ++pathStartIndex) { - // here to carch few bugs - MANGOS_ASSERT(m_pathPolyRefs[pathStartIndex] != INVALID_POLYREF); + // here to catch few bugs + MANGOS_ASSERT(m_pathPolyRefs[pathStartIndex] != INVALID_POLYREF || m_sourceUnit->PrintEntryError("PathFinder::BuildPolyPath")); if (m_pathPolyRefs[pathStartIndex] == startPoly) { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 547bccd4a44..99aac5c92ac 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11921" + #define REVISION_NR "11922" #endif // __REVISION_NR_H__