Core/Misc: Minor optimizations (+code changes to reduce differences with 4.3.4 branch)
Core/Logging: Create new logger type "Cheat". Will be used to log all cheat attempts
This commit is contained in:
1 parent
7c36e3a298
commit
1a6a23ec96
42 files changed
+375
-312
No files matched your search
@@ -0,0 +1,38 @@
|
||||
#include "Errors.h"
|
||||
#include "Log.h"
|
||||
|
||||
#include <ace/Stack_Trace.h>
|
||||
#include <ace/OS_NS_unistd.h>
|
||||
|
||||
namespace Trinity {
|
||||
|
||||
void Assert(char const *file, int line, char const *function, char const *message)
|
||||
{
|
||||
ACE_Stack_Trace st;
|
||||
fprintf(stderr, "\n%s:%i in %s ASSERTION FAILED:\n %s\n%s\n",
|
||||
file, line, function, message, st.c_str());
|
||||
*((volatile int*)NULL) = 0;
|
||||
}
|
||||
|
||||
void Fatal(char const *file, int line, char const *function, char const *message)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s FATAL ERROR:\n %s\n",
|
||||
file, line, function, message);
|
||||
ACE_OS::sleep(10);
|
||||
*((volatile int*)NULL) = 0;
|
||||
}
|
||||
|
||||
void Error(char const *file, int line, char const *function, char const *message)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s ERROR:\n %s\n",
|
||||
file, line, function, message);
|
||||
*((volatile int*)NULL) = 0;
|
||||
}
|
||||
|
||||
void Warning(char const *file, int line, char const *function, char const *message)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s WARNING:\n %s\n",
|
||||
file, line, function, message);
|
||||
}
|
||||
|
||||
} // namespace Trinity
|
||||
@@ -19,15 +19,23 @@
|
||||
#ifndef TRINITYCORE_ERRORS_H
|
||||
#define TRINITYCORE_ERRORS_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "Log.h"
|
||||
#include <ace/Stack_Trace.h>
|
||||
#include <ace/OS_NS_unistd.h>
|
||||
namespace Trinity {
|
||||
|
||||
#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()); *((volatile int*)NULL) = 0; } }
|
||||
#define WPError(assertion, errmsg) { if (!(assertion)) { sLog->outError(LOG_FILTER_GENERAL, "%\n%s:%i in %s ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); *((volatile int*)NULL) = 0; } }
|
||||
#define WPWarning(assertion, errmsg) { if (!(assertion)) { sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s WARNING:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); } }
|
||||
#define WPFatal(assertion, errmsg) { if (!(assertion)) { sLog->outError(LOG_FILTER_GENERAL, "\n%s:%i in %s FATAL ERROR:\n %s\n", __FILE__, __LINE__, __FUNCTION__, (char *)errmsg); ACE_OS::sleep(10); *((volatile int*)NULL) = 0; } }
|
||||
void Assert(char const *file, int line, char const *function, char const *message);
|
||||
|
||||
void Fatal(char const *file, int line, char const *function, char const *message);
|
||||
|
||||
void Error(char const *file, int line, char const *function, char const *message);
|
||||
|
||||
void Warning(char const *file, int line, char const *function, char const *message);
|
||||
|
||||
} // namespace Trinity
|
||||
|
||||
#define WPAssert(cond) do { if (!(cond)) Trinity::Assert(__FILE__, __LINE__, __FUNCTION__, #cond); } while(0)
|
||||
#define WPFatal(cond, msg) do { if (!(cond)) Trinity::Fatal(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0)
|
||||
#define WPError(cond, msg) do { if (!(cond)) Trinity::Error(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0)
|
||||
#define WPWarning(cond, msg) do { if (!(cond)) Trinity::Warning(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0)
|
||||
|
||||
#define ASSERT WPAssert
|
||||
|
||||
#endif
|
||||
@@ -3,6 +3,8 @@
|
||||
// MSDN Magazine, 2002
|
||||
// FILE: WheatyExceptionReport.CPP
|
||||
//==========================================
|
||||
#include "CompilerDefs.h"
|
||||
|
||||
#if PLATFORM == PLATFORM_WINDOWS && !defined(__MINGW32__)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#pragma warning(disable:4996)
|
||||
|
||||
Reference in new issue
Block a user