[8705] Move DynamicObject guid counting from global levle to map.

This is first step in guid counting for map local object types at map level.
Map local countin let
1) have more wide guid space and then more seldom have problems with guid counter overflow
2) possible implement (later) restart map at guid overflow without server shutdown.
3) let use static guids (not for DynamicOPbject that not stored in DB anyway) in instances instead dynamic allocated.
This commit is contained in:
VladimirMangos 2009-10-22 06:44:05 +04:00
parent ae9ae781fc
commit d482193cea
6 changed files with 32 additions and 15 deletions

View file

@ -202,7 +202,8 @@ Map::Map(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode, Map* _par
i_id(id), i_InstanceId(InstanceId), m_unloadTimer(0),
m_activeNonPlayersIter(m_activeNonPlayers.end()),
i_gridExpiry(expiry), m_parentMap(_parent ? _parent : this),
m_VisibleDistance(DEFAULT_VISIBILITY_DISTANCE)
m_VisibleDistance(DEFAULT_VISIBILITY_DISTANCE),
m_hiDynObjectGuid(1)
{
for(unsigned int idx=0; idx < MAX_NUMBER_OF_GRIDS; ++idx)
{
@ -3462,4 +3463,25 @@ void Map::SendObjectUpdates()
iter->first->GetSession()->SendPacket(&packet);
packet.clear(); // clean the string
}
}
}
uint32 Map::GenerateLocalLowGuid(HighGuid guidhigh)
{
// TODO: for map local guid counters possible force reload map instead shutdown server at guid counter overflow
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++;
default:
ASSERT(0);
}
ASSERT(0);
return 0;
}