mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 02:46:33 +01:00
Core/Misc: Removed gcc specific packing pragma syntax - only unsupported (now) versions required it
This commit is contained in:
@@ -28,6 +28,12 @@
|
||||
|
||||
namespace Battlenet
|
||||
{
|
||||
union FloatToInt
|
||||
{
|
||||
float AsFloat;
|
||||
uint32 AsInt;
|
||||
};
|
||||
|
||||
class BitStreamPositionException : public std::exception
|
||||
{
|
||||
static uint32 const MessageSize = 128;
|
||||
@@ -102,8 +108,14 @@ namespace Battlenet
|
||||
|
||||
float ReadFloat()
|
||||
{
|
||||
uint32 val = Read<uint32>(32);
|
||||
return *reinterpret_cast<float*>(&val);
|
||||
union
|
||||
{
|
||||
float AsFloat;
|
||||
uint32 AsInt;
|
||||
} convert;
|
||||
|
||||
convert.AsInt = Read<uint32>(32);
|
||||
return convert.AsFloat;
|
||||
}
|
||||
|
||||
std::string ReadFourCC()
|
||||
@@ -167,8 +179,14 @@ namespace Battlenet
|
||||
|
||||
void WriteFloat(float value)
|
||||
{
|
||||
uint32 intVal = *reinterpret_cast<uint32*>(&value);
|
||||
Write(intVal, 32);
|
||||
union
|
||||
{
|
||||
float AsFloat;
|
||||
uint32 AsInt;
|
||||
} convert;
|
||||
|
||||
convert.AsFloat = value;
|
||||
Write(convert.AsInt, 32);
|
||||
}
|
||||
|
||||
void WriteFourCC(std::string const& fcc)
|
||||
|
||||
@@ -29,13 +29,7 @@
|
||||
#include <vector>
|
||||
|
||||
// Structures using to access raw DBC data and required packing to portability
|
||||
|
||||
// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push, N), also any gcc version not support it at some platform
|
||||
#if defined(__GNUC__)
|
||||
#pragma pack(1)
|
||||
#else
|
||||
#pragma pack(push, 1)
|
||||
#endif
|
||||
|
||||
struct AchievementEntry
|
||||
{
|
||||
@@ -2058,12 +2052,7 @@ struct WorldStateUI
|
||||
};
|
||||
*/
|
||||
|
||||
// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform
|
||||
#if defined(__GNUC__)
|
||||
#pragma pack()
|
||||
#else
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
struct VectorArray
|
||||
{
|
||||
|
||||
@@ -209,12 +209,7 @@ typedef std::unordered_map<uint32, CreatureQuestItemList> CreatureQuestItemMap;
|
||||
// Benchmarked: Faster than std::map (insert/find)
|
||||
typedef std::unordered_map<uint32, CreatureTemplate> CreatureTemplateContainer;
|
||||
|
||||
// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push, N), also any gcc version not support it at some platform
|
||||
#if defined(__GNUC__)
|
||||
#pragma pack(1)
|
||||
#else
|
||||
#pragma pack(push, 1)
|
||||
#endif
|
||||
|
||||
// Defines base stats for creatures (used to calculate HP/mana/armor/attackpower/rangedattackpower/all damage).
|
||||
struct CreatureBaseStats
|
||||
@@ -349,12 +344,7 @@ enum ChatType
|
||||
CHAT_TYPE_END = 255
|
||||
};
|
||||
|
||||
// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform
|
||||
#if defined(__GNUC__)
|
||||
#pragma pack()
|
||||
#else
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
// `creature_addon` table
|
||||
struct CreatureAddon
|
||||
|
||||
@@ -48,12 +48,7 @@ struct AccessRequirement;
|
||||
struct PlayerInfo;
|
||||
struct PlayerLevelInfo;
|
||||
|
||||
// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push, N), also any gcc version not support it at some platform
|
||||
#if defined(__GNUC__)
|
||||
#pragma pack(1)
|
||||
#else
|
||||
#pragma pack(push, 1)
|
||||
#endif
|
||||
|
||||
struct PageText
|
||||
{
|
||||
@@ -81,12 +76,7 @@ private:
|
||||
uint8 _summonGroup; ///< Summon's group id
|
||||
};
|
||||
|
||||
// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform
|
||||
#if defined(__GNUC__)
|
||||
#pragma pack()
|
||||
#else
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
// DB scripting commands
|
||||
enum ScriptCommands
|
||||
|
||||
@@ -212,12 +212,7 @@ public:
|
||||
ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = 0);
|
||||
};
|
||||
|
||||
// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push, N), also any gcc version not support it at some platform
|
||||
#if defined(__GNUC__)
|
||||
#pragma pack(1)
|
||||
#else
|
||||
#pragma pack(push, 1)
|
||||
#endif
|
||||
|
||||
struct InstanceTemplate
|
||||
{
|
||||
@@ -242,11 +237,7 @@ struct ZoneDynamicInfo
|
||||
uint32 LightFadeInTime;
|
||||
};
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#pragma pack()
|
||||
#else
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#define MAX_HEIGHT 100000.0f // can be use for find ground height at surface
|
||||
#define INVALID_HEIGHT -100000.0f // for check, must be equal to VMAP_INVALID_HEIGHT, real value for unknown height is VMAP_INVALID_HEIGHT_VALUE
|
||||
|
||||
@@ -23,11 +23,7 @@
|
||||
|
||||
namespace Movement
|
||||
{
|
||||
#if defined( __GNUC__ )
|
||||
#pragma pack(1)
|
||||
#else
|
||||
#pragma pack(push, 1)
|
||||
#endif
|
||||
|
||||
class MoveSplineFlag
|
||||
{
|
||||
@@ -143,11 +139,7 @@ namespace Movement
|
||||
bool unknown8 : 1;
|
||||
bool unknown9 : 1;
|
||||
};
|
||||
#if defined( __GNUC__ )
|
||||
#pragma pack()
|
||||
#else
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // TRINITYSERVER_MOVESPLINEFLAG_H
|
||||
|
||||
@@ -1685,11 +1685,7 @@ enum PacketProcessing
|
||||
class WorldPacket;
|
||||
class WorldSession;
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#pragma pack(1)
|
||||
#else
|
||||
#pragma pack(push, 1)
|
||||
#endif
|
||||
|
||||
class OpcodeHandler
|
||||
{
|
||||
@@ -1766,11 +1762,7 @@ class OpcodeTable
|
||||
|
||||
extern OpcodeTable opcodeTable;
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#pragma pack()
|
||||
#else
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
void InitOpcodes();
|
||||
|
||||
|
||||
@@ -57,11 +57,7 @@ enum WardenCheckType
|
||||
MODULE_CHECK = 0xD9 // 217: uint Seed + byte[20] SHA1 (check to ensure module isn't injected)
|
||||
};
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#pragma pack(1)
|
||||
#else
|
||||
#pragma pack(push, 1)
|
||||
#endif
|
||||
|
||||
struct WardenModuleUse
|
||||
{
|
||||
@@ -84,11 +80,7 @@ struct WardenHashRequest
|
||||
uint8 Seed[16];
|
||||
};
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#pragma pack()
|
||||
#else
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
struct ClientWardenModule
|
||||
{
|
||||
|
||||
@@ -25,11 +25,7 @@
|
||||
#include "ByteBuffer.h"
|
||||
#include "Warden.h"
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#pragma pack(1)
|
||||
#else
|
||||
#pragma pack(push, 1)
|
||||
#endif
|
||||
|
||||
struct WardenInitModuleRequest
|
||||
{
|
||||
@@ -61,11 +57,7 @@ struct WardenInitModuleRequest
|
||||
uint8 Function3_set;
|
||||
};
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#pragma pack()
|
||||
#else
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
class WorldSession;
|
||||
class Warden;
|
||||
|
||||
@@ -133,22 +133,14 @@ LocaleConstant GetLocaleByName(const std::string& name);
|
||||
|
||||
typedef std::vector<std::string> StringVector;
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#pragma pack(1)
|
||||
#else
|
||||
#pragma pack(push, 1)
|
||||
#endif
|
||||
|
||||
struct LocalizedString
|
||||
{
|
||||
char const* Str[TOTAL_LOCALES];
|
||||
};
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#pragma pack()
|
||||
#else
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
// we always use stdlibc++ std::max/std::min, undefine some not C++ standard defines (Win API and some other platforms)
|
||||
#ifdef max
|
||||
|
||||
@@ -267,11 +267,7 @@ class Field
|
||||
Field();
|
||||
~Field();
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#pragma pack(1)
|
||||
#else
|
||||
#pragma pack(push, 1)
|
||||
#endif
|
||||
struct
|
||||
{
|
||||
uint32 length; // Length (prepared strings only)
|
||||
@@ -279,11 +275,7 @@ class Field
|
||||
enum_field_types type; // Field type
|
||||
bool raw; // Raw bytes? (Prepared statement or ad hoc)
|
||||
} data;
|
||||
#if defined(__GNUC__)
|
||||
#pragma pack()
|
||||
#else
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
void SetByteValue(void const* newValue, size_t const newSize, enum_field_types newType, uint32 length);
|
||||
void SetStructuredValue(char* newValue, enum_field_types newType, uint32 length);
|
||||
|
||||
Reference in New Issue
Block a user