Skip to content

Commit

Permalink
Fix guid overflow check in PlayerDump.
Browse files Browse the repository at this point in the history
  • Loading branch information
ratkosrb committed Jan 13, 2025
1 parent 6e9ae5f commit d572db3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/game/PlayerDump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,15 +675,15 @@ DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, s
CharacterDatabase.CommitTransaction();

//FIXME: current code with post-updating guids not safe for future per-map threads
uint64 newMaxItemGuid = sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed() + items.size();
uint64 newMaxItemGuid = sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed() + uint64(items.size());
MANGOS_ASSERT(newMaxItemGuid < UINT32_MAX);
sObjectMgr.m_ItemGuids.SetMaxUsedGuid(newMaxItemGuid, "Item");

uint32 newMaxMailId = sObjectMgr.m_MailIds.GetNextAfterMaxUsed() + mails.size();
uint64 newMaxMailId = sObjectMgr.m_MailIds.GetNextAfterMaxUsed() + uint64(mails.size());
MANGOS_ASSERT(newMaxMailId < UINT32_MAX);
sObjectMgr.m_MailIds.SetMaxUsedGuid(newMaxMailId, "Mail");

uint32 newMaxItemTextId = sObjectMgr.m_ItemTextIds.GetNextAfterMaxUsed() + itemTexts.size();
uint64 newMaxItemTextId = sObjectMgr.m_ItemTextIds.GetNextAfterMaxUsed() + uint64(itemTexts.size());
MANGOS_ASSERT(newMaxItemTextId < UINT32_MAX);
sObjectMgr.m_ItemTextIds.SetMaxUsedGuid(newMaxItemTextId, "Item Text");

Expand Down

0 comments on commit d572db3

Please sign in to comment.