feat(Core/Misc): includes cleanup (#5953)

This commit is contained in:
Kargatum
2021-05-26 19:00:08 +07:00
committed by GitHub
parent 7d3129a737
commit 78e1719c80
46 changed files with 132 additions and 191 deletions

View File

@@ -6,6 +6,7 @@
#include "MMapFactory.h"
#include <set>
#include <cstring>
namespace MMAP
{

View File

@@ -13,6 +13,7 @@
#include "DetourExtended.h"
#include <unordered_map>
#include <shared_mutex>
#include <vector>
// memory management
inline void* dtCustomAlloc(size_t size, dtAllocHint /*hint*/)

View File

@@ -5,7 +5,6 @@
*/
#include "MapTree.h"
#include "Common.h"
#include "ModelInstance.h"
#include "VMapManager2.h"
#include "VMapDefinitions.h"
@@ -20,7 +19,6 @@ using G3D::Vector3;
namespace VMAP
{
class MapRayCallback
{
public:
@@ -144,7 +142,7 @@ namespace VMAP
{
float maxDist = (pos2 - pos1).magnitude();
// return false if distance is over max float, in case of cheater teleporting to the end of the universe
if (maxDist == std::numeric_limits<float>::max() || !myisfinite(maxDist))
if (maxDist == std::numeric_limits<float>::max() || !std::isfinite(maxDist))
return false;
// valid map coords should *never ever* produce float overflow, but this would produce NaNs too

View File

@@ -7,120 +7,36 @@
#ifndef AZEROTHCORE_COMMON_H
#define AZEROTHCORE_COMMON_H
// config.h needs to be included 1st
/// @todo this thingy looks like hack, but its not, need to
// make separate header however, because It makes mess here.
#ifdef HAVE_CONFIG_H
// Remove Some things that we will define
// This is in case including another config.h
// before trinity config.h
#ifdef PACKAGE
#undef PACKAGE
#endif //PACKAGE
#ifdef PACKAGE_BUGREPORT
#undef PACKAGE_BUGREPORT
#endif //PACKAGE_BUGREPORT
#ifdef PACKAGE_NAME
#undef PACKAGE_NAME
#endif //PACKAGE_NAME
#ifdef PACKAGE_STRING
#undef PACKAGE_STRING
#endif //PACKAGE_STRING
#ifdef PACKAGE_TARNAME
#undef PACKAGE_TARNAME
#endif //PACKAGE_TARNAME
#ifdef PACKAGE_VERSION
#undef PACKAGE_VERSION
#endif //PACKAGE_VERSION
#ifdef VERSION
#undef VERSION
#endif //VERSION
# include "Config.h"
#undef PACKAGE
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#undef VERSION
#endif //HAVE_CONFIG_H
#include "Define.h"
#include <cassert>
#include <cerrno>
#include <cmath>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <unordered_map>
#include <unordered_set>
#if AC_PLATFORM == AC_PLATFORM_WINDOWS
#define STRCASECMP stricmp
#else
#define STRCASECMP strcasecmp
#endif
#include <set>
#include <list>
#include <array>
#include <memory>
#include <string>
#include <map>
#include <queue>
#include <sstream>
#include <fstream>
#include <algorithm>
#include <vector>
#include "Threading/LockedQueue.h"
#include "Threading/Threading.h"
#include <ace/Stack_Trace.h>
#include <utility>
#if AC_PLATFORM == AC_PLATFORM_WINDOWS
# include <ace/config-all.h>
// XP winver - needed to compile with standard leak check in MemoryLeaks.h
// uncomment later if needed
//#define _WIN32_WINNT 0x0501
# include <ws2tcpip.h>
//#undef WIN32_WINNT
#include <ws2tcpip.h>
#if AC_COMPILER == AC_COMPILER_INTEL
# if !defined(BOOST_ASIO_HAS_MOVE)
# define BOOST_ASIO_HAS_MOVE
# endif // !defined(BOOST_ASIO_HAS_MOVE)
# endif // if WARHEAD_COMPILER == WARHEAD_COMPILER_INTEL
#else
# include <sys/types.h>
# include <sys/ioctl.h>
# include <sys/socket.h>
# include <netinet/in.h>
# include <unistd.h>
# include <netdb.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#include <netdb.h>
#include <cstdlib>
#endif
#if AC_COMPILER == AC_COMPILER_MICROSOFT
#include <float.h>
#define I32FMT "%08I32X"
#define I64FMT "%016I64X"
#define atoll _atoi64
#define vsnprintf _vsnprintf
#define llabs _abs64
#else
#define stricmp strcasecmp
#define strnicmp strncasecmp
#define I32FMT "%08X"
#define I64FMT "%016llX"
#endif
using namespace std;
inline float finiteAlways(float f) { return isfinite(f) ? f : 0.0f; }
inline bool myisfinite(float f) { return isfinite(f) && !isnan(f); }
#define STRINGIZE(a) #a
#define MAX_NETCLIENT_PACKET_SIZE (32767 - 1) // Client hardcap: int16 with trailing zero space otherwise crash on memory free
@@ -155,21 +71,20 @@ enum LocaleConstant
LOCALE_zhTW = 5,
LOCALE_esES = 6,
LOCALE_esMX = 7,
LOCALE_ruRU = 8
LOCALE_ruRU = 8,
TOTAL_LOCALES
};
const uint8 TOTAL_LOCALES = 9;
#define DEFAULT_LOCALE LOCALE_enUS
#define MAX_LOCALES 8
#define MAX_ACCOUNT_TUTORIAL_VALUES 8
extern char const* localeNames[TOTAL_LOCALES];
AC_COMMON_API extern char const* localeNames[TOTAL_LOCALES];
LocaleConstant GetLocaleByName(const std::string& name);
void CleanStringForMysqlQuery(std::string& str);
typedef std::vector<std::string> StringVector;
AC_COMMON_API LocaleConstant GetLocaleByName(const std::string& name);
AC_COMMON_API void CleanStringForMysqlQuery(std::string& str);
// we always use stdlibc++ std::max/std::min, undefine some not C++ standard defines (Win API and some other platforms)
#ifdef max

View File

@@ -7,17 +7,10 @@
#ifndef ACORE_DEFINE_H
#define ACORE_DEFINE_H
#include "CompilerDefs.h"
#include <cstddef>
#include <cstdint>
#include <cinttypes>
#include <climits>
#include <cstring>
#include <sys/types.h>
#include "CompilerDefs.h"
#if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__)
#define OS_WIN
#endif
#define ACORE_LITTLEENDIAN 0
#define ACORE_BIGENDIAN 1

View File

@@ -11,11 +11,10 @@
#ifndef _ACORE_GEOMETRY_H
#define _ACORE_GEOMETRY_H
#include <cmath>
#include "Define.h"
#include <iostream>
#include <cstdlib>
using namespace std;
#include <math.h>
[[nodiscard]] inline float getAngle(float startX, float startY, float destX, float destY)
{

View File

@@ -8,6 +8,7 @@
#include "Common.h"
#include <string_view>
#include <vector>
namespace acore
{

View File

@@ -6,14 +6,18 @@
#include "Util.h"
#include "Common.h"
#include "utf8.h"
#include "Log.h"
#include "Errors.h"
#include "TypeList.h"
#include "Errors.h" // for ASSERT
#include <array>
#include <cwchar>
#include "Containers.h"
// #include "IpAddress.h"
#include "StringConvert.h"
#include "StringFormat.h"
#include <utf8.h>
#include <algorithm>
#include <iomanip>
#include <sstream>
#include <string>
#include <cctype>
#include <cstdarg>
#include <ctime>
#include <ace/Default_Constants.h>
Tokenizer::Tokenizer(const std::string& src, const char sep, uint32 vectorReserve)