[11310] Make .npc add/.gobject add commands work safe.

Reserve at server startup some guods follow last used in static DB spawns guid
for creatures/gameobjects for use in .npc add/.gobject add commands.
This allow safe select guids not used in all map copies. Guids for temporary spawns
used from range frollow after reserved guids range.

This also let select new static spawns guids (added in game chat command) near to already used static guids.
So it let avoid gaps in static guids lists.

Amount reserved guids set in new GuidReserveSize.* config options.
This commit is contained in:
VladimirMangos 2011-04-03 21:15:24 +04:00
parent c93256e477
commit b92ebd994f
12 changed files with 76 additions and 18 deletions

View file

@ -141,8 +141,8 @@ template uint32 IdGenerator<uint32>::Generate();
template uint64 IdGenerator<uint64>::Generate();
ObjectMgr::ObjectMgr() :
m_CreatureFirstGuid(1),
m_GameObjectFirstGuid(1),
m_FirstTemporaryCreatureGuid(1),
m_FirstTemporaryGameObjectGuid(1),
m_ArenaTeamIds("Arena team ids"),
m_AuctionIds("Auction ids"),
@ -5606,7 +5606,7 @@ void ObjectMgr::SetHighestGuids()
result = WorldDatabase.Query( "SELECT MAX(guid) FROM creature" );
if( result )
{
m_CreatureFirstGuid = (*result)[0].GetUInt32()+1;
m_FirstTemporaryCreatureGuid = (*result)[0].GetUInt32()+1;
delete result;
}
@ -5635,7 +5635,7 @@ void ObjectMgr::SetHighestGuids()
result = WorldDatabase.Query("SELECT MAX(guid) FROM gameobject" );
if( result )
{
m_GameObjectFirstGuid = (*result)[0].GetUInt32()+1;
m_FirstTemporaryGameObjectGuid = (*result)[0].GetUInt32()+1;
delete result;
}
@ -5687,6 +5687,13 @@ void ObjectMgr::SetHighestGuids()
m_GroupIds.Set((*result)[0].GetUInt32()+1);
delete result;
}
// setup reserved ranges for static guids spawn
m_StaticCreatureGuids.Set(m_FirstTemporaryCreatureGuid);
m_FirstTemporaryCreatureGuid += sWorld.getConfig(CONFIG_UINT32_GUID_RESERVE_SIZE_CREATURE);
m_StaticGamebjectGuids.Set(m_FirstTemporaryGameObjectGuid);
m_FirstTemporaryGameObjectGuid += sWorld.getConfig(CONFIG_UINT32_GUID_RESERVE_SIZE_GAMEOBJECT);
}
void ObjectMgr::LoadGameObjectLocales()