mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[6839] Restore expected storing in guid/id counters first free guid/id.n all cases Prevent use uninitilized values for some id types.
This commit is contained in:
parent
e3abf5c936
commit
1e9464ea73
4 changed files with 39 additions and 62 deletions
|
|
@ -115,8 +115,12 @@ ObjectMgr::ObjectMgr()
|
|||
m_hiGoGuid = 1;
|
||||
m_hiDoGuid = 1;
|
||||
m_hiCorpseGuid = 1;
|
||||
|
||||
m_hiPetNumber = 1;
|
||||
m_ItemTextId = 1;
|
||||
m_mailid = 1;
|
||||
m_auctionid = 1;
|
||||
m_guildId = 1;
|
||||
m_arenaTeamId = 1;
|
||||
|
||||
mGuildBankTabPrice.resize(GUILD_BANK_MAX_TABS);
|
||||
mGuildBankTabPrice[0] = 100;
|
||||
|
|
@ -5079,7 +5083,6 @@ void ObjectMgr::SetHighestGuids()
|
|||
if( result )
|
||||
{
|
||||
m_hiCharGuid = (*result)[0].GetUInt32()+1;
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
|
|
@ -5087,7 +5090,6 @@ void ObjectMgr::SetHighestGuids()
|
|||
if( result )
|
||||
{
|
||||
m_hiCreatureGuid = (*result)[0].GetUInt32()+1;
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
|
|
@ -5098,7 +5100,6 @@ void ObjectMgr::SetHighestGuids()
|
|||
if( result )
|
||||
{
|
||||
m_hiItemGuid = (*result)[0].GetUInt32()+1;
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
|
|
@ -5112,7 +5113,6 @@ void ObjectMgr::SetHighestGuids()
|
|||
if( result )
|
||||
{
|
||||
m_hiGoGuid = (*result)[0].GetUInt32()+1;
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
|
|
@ -5120,39 +5120,27 @@ void ObjectMgr::SetHighestGuids()
|
|||
if( result )
|
||||
{
|
||||
m_auctionid = (*result)[0].GetUInt32()+1;
|
||||
|
||||
delete result;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_auctionid = 0;
|
||||
}
|
||||
|
||||
result = CharacterDatabase.Query( "SELECT MAX(id) FROM mail" );
|
||||
if( result )
|
||||
{
|
||||
m_mailid = (*result)[0].GetUInt32()+1;
|
||||
|
||||
delete result;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_mailid = 0;
|
||||
}
|
||||
|
||||
result = CharacterDatabase.Query( "SELECT MAX(id) FROM item_text" );
|
||||
if( result )
|
||||
{
|
||||
m_ItemTextId = (*result)[0].GetUInt32();
|
||||
|
||||
m_ItemTextId = (*result)[0].GetUInt32()+1;
|
||||
delete result;
|
||||
}
|
||||
else
|
||||
m_ItemTextId = 0;
|
||||
|
||||
result = CharacterDatabase.Query( "SELECT MAX(guid) FROM corpse" );
|
||||
if( result )
|
||||
{
|
||||
m_hiCorpseGuid = (*result)[0].GetUInt32()+1;
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
|
|
@ -5160,7 +5148,6 @@ void ObjectMgr::SetHighestGuids()
|
|||
if (result)
|
||||
{
|
||||
m_arenaTeamId = (*result)[0].GetUInt32()+1;
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
|
|
@ -5168,64 +5155,58 @@ void ObjectMgr::SetHighestGuids()
|
|||
if (result)
|
||||
{
|
||||
m_guildId = (*result)[0].GetUInt32()+1;
|
||||
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 ObjectMgr::GenerateArenaTeamId()
|
||||
{
|
||||
++m_arenaTeamId;
|
||||
if(m_arenaTeamId>=0xFFFFFFFF)
|
||||
if(m_arenaTeamId>=0xFFFFFFFE)
|
||||
{
|
||||
sLog.outError("Arena team ids overflow!! Can't continue, shutting down server. ");
|
||||
World::StopNow(ERROR_EXIT_CODE);
|
||||
}
|
||||
return m_arenaTeamId;
|
||||
return m_arenaTeamId++;
|
||||
}
|
||||
|
||||
uint32 ObjectMgr::GenerateGuildId()
|
||||
{
|
||||
++m_guildId;
|
||||
if(m_guildId>=0xFFFFFFFF)
|
||||
if(m_guildId>=0xFFFFFFFE)
|
||||
{
|
||||
sLog.outError("Guild ids overflow!! Can't continue, shutting down server. ");
|
||||
World::StopNow(ERROR_EXIT_CODE);
|
||||
}
|
||||
return m_guildId;
|
||||
return m_guildId++;
|
||||
}
|
||||
|
||||
uint32 ObjectMgr::GenerateAuctionID()
|
||||
{
|
||||
++m_auctionid;
|
||||
if(m_auctionid>=0xFFFFFFFF)
|
||||
if(m_auctionid>=0xFFFFFFFE)
|
||||
{
|
||||
sLog.outError("Auctions ids overflow!! Can't continue, shutting down server. ");
|
||||
World::StopNow(ERROR_EXIT_CODE);
|
||||
}
|
||||
return m_auctionid;
|
||||
return m_auctionid++;
|
||||
}
|
||||
|
||||
uint32 ObjectMgr::GenerateMailID()
|
||||
{
|
||||
++m_mailid;
|
||||
if(m_mailid>=0xFFFFFFFF)
|
||||
if(m_mailid>=0xFFFFFFFE)
|
||||
{
|
||||
sLog.outError("Mail ids overflow!! Can't continue, shutting down server. ");
|
||||
World::StopNow(ERROR_EXIT_CODE);
|
||||
}
|
||||
return m_mailid;
|
||||
return m_mailid++;
|
||||
}
|
||||
|
||||
uint32 ObjectMgr::GenerateItemTextID()
|
||||
{
|
||||
++m_ItemTextId;
|
||||
if(m_ItemTextId>=0xFFFFFFFF)
|
||||
if(m_ItemTextId>=0xFFFFFFFE)
|
||||
{
|
||||
sLog.outError("Item text ids overflow!! Can't continue, shutting down server. ");
|
||||
World::StopNow(ERROR_EXIT_CODE);
|
||||
}
|
||||
return m_ItemTextId;
|
||||
return m_ItemTextId++;
|
||||
}
|
||||
|
||||
uint32 ObjectMgr::CreateItemText(std::string text)
|
||||
|
|
@ -5247,61 +5228,54 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh)
|
|||
switch(guidhigh)
|
||||
{
|
||||
case HIGHGUID_ITEM:
|
||||
++m_hiItemGuid;
|
||||
if(m_hiItemGuid>=0xFFFFFFFF)
|
||||
if(m_hiItemGuid>=0xFFFFFFFE)
|
||||
{
|
||||
sLog.outError("Item guid overflow!! Can't continue, shutting down server. ");
|
||||
World::StopNow(ERROR_EXIT_CODE);
|
||||
}
|
||||
return m_hiItemGuid;
|
||||
return m_hiItemGuid++;
|
||||
case HIGHGUID_UNIT:
|
||||
++m_hiCreatureGuid;
|
||||
if(m_hiCreatureGuid>=0x00FFFFFF)
|
||||
if(m_hiCreatureGuid>=0x00FFFFFE)
|
||||
{
|
||||
sLog.outError("Creature guid overflow!! Can't continue, shutting down server. ");
|
||||
World::StopNow(ERROR_EXIT_CODE);
|
||||
}
|
||||
return m_hiCreatureGuid;
|
||||
return m_hiCreatureGuid++;
|
||||
case HIGHGUID_PET:
|
||||
++m_hiPetGuid;
|
||||
if(m_hiPetGuid>=0x00FFFFFF)
|
||||
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_hiPetGuid++;
|
||||
case HIGHGUID_PLAYER:
|
||||
++m_hiCharGuid;
|
||||
if(m_hiCharGuid>=0xFFFFFFFF)
|
||||
if(m_hiCharGuid>=0xFFFFFFFE)
|
||||
{
|
||||
sLog.outError("Players guid overflow!! Can't continue, shutting down server. ");
|
||||
World::StopNow(ERROR_EXIT_CODE);
|
||||
}
|
||||
return m_hiCharGuid;
|
||||
return m_hiCharGuid++;
|
||||
case HIGHGUID_GAMEOBJECT:
|
||||
++m_hiGoGuid;
|
||||
if(m_hiGoGuid>=0x00FFFFFF)
|
||||
if(m_hiGoGuid>=0x00FFFFFE)
|
||||
{
|
||||
sLog.outError("Gameobject guid overflow!! Can't continue, shutting down server. ");
|
||||
World::StopNow(ERROR_EXIT_CODE);
|
||||
}
|
||||
return m_hiGoGuid;
|
||||
return m_hiGoGuid++;
|
||||
case HIGHGUID_CORPSE:
|
||||
++m_hiCorpseGuid;
|
||||
if(m_hiCorpseGuid>=0xFFFFFFFF)
|
||||
if(m_hiCorpseGuid>=0xFFFFFFFE)
|
||||
{
|
||||
sLog.outError("Corpse guid overflow!! Can't continue, shutting down server. ");
|
||||
World::StopNow(ERROR_EXIT_CODE);
|
||||
}
|
||||
return m_hiCorpseGuid;
|
||||
return m_hiCorpseGuid++;
|
||||
case HIGHGUID_DYNAMICOBJECT:
|
||||
++m_hiDoGuid;
|
||||
if(m_hiDoGuid>=0xFFFFFFFF)
|
||||
if(m_hiDoGuid>=0xFFFFFFFE)
|
||||
{
|
||||
sLog.outError("DynamicObject guid overflow!! Can't continue, shutting down server. ");
|
||||
World::StopNow(ERROR_EXIT_CODE);
|
||||
}
|
||||
return m_hiDoGuid;
|
||||
return m_hiDoGuid++;
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -772,12 +772,16 @@ class ObjectMgr
|
|||
const char * GetScriptName(uint32 id) { return id < m_scriptNames.size() ? m_scriptNames[id].c_str() : ""; }
|
||||
uint32 GetScriptId(const char *name);
|
||||
protected:
|
||||
|
||||
// first free id for selected id type
|
||||
uint32 m_auctionid;
|
||||
uint32 m_mailid;
|
||||
uint32 m_ItemTextId;
|
||||
uint32 m_arenaTeamId;
|
||||
uint32 m_guildId;
|
||||
uint32 m_hiPetNumber;
|
||||
|
||||
// first free low guid for seelcted guid type
|
||||
uint32 m_hiCharGuid;
|
||||
uint32 m_hiCreatureGuid;
|
||||
uint32 m_hiPetGuid;
|
||||
|
|
@ -786,8 +790,6 @@ class ObjectMgr
|
|||
uint32 m_hiDoGuid;
|
||||
uint32 m_hiCorpseGuid;
|
||||
|
||||
uint32 m_hiPetNumber;
|
||||
|
||||
QuestMap mQuestTemplates;
|
||||
|
||||
typedef UNORDERED_MAP<uint32, GossipText*> GossipTextMap;
|
||||
|
|
|
|||
|
|
@ -389,7 +389,8 @@ DumpReturn PlayerDumpReader::LoadDump(std::string file, uint32 account, std::str
|
|||
}
|
||||
else incHighest = false;
|
||||
}
|
||||
else guid = objmgr.m_hiCharGuid;
|
||||
else
|
||||
guid = objmgr.m_hiCharGuid;
|
||||
|
||||
// normalize the name if specified and check if it exists
|
||||
if(!normalizePlayerName(name))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "6838"
|
||||
#define REVISION_NR "6839"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue