mirror of
https://github.com/mangosfour/server.git
synced 2025-12-18 10:37:01 +00:00
[8787] Cleanup in Errors.h.
This commit is contained in:
parent
33d475caf3
commit
611b17a431
3 changed files with 49 additions and 15 deletions
|
|
@ -277,7 +277,7 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 flags, uint32 flags2)
|
||||||
|
|
||||||
if(((Player*)this)->isInFlight())
|
if(((Player*)this)->isInFlight())
|
||||||
{
|
{
|
||||||
WPAssert(((Player*)this)->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE);
|
ASSERT(((Player*)this)->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE);
|
||||||
flags2 = (MOVEMENTFLAG_FORWARD | MOVEMENTFLAG_SPLINE2);
|
flags2 = (MOVEMENTFLAG_FORWARD | MOVEMENTFLAG_SPLINE2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -384,7 +384,7 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 flags, uint32 flags2)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
WPAssert(((Player*)this)->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE);
|
ASSERT(((Player*)this)->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE);
|
||||||
|
|
||||||
FlightPathMovementGenerator *fmg = (FlightPathMovementGenerator*)(((Player*)this)->GetMotionMaster()->top());
|
FlightPathMovementGenerator *fmg = (FlightPathMovementGenerator*)(((Player*)this)->GetMotionMaster()->top());
|
||||||
|
|
||||||
|
|
@ -616,7 +616,7 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask *
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WPAssert(updateMask && updateMask->GetCount() == m_valuesCount);
|
ASSERT(updateMask && updateMask->GetCount() == m_valuesCount);
|
||||||
|
|
||||||
*data << (uint8)updateMask->GetBlockCount();
|
*data << (uint8)updateMask->GetBlockCount();
|
||||||
data->append( updateMask->GetMask(), updateMask->GetLength() );
|
data->append( updateMask->GetMask(), updateMask->GetLength() );
|
||||||
|
|
|
||||||
|
|
@ -22,22 +22,56 @@
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
|
||||||
#ifndef HAVE_CONFIG_H
|
#ifndef HAVE_CONFIG_H
|
||||||
#define HAVE_ACE_STACK_TRACE_H 1
|
# define HAVE_ACE_STACK_TRACE_H 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_ACE_STACK_TRACE_H
|
#ifdef HAVE_ACE_STACK_TRACE_H
|
||||||
#include "ace/Stack_Trace.h"
|
# include "ace/Stack_Trace.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_ACE_STACK_TRACE_H // old versions ACE not have Stack_Trace.h but used at some oS for better compatibility
|
#ifdef HAVE_ACE_STACK_TRACE_H
|
||||||
#define WPAssert( assertion ) { if (!(assertion)) { ACE_Stack_Trace st; fprintf( stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n", __FILE__, __LINE__,__FUNCTION__, #assertion, st.c_str()); assert( #assertion &&0 ); } }
|
// Normal assert.
|
||||||
|
#define WPError(CONDITION) \
|
||||||
|
if (!(CONDITION)) \
|
||||||
|
{ \
|
||||||
|
ACE_Stack_Trace st; \
|
||||||
|
printf("%s:%i: Error: Assertion in %s failed: %s\nStack Trace:\n%s", \
|
||||||
|
__FILE__, __LINE__, __FUNCTION__, STRINGIZE(CONDITION), st.c_str()); \
|
||||||
|
assert(STRINGIZE(CONDITION) && 0); \
|
||||||
|
}
|
||||||
|
|
||||||
|
// Just warn.
|
||||||
|
#define WPWarning(CONDITION) \
|
||||||
|
if (!(CONDITION)) \
|
||||||
|
{ \
|
||||||
|
ACE_Stack_Trace st; \
|
||||||
|
printf("%s:%i: Warning: Assertion in %s failed: %s\nStack Trace:\n%s",\
|
||||||
|
__FILE__, __LINE__, __FUNCTION__, STRINGIZE(CONDITION), st.c_str()); \
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
#define WPAssert( assertion ) { if (!(assertion)) { fprintf( stderr, "\n%s:%i in %s ASSERTION FAILED2:\n %s\n", __FILE__, __LINE__,__FUNCTION__, #assertion); assert( #assertion &&0 ); } }
|
// Normal assert.
|
||||||
#endif
|
#define WPError(CONDITION) \
|
||||||
#define WPError( assertion, errmsg ) if( ! (assertion) ) { sLog.outError( "%\n%s:%i in %s ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); assert( false ); }
|
if (!(CONDITION)) \
|
||||||
#define WPWarning( assertion, errmsg ) if( ! (assertion) ) { sLog.outError( "\n%s:%i in %s WARNING:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); }
|
{ \
|
||||||
|
printf("%s:%i: Error: Assertion in %s failed: %s", \
|
||||||
|
__FILE__, __LINE__, __FUNCTION__, STRINGIZE(CONDITION)); \
|
||||||
|
assert(STRINGIZE(CONDITION) && 0); \
|
||||||
|
}
|
||||||
|
|
||||||
|
// Just warn.
|
||||||
|
#define WPWarning(CONDITION) \
|
||||||
|
if (!(CONDITION)) \
|
||||||
|
{ \
|
||||||
|
ACE_Stack_Trace st; \
|
||||||
|
printf("%s:%i: Warning: Assertion in %s failed: %s",\
|
||||||
|
__FILE__, __LINE__, __FUNCTION__, STRINGIZE(CONDITION)); \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MANGOS_DEBUG
|
||||||
|
# define ASSERT WPError
|
||||||
|
#else
|
||||||
|
# define ASSERT WPError // Error even if in release mode.
|
||||||
|
#endif
|
||||||
|
|
||||||
#define WPFatal( assertion, errmsg ) if( ! (assertion) ) { sLog.outError( "\n%s:%i in %s FATAL ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg ); assert( #assertion &&0 ); abort(); }
|
|
||||||
|
|
||||||
#define ASSERT WPAssert
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8786"
|
#define REVISION_NR "8787"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue