From 0236699b0a90f08e739ccc8c2656a426261a2000 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 10 Oct 2010 23:11:07 +0400 Subject: [PATCH] [10601] Amother attemp fix locale structures corruption. Possible real source of problem: existing in code mixed std:: structure templates instanting under pack pragma and out. And this incompatible structure layouts wrongly mixed used by GCC. So all std:: strcutures used moved out from pack pragma guards. --- src/game/Creature.h | 48 ++++++++++++++++++++-------------------- src/game/DBCStructure.h | 10 ++++----- src/game/GameObject.h | 13 +++++------ src/game/ItemPrototype.h | 14 ++++++------ src/game/NPCHandler.h | 15 ++++++------- src/shared/revision_nr.h | 2 +- 6 files changed, 50 insertions(+), 52 deletions(-) diff --git a/src/game/Creature.h b/src/game/Creature.h index d3826db89..07ae15551 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -161,23 +161,6 @@ struct CreatureInfo } }; -struct CreatureLocale -{ - std::vector Name; - std::vector SubName; -}; - -struct GossipMenuItemsLocale -{ - std::vector OptionText; - std::vector BoxText; -}; - -struct PointOfInterestLocale -{ - std::vector IconName; -}; - struct EquipmentInfo { uint32 entry; @@ -242,6 +225,30 @@ struct CreatureModelRace uint32 modelid_racial; // Explicit modelid. Used if creature_template entry is not defined }; +// 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 CreatureLocale +{ + std::vector Name; + std::vector SubName; +}; + +struct GossipMenuItemsLocale +{ + std::vector OptionText; + std::vector BoxText; +}; + +struct PointOfInterestLocale +{ + std::vector IconName; +}; + enum InhabitTypeValues { INHABIT_GROUND = 1, @@ -275,13 +282,6 @@ enum AttackingTarget */ }; -// 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 - // Vendors struct VendorItem { diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index fa973f63a..8cf299d3c 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1501,11 +1501,6 @@ struct SpellEntry SpellEntry(SpellEntry const&); // DON'T must have implementation }; -typedef std::set SpellCategorySet; -typedef std::map SpellCategoryStore; -typedef std::set PetFamilySpellsSet; -typedef std::map PetFamilySpellsStore; - struct SpellCastTimesEntry { uint32 ID; // 0 @@ -1856,6 +1851,11 @@ struct WorldSafeLocsEntry #pragma pack(pop) #endif +typedef std::set SpellCategorySet; +typedef std::map SpellCategoryStore; +typedef std::set PetFamilySpellsSet; +typedef std::map PetFamilySpellsStore; + // Structures not used for casting to loaded DBC data and not required then packing struct MapDifficulty { diff --git a/src/game/GameObject.h b/src/game/GameObject.h index 689bfe975..1f405f8ce 100644 --- a/src/game/GameObject.h +++ b/src/game/GameObject.h @@ -516,13 +516,6 @@ struct GameObjectInfo } }; -// By unknown reason GCC generate wrong code for locale structures declared in header after pack pragma -struct GameObjectLocale -{ - std::vector Name; - std::vector CastBarCaption; -}; - // 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() @@ -530,6 +523,12 @@ struct GameObjectLocale #pragma pack(pop) #endif +struct GameObjectLocale +{ + std::vector Name; + std::vector CastBarCaption; +}; + // client side GO show states enum GOState { diff --git a/src/game/ItemPrototype.h b/src/game/ItemPrototype.h index 10e60d85e..20b29e62f 100644 --- a/src/game/ItemPrototype.h +++ b/src/game/ItemPrototype.h @@ -656,17 +656,17 @@ struct ItemPrototype bool IsConjuredConsumable() const { return Class == ITEM_CLASS_CONSUMABLE && (Flags & ITEM_FLAGS_CONJURED); } }; -// By unknown reason GCC generate wrong code for locale structures declared in header after pack pragma -struct ItemLocale -{ - std::vector Name; - std::vector Description; -}; - // 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 ItemLocale +{ + std::vector Name; + std::vector Description; +}; + #endif diff --git a/src/game/NPCHandler.h b/src/game/NPCHandler.h index 680188cd1..9e4f4e99a 100644 --- a/src/game/NPCHandler.h +++ b/src/game/NPCHandler.h @@ -34,7 +34,13 @@ struct PageText uint32 Next_Page; }; -// By unknown reason GCC generate wrong code for locale structures declared in header after pack pragma +// 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 PageTextLocale { std::vector Text; @@ -48,13 +54,6 @@ struct NpcTextLocale std::vector > Text_1; }; -// 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 QEmote { uint32 _Emote; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 55b83908e..213ce5295 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10600" + #define REVISION_NR "10601" #endif // __REVISION_NR_H__