Skip to content

Commit

Permalink
[11325] Made recently added coordinates check only for debug build mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirMangos committed Apr 7, 2011
1 parent a93cd72 commit c3ab258
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
6 changes: 1 addition & 5 deletions src/game/Creature.cpp
Expand Up @@ -2142,11 +2142,7 @@ void Creature::GetRespawnCoord( float &x, float &y, float &z, float* ori, float*
}

//lets check if our creatures have valid spawn coordinates
if(!MaNGOS::IsValidMapCoord(x, y, z))
{
sLog.outError("Creature with invalid respawn coordinates: mapid = %u, guid = %u, x = %f, y = %f, z = %f", GetMapId(), GetGUIDLow(), x, y, z);
MANGOS_ASSERT(false);
}
MANGOS_ASSERT(MaNGOS::IsValidMapCoord(x, y, z) || PrintCoordinatesError(x, y, z, "respawn"));
}

void Creature::AllLootRemovedFromCorpse()
Expand Down
1 change: 0 additions & 1 deletion src/game/Map.h
Expand Up @@ -165,7 +165,6 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>

bool CreatureRespawnRelocation(Creature *c); // used only in CreatureRelocation and ObjectGridUnloader

// ASSERT print helper
bool CheckGridIntegrity(Creature* c, bool moved) const;

uint32 GetInstanceId() const { return i_InstanceId; }
Expand Down
6 changes: 6 additions & 0 deletions src/game/Object.cpp
Expand Up @@ -2011,4 +2011,10 @@ bool WorldObject::IsControlledByPlayer() const
default:
return false;
}
}

bool WorldObject::PrintCoordinatesError(float x, float y, float z, char const* descr) const
{
sLog.outError("%s with invalid %s coordinates: mapid = %uu, x = %f, y = %f, z = %f", GetGuidStr().c_str(), descr, GetMapId(), x, y, z);
return false; // always false for continue assert fail
}
3 changes: 3 additions & 0 deletions src/game/Object.h
Expand Up @@ -576,6 +576,9 @@ class MANGOS_DLL_SPEC WorldObject : public Object
bool isActiveObject() const { return m_isActiveObject || m_viewPoint.hasViewers(); }

ViewPoint& GetViewPoint() { return m_viewPoint; }

// ASSERT print helper
bool PrintCoordinatesError(float x, float y, float z, char const* descr) const;
protected:
explicit WorldObject();

Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11324"
#define REVISION_NR "11325"
#endif // __REVISION_NR_H__

3 comments on commit c3ab258

@Ambal
Copy link
Contributor

@Ambal Ambal commented on c3ab258 Apr 7, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vlad, how is this better than original check, I don't get? In release builds ppl will still get assertion failure with MANGOS_ASSERT usage O.o You could just use assert() or whatever macro we use.

@wolfiestyle
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

release builds define -DNDEBUG so should skip the assert's

@Ambal
Copy link
Contributor

@Ambal Ambal commented on c3ab258 Apr 7, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see, we are not using _wassert() calls in release builds anymore.

Please sign in to comment.