aboutsummaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorQAston <none@none>2009-02-02 17:01:56 +0100
committerQAston <none@none>2009-02-02 17:01:56 +0100
commitc385b529976146a29916d1b1cc4f63a2d9ba258e (patch)
tree28da5fb101ab1ba52b343e6b28d29141ec1af437 /src/shared
parentbb39eba6c7f28fc0e1ded0af29fe63e6c5a863ef (diff)
*Fix a typo in prev commit
*Use flag96 instead of unit64+unit32. --HG-- branch : trunk
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/Common.h2
-rw-r--r--src/shared/Database/DBCStores.cpp4
-rw-r--r--src/shared/Database/DBCStructure.h8
-rw-r--r--src/shared/Util.h229
4 files changed, 236 insertions, 7 deletions
diff --git a/src/shared/Common.h b/src/shared/Common.h
index 684776a694f..5c8fae4ef25 100644
--- a/src/shared/Common.h
+++ b/src/shared/Common.h
@@ -80,6 +80,8 @@
#pragma warning(disable:4305)
#pragma warning(disable:4005)
+
+#pragma warning(disable:4522)//warning when class has 2 constructosr
#endif // __SHOW_STUPID_WARNINGS__
#endif // __GNUC__
diff --git a/src/shared/Database/DBCStores.cpp b/src/shared/Database/DBCStores.cpp
index 5d8d1720542..5ed797cad55 100644
--- a/src/shared/Database/DBCStores.cpp
+++ b/src/shared/Database/DBCStores.cpp
@@ -289,11 +289,11 @@ void LoadDBCStores(const std::string& dataPath)
if(spell && spell->Category)
sSpellCategoryStore[spell->Category].insert(i);
- // DBC not support uint64 fields but SpellEntry have SpellFamilyFlags mapped at 2 uint32 fields
+ /*// DBC not support uint64 fields but SpellEntry have SpellFamilyFlags mapped at 2 uint32 fields
// uint32 field already converted to bigendian if need, but must be swapped for correct uint64 bigendian view
#if TRINITY_ENDIAN == TRINITY_BIGENDIAN
std::swap(*((uint32*)(&spell->SpellFamilyFlags)),*(((uint32*)(&spell->SpellFamilyFlags))+1));
- #endif
+ #endif*/
}
for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j)
diff --git a/src/shared/Database/DBCStructure.h b/src/shared/Database/DBCStructure.h
index 9c3661ffbac..4221d08377f 100644
--- a/src/shared/Database/DBCStructure.h
+++ b/src/shared/Database/DBCStructure.h
@@ -23,6 +23,7 @@
#include "DBCEnums.h"
#include "Platform/Define.h"
+#include "Util.h"
#include <map>
#include <set>
@@ -1149,9 +1150,7 @@ struct SpellEntry
int32 EffectMiscValueB[3]; // 116-118 m_effectMiscValueB
uint32 EffectTriggerSpell[3]; // 119-121 m_effectTriggerSpell
float EffectPointsPerComboPoint[3]; // 122-124 m_effectPointsPerCombo
- uint32 EffectSpellClassMaskA[3]; // 125-127 m_effectSpellClassMaskA
- uint32 EffectSpellClassMaskB[3]; // 128-130 m_effectSpellClassMaskB
- uint32 EffectSpellClassMaskC[3]; // 131-133 m_effectSpellClassMaskC
+ flag96 EffectSpellClassMask[3]; //
uint32 SpellVisual[2]; // 134-135 m_spellVisualID
uint32 SpellIconID; // 136 m_spellIconID
uint32 activeIconID; // 137 m_activeIconID
@@ -1169,8 +1168,7 @@ struct SpellEntry
uint32 StartRecoveryTime; // 209 m_startRecoveryTime
uint32 MaxTargetLevel; // 210 m_maxTargetLevel
uint32 SpellFamilyName; // 211 m_spellClassSet
- uint64 SpellFamilyFlags; // 212-213 m_spellClassMask NOTE: size is 12 bytes!!!
- uint32 SpellFamilyFlags2; // 214 addition to m_spellClassMask
+ flag96 SpellFamilyFlags; // 212-214
uint32 MaxAffectedTargets; // 215 m_maxTargets
uint32 DmgClass; // 216 m_defenseType
uint32 PreventionType; // 217 m_preventionType
diff --git a/src/shared/Util.h b/src/shared/Util.h
index 95bc8ec1028..fed87fd0ff2 100644
--- a/src/shared/Util.h
+++ b/src/shared/Util.h
@@ -316,3 +316,232 @@ bool IsIPAddress(char const* ipaddress);
uint32 CreatePIDFile(const std::string& filename);
#endif
+
+//handler for operations on large flags
+#ifndef _FLAG96
+#define _FLAG96
+
+class flag96
+{
+private:
+ uint32 part[3];
+public:
+ flag96(uint32 p1=0,uint32 p2=0,uint32 p3=0)
+ {
+ part[0]=p1;
+ part[1]=p2;
+ part[2]=p3;
+ }
+
+ inline bool IsEqual(uint32 p1=0, uint32 p2=0, uint32 p3=0) const
+ {
+ return (
+ part[0]==p1 &&
+ part[1]==p2 &&
+ part[2]==p3);
+ };
+
+ inline bool HasFlag(uint32 p1=0, uint32 p2=0, uint32 p3=0) const
+ {
+ return (
+ part[0]&p1 ||
+ part[1]&p2 ||
+ part[2]&p3);
+ };
+
+ inline void Set(uint32 p1=0, uint32 p2=0, uint32 p3=0)
+ {
+ part[0]=p1;
+ part[1]=p2;
+ part[2]=p3;
+ };
+
+ template<class type>
+ inline bool operator < (type & right)
+ {
+ for (uint8 i=3;i>0;i--)
+ {
+ if (part[i-1]<right.part[i-1])
+ return 1;
+ else if (part[i-1]>right.part[i-1])
+ return 0;
+ }
+ return 0;
+ };
+
+ template<class type>
+ inline bool operator < (type & right) const
+ {
+ for (uint8 i=3;i>0;i--)
+ {
+ if (part[i-1]<right.part[i-1])
+ return 1;
+ else if (part[i-1]>right.part[i-1])
+ return 0;
+ }
+ return 0;
+ };
+
+ template<class type>
+ inline bool operator != (type & right)
+ {
+ if (part[0]!=right.part[0]
+ || part[1]!=right.part[1]
+ || part[2]!=right.part[2])
+ return true;
+ return false;
+ }
+
+ template<class type>
+ inline bool operator != (type & right) const
+ {
+ if (part[0]!=right.part[0]
+ || part[1]!=right.part[1]
+ || part[2]!=right.part[2])
+ return true;
+ return false;
+ };
+
+ template<class type>
+ inline bool operator == (type & right)
+ {
+ if (part[0]!=right.part[0]
+ || part[1]!=right.part[1]
+ || part[2]!=right.part[2])
+ return false;
+ return true;
+ };
+
+ template<class type>
+ inline bool operator == (type & right) const
+ {
+ if (part[0]!=right.part[0]
+ || part[1]!=right.part[1]
+ || part[2]!=right.part[2])
+ return false;
+ return true;
+ };
+
+ template<class type>
+ inline void operator = (type & right)
+ {
+ part[0]=right.part[0];
+ part[1]=right.part[1];
+ part[2]=right.part[2];
+ };
+
+ template<class type>
+ inline flag96 operator & (type & right)
+ {
+ flag96 ret(part[0] & right.part[0],part[1] & right.part[1],part[2] & right.part[2]);
+ return
+ ret;
+ };
+ template<class type>
+ inline flag96 operator & (type & right) const
+ {
+ flag96 ret(part[0] & right.part[0],part[1] & right.part[1],part[2] & right.part[2]);
+ return
+ ret;
+ };
+
+ template<class type>
+ inline void operator &= (type & right)
+ {
+ *this=*this & right;
+ };
+
+ template<class type>
+ inline flag96 operator | (type & right)
+ {
+ flag96 ret(part[0] | right.part[0],part[1] | right.part[1],part[2] | right.part[2]);
+ return
+ ret;
+ };
+
+ template<class type>
+ inline flag96 operator | (type & right) const
+ {
+ flag96 ret(part[0] | right.part[0],part[1] | right.part[1],part[2] | right.part[2]);
+ return
+ ret;
+ };
+
+ template<class type>
+ inline void operator |= (type & right)
+ {
+ *this=*this | right;
+ };
+
+ inline void operator ~ ()
+ {
+ part[2]=~part[2];
+ part[1]=~part[1];
+ part[0]=~part[0];
+ };
+
+ template<class type>
+ inline flag96 operator ^ (type & right)
+ {
+ flag96 ret(part[0] ^ right.part[0],part[1] ^ right.part[1],part[2] ^ right.part[2]);
+ return
+ ret;
+ };
+
+ template<class type>
+ inline flag96 operator ^ (type & right) const
+ {
+ flag96 ret(part[0] ^ right.part[0],part[1] ^ right.part[1],part[2] ^ right.part[2]);
+ return
+ ret;
+ };
+
+ template<class type>
+ inline void operator ^= (type & right)
+ {
+ *this=*this^right;
+ };
+
+ inline operator bool() const
+ {
+ return(
+ part[0] != 0 ||
+ part[1] != 0 ||
+ part[2] != 0);
+ };
+
+ inline operator bool()
+ {
+ return(
+ part[0] != 0 ||
+ part[1] != 0 ||
+ part[2] != 0);
+ };
+
+ inline bool operator ! () const
+ {
+ return(
+ part[0] == 0 &&
+ part[1] == 0 &&
+ part[2] == 0);
+ };
+
+ inline bool operator ! ()
+ {
+ return(
+ part[0] == 0 &&
+ part[1] == 0 &&
+ part[2] == 0);
+ };
+
+ inline uint32 & operator[](uint8 el)
+ {
+ return (part[el]);
+ };
+
+ inline const uint32 & operator[](uint8 el) const
+ {
+ return (part[el]);
+ };
+};
+#endif