aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/Object
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2014-10-26 02:57:28 +0200
committerShauren <shauren.trinity@gmail.com>2014-10-26 02:57:28 +0200
commit9e1930959db59013d6f0221d29cc652cdf2f6145 (patch)
tree29218cc6af11c18f645eba3503583ed821975b2c /src/server/game/Entities/Object
parent747350a0bcffaa4ef2b5d3317bb75fac78c64472 (diff)
Core/Entities: Changed object lowguid to uint64
Diffstat (limited to 'src/server/game/Entities/Object')
-rw-r--r--src/server/game/Entities/Object/Object.cpp8
-rw-r--r--src/server/game/Entities/Object/Object.h4
-rw-r--r--src/server/game/Entities/Object/ObjectGuid.cpp27
-rw-r--r--src/server/game/Entities/Object/ObjectGuid.h19
4 files changed, 28 insertions, 30 deletions
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index 669ec512afd..8f58ea156f2 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -114,7 +114,7 @@ void Object::_InitValues()
m_objectUpdated = false;
}
-void Object::_Create(uint32 guidlow, uint32 entry, HighGuid guidhigh)
+void Object::_Create(ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
{
if (!m_uint32Values) _InitValues();
@@ -1353,7 +1353,7 @@ void WorldObject::CleanupsBeforeDelete(bool /*finalCleanup*/)
transport->RemovePassenger(this);
}
-void WorldObject::_Create(uint32 guidlow, HighGuid guidhigh, uint32 phaseMask)
+void WorldObject::_Create(ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask)
{
Object::_Create(guidlow, 0, guidhigh);
m_phaseMask = phaseMask;
@@ -2222,7 +2222,7 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert
break;
}
- if (!summon->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), this, 0, entry, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), nullptr, vehId))
+ if (!summon->Create(sObjectMgr->GetGenerator<HIGHGUID_UNIT>()->Generate(), this, 0, entry, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), nullptr, vehId))
{
delete summon;
return NULL;
@@ -2320,7 +2320,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float
Map* map = GetMap();
GameObject* go = new GameObject();
- if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, GetPhaseMask(), x, y, z, ang, rotation0, rotation1, rotation2, rotation3, 100, GO_STATE_READY))
+ if (!go->Create(sObjectMgr->GetGenerator<HIGHGUID_GAMEOBJECT>()->Generate(), entry, map, GetPhaseMask(), x, y, z, ang, rotation0, rotation1, rotation2, rotation3, 100, GO_STATE_READY))
{
delete go;
return NULL;
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index f7e8a7a6447..95d85b2afce 100644
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -205,7 +205,7 @@ class Object
Object();
void _InitValues();
- void _Create(uint32 guidlow, uint32 entry, HighGuid guidhigh);
+ void _Create(ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh);
std::string _ConcatFields(uint16 startIndex, uint16 size) const;
void _LoadIntoDataField(std::string const& data, uint32 startOffset, uint32 count);
@@ -578,7 +578,7 @@ class WorldObject : public Object, public WorldLocation
virtual void Update (uint32 /*time_diff*/) { }
- void _Create(uint32 guidlow, HighGuid guidhigh, uint32 phaseMask);
+ void _Create(ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask);
virtual void RemoveFromWorld() override;
void GetNearPoint2D(float &x, float &y, float distance, float absAngle) const;
diff --git a/src/server/game/Entities/Object/ObjectGuid.cpp b/src/server/game/Entities/Object/ObjectGuid.cpp
index 9f40b914c58..81023e72070 100644
--- a/src/server/game/Entities/Object/ObjectGuid.cpp
+++ b/src/server/game/Entities/Object/ObjectGuid.cpp
@@ -91,7 +91,7 @@ void PackedGuid::Set(ObjectGuid guid)
}
template<HighGuid high>
-uint64 ObjectGuidGenerator<high>::Generate()
+ObjectGuid::LowType ObjectGuidGenerator<high>::Generate()
{
if (_nextGuid >= ObjectGuid::GetMaxCounter(high) - 1)
{
@@ -136,17 +136,14 @@ std::ostream& operator<<(std::ostream& stream, ObjectGuid const& guid)
return stream;
}
-template uint64 ObjectGuidGenerator<HIGHGUID_ITEM>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_PLAYER>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_GAMEOBJECT>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_TRANSPORT>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_UNIT>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_PET>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_VEHICLE>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_DYNAMICOBJECT>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_CORPSE>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_AREATRIGGER>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_BATTLEGROUND>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_INSTANCE>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_GROUP>::Generate();
-template uint64 ObjectGuidGenerator<HIGHGUID_GUILD>::Generate();
+template ObjectGuid::LowType ObjectGuidGenerator<HIGHGUID_PLAYER>::Generate();
+template ObjectGuid::LowType ObjectGuidGenerator<HIGHGUID_UNIT>::Generate();
+template ObjectGuid::LowType ObjectGuidGenerator<HIGHGUID_PET>::Generate();
+template ObjectGuid::LowType ObjectGuidGenerator<HIGHGUID_VEHICLE>::Generate();
+template ObjectGuid::LowType ObjectGuidGenerator<HIGHGUID_ITEM>::Generate();
+template ObjectGuid::LowType ObjectGuidGenerator<HIGHGUID_PET>::Generate();
+template ObjectGuid::LowType ObjectGuidGenerator<HIGHGUID_GAMEOBJECT>::Generate();
+template ObjectGuid::LowType ObjectGuidGenerator<HIGHGUID_DYNAMICOBJECT>::Generate();
+template ObjectGuid::LowType ObjectGuidGenerator<HIGHGUID_CORPSE>::Generate();
+template ObjectGuid::LowType ObjectGuidGenerator<HIGHGUID_AREATRIGGER>::Generate();
+template ObjectGuid::LowType ObjectGuidGenerator<HIGHGUID_MO_TRANSPORT>::Generate();
diff --git a/src/server/game/Entities/Object/ObjectGuid.h b/src/server/game/Entities/Object/ObjectGuid.h
index 988c1847e7d..d5bfa7ee2f8 100644
--- a/src/server/game/Entities/Object/ObjectGuid.h
+++ b/src/server/game/Entities/Object/ObjectGuid.h
@@ -93,11 +93,12 @@ class ObjectGuid
public:
static ObjectGuid const Empty;
- typedef uint32 LowType;
+
+ typedef uint64 LowType;
ObjectGuid() : _low(0), _high(0) { }
- ObjectGuid(HighGuid hi, uint32 entry, uint64 counter) : _low(counter ? uint64(counter) | (uint64(entry) << 32) | (uint64(hi) << ((hi == HIGHGUID_CORPSE || hi == HIGHGUID_AREATRIGGER) ? 48 : 52)) : 0), _high(0) { }
- ObjectGuid(HighGuid hi, uint64 counter) : _low(counter ? uint64(counter) | (uint64(hi) << ((hi == HIGHGUID_CORPSE || hi == HIGHGUID_AREATRIGGER) ? 48 : 52)) : 0), _high(0) { }
+ ObjectGuid(HighGuid hi, uint32 entry, LowType counter) : _low(counter ? uint64(counter) | (uint64(entry) << 32) | (uint64(hi) << ((hi == HIGHGUID_CORPSE || hi == HIGHGUID_AREATRIGGER) ? 48 : 52)) : 0), _high(0) { }
+ ObjectGuid(HighGuid hi, LowType counter) : _low(counter ? uint64(counter) | (uint64(hi) << ((hi == HIGHGUID_CORPSE || hi == HIGHGUID_AREATRIGGER) ? 48 : 52)) : 0), _high(0) { }
ObjectGuid(ObjectGuid const&) = default;
PackedGuidReader ReadAsPacked() { return PackedGuidReader(*this); }
@@ -117,12 +118,12 @@ class ObjectGuid
uint32 GetEntry() const { return HasEntry() ? uint32((_low >> 32) & UI64LIT(0x00000000000FFFFF)) : 0; }
LowType GetCounter() const
{
- return uint32(_low & UI64LIT(0x00000000FFFFFFFF));
+ return _low & UI64LIT(0x00000000FFFFFFFF);
}
- static uint32 GetMaxCounter(HighGuid /*high*/)
+ static LowType GetMaxCounter(HighGuid /*high*/)
{
- return uint32(0xFFFFFFFF);
+ return UI64LIT(0xFFFFFFFF);
}
uint32 GetMaxCounter() const { return GetMaxCounter(GetHigh()); }
@@ -266,11 +267,11 @@ template<HighGuid high>
class ObjectGuidGenerator
{
public:
- explicit ObjectGuidGenerator(uint64 start = 1) : _nextGuid(start) { }
+ explicit ObjectGuidGenerator(ObjectGuid::LowType start = UI64LIT(1)) : _nextGuid(start) { }
void Set(uint64 val) { _nextGuid = val; }
- uint64 Generate();
- uint64 GetNextAfterMaxUsed() const { return _nextGuid; }
+ ObjectGuid::LowType Generate();
+ ObjectGuid::LowType GetNextAfterMaxUsed() const { return _nextGuid; }
private:
uint64 _nextGuid;