[9571] Create and use ObjectGuidGenerator/IdGenerator template classes.

* This is let finally hide guid structure in ObjectGuid.h/.cpp code.
* Shared related code.

NOTE: while switch to use new clasess one more problem has been detected
with not-safe code in .pdump work for future per-map multi-threading.
It's need rewrited before will possible safe use in like case.
For current single world thread case it's safe.
This commit is contained in:
VladimirMangos 2010-03-11 15:50:45 +03:00
parent 873b2cab99
commit c4f3578226
8 changed files with 206 additions and 234 deletions

View file

@ -205,8 +205,7 @@ Map::Map(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode, Map* _par
i_id(id), i_InstanceId(InstanceId), m_unloadTimer(0),
m_VisibleDistance(DEFAULT_VISIBILITY_DISTANCE),
m_activeNonPlayersIter(m_activeNonPlayers.end()),
i_gridExpiry(expiry), m_parentMap(_parent ? _parent : this),
m_hiDynObjectGuid(1), m_hiPetGuid(1), m_hiVehicleGuid(1)
i_gridExpiry(expiry), m_parentMap(_parent ? _parent : this)
{
for(unsigned int idx=0; idx < MAX_NUMBER_OF_GRIDS; ++idx)
{
@ -3592,26 +3591,11 @@ uint32 Map::GenerateLocalLowGuid(HighGuid guidhigh)
switch(guidhigh)
{
case HIGHGUID_DYNAMICOBJECT:
if (m_hiDynObjectGuid >= 0xFFFFFFFE)
{
sLog.outError("DynamicObject guid overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
return m_hiDynObjectGuid++;
return m_DynObjectGuids.Generate();
case HIGHGUID_PET:
if(m_hiPetGuid>=0x00FFFFFE)
{
sLog.outError("Pet guid overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
return m_hiPetGuid++;
return m_PetGuids.Generate();
case HIGHGUID_VEHICLE:
if(m_hiVehicleGuid>=0x00FFFFFF)
{
sLog.outError("Vehicle guid overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
return m_hiVehicleGuid++;
return m_VehicleGuids.Generate();
default:
ASSERT(0);
}