feat(Core): GUID recycler (#1820)
Automatically recycle GUIDs, thus avoiding crashes when reaching the limit of data type "int" in MySQL.
This commit is contained in:
parent
6a1866f5e6
commit
ac8b20922b
4 changed files with 53 additions and 12 deletions
|
|
@ -212,7 +212,7 @@ public:
|
|||
if (Transport* tt = chr->GetTransport())
|
||||
if (MotionTransport* trans = tt->ToMotionTransport())
|
||||
{
|
||||
uint32 guid = sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT);
|
||||
uint32 guid = sObjectMgr->GenerateRecycledLowGuid(HIGHGUID_UNIT);
|
||||
CreatureData& data = sObjectMgr->NewOrExistCreatureData(guid);
|
||||
data.id = id;
|
||||
data.phaseMask = chr->GetPhaseMaskForSpawn();
|
||||
|
|
@ -230,7 +230,7 @@ public:
|
|||
}
|
||||
|
||||
Creature* creature = new Creature();
|
||||
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, x, y, z, o))
|
||||
if (!creature->Create(sObjectMgr->GenerateRecycledLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, x, y, z, o))
|
||||
{
|
||||
delete creature;
|
||||
return false;
|
||||
|
|
@ -741,7 +741,7 @@ public:
|
|||
for (uint8 i = 0; i < NPCFLAG_COUNT; i++)
|
||||
if (npcflags & npcFlagTexts[i].flag)
|
||||
handler->PSendSysMessage(npcFlagTexts[i].text, npcFlagTexts[i].flag);
|
||||
|
||||
|
||||
handler->PSendSysMessage(LANG_NPCINFO_MECHANIC_IMMUNE, mechanicImmuneMask);
|
||||
for (uint8 i = 1; i < MAX_MECHANIC; ++i)
|
||||
if (mechanicImmuneMask & (1 << (mechanicImmunes[i].flag - 1)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue