AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
ObjectGuidGeneratorBase Class Referenceabstract

#include "ObjectGuid.h"

Inheritance diagram for ObjectGuidGeneratorBase:
ObjectGuidGenerator< high >

Public Member Functions

 ObjectGuidGeneratorBase (ObjectGuid::LowType start=1)
 
virtual void Set (ObjectGuid::LowType val)
 
virtual ObjectGuid::LowType Generate (uint16 realmId=DEFAULT_NON_CROSSREALM_REALM_ID)=0
 
ObjectGuid::LowType GetNextAfterMaxUsed () const
 
virtual ~ObjectGuidGeneratorBase ()=default
 

Static Protected Member Functions

static void HandleCounterOverflow (HighGuid high)
 
static bool GetClusterGuid (HighGuid high, uint16 realmId, ObjectGuid::LowType &clusterGuid)
 

Protected Attributes

ObjectGuid::LowType _nextGuid
 

Detailed Description

Constructor & Destructor Documentation

◆ ObjectGuidGeneratorBase()

ObjectGuidGeneratorBase::ObjectGuidGeneratorBase ( ObjectGuid::LowType  start = 1)
inline
287: _nextGuid(start) { }
ObjectGuid::LowType _nextGuid
Definition ObjectGuid.h:297

◆ ~ObjectGuidGeneratorBase()

virtual ObjectGuidGeneratorBase::~ObjectGuidGeneratorBase ( )
virtualdefault

Member Function Documentation

◆ Generate()

virtual ObjectGuid::LowType ObjectGuidGeneratorBase::Generate ( uint16  realmId = DEFAULT_NON_CROSSREALM_REALM_ID)
pure virtual

Implemented in ObjectGuidGenerator< high >.

◆ GetClusterGuid()

bool ObjectGuidGeneratorBase::GetClusterGuid ( HighGuid  high,
uint16  realmId,
ObjectGuid::LowType &  clusterGuid 
)
staticprotected
107{
108 if (!sToCloud9Sidecar->ClusterModeEnabled())
109 return false;
110
111 uint64 guid = 0;
112 if (high == HighGuid::Player)
113 guid = sToCloud9Sidecar->GenerateCharacterGuid(realmId);
114 else if (high == HighGuid::Item)
115 guid = sToCloud9Sidecar->GenerateItemGuid(realmId);
116 else
117 return false;
118
119 // Checked before narrowing: a cluster guid past the uint32 range would otherwise wrap into used guids
120 if (guid >= ObjectGuid::GetMaxCounter(high) - 1)
122
123 clusterGuid = ObjectGuid::LowType(guid);
124 return true;
125}
std::uint64_t uint64
Definition Define.h:106
#define sToCloud9Sidecar
Definition TC9Sidecar.h:81
static void HandleCounterOverflow(HighGuid high)
Definition ObjectGuid.cpp:95
uint32 LowType
Definition ObjectGuid.h:125
ObjectGuid::LowType GetMaxCounter() const
Definition ObjectGuid.h:163

References ObjectGuid::GetMaxCounter(), HandleCounterOverflow(), Item, Player, and sToCloud9Sidecar.

Referenced by ObjectGuidGenerator< high >::Generate().

◆ GetNextAfterMaxUsed()

ObjectGuid::LowType ObjectGuidGeneratorBase::GetNextAfterMaxUsed ( ) const
inline
291{ return _nextGuid; }

References _nextGuid.

◆ HandleCounterOverflow()

void ObjectGuidGeneratorBase::HandleCounterOverflow ( HighGuid  high)
staticprotected
96{
97 // StopNow only flags the shutdown, so Generate would keep handing out wrapped guids until the world loop exits.
98 // For persisted guids those overwrite other rows on save (REPLACE INTO item_instance), so stop right here.
99 if (high == HighGuid::Item || high == HighGuid::Player)
100 ABORT("{} guid overflow!! Can't continue, renumber the guids before restarting.", ObjectGuid::GetTypeName(high));
101
102 LOG_ERROR("entities.object", "{} guid overflow!! Can't continue, shutting down server. ", ObjectGuid::GetTypeName(high));
104}
#define ABORT
Definition Errors.h:76
#define LOG_ERROR(filterType__,...)
Definition Log.h:145
char const * GetTypeName() const
Definition ObjectGuid.h:215
static void StopNow(uint8 exitcode)
Definition World.h:195
@ ERROR_EXIT_CODE
Definition World.h:54

References ABORT, ERROR_EXIT_CODE, ObjectGuid::GetTypeName(), Item, LOG_ERROR, Player, and World::StopNow().

Referenced by ObjectGuidGenerator< high >::Generate(), and GetClusterGuid().

◆ Set()

virtual void ObjectGuidGeneratorBase::Set ( ObjectGuid::LowType  val)
inlinevirtual
289{ _nextGuid = val; }

References _nextGuid.

Referenced by ObjectMgr::SetHighestGuids().

Member Data Documentation

◆ _nextGuid

ObjectGuid::LowType ObjectGuidGeneratorBase::_nextGuid
protected

The documentation for this class was generated from the following files: