Prevent memory corruption at DBC loading. Thanks to Lynx3d for investigating that issue

This commit is contained in:
arrai 2020-01-23 15:17:48 +00:00 committed by Antz
parent 27586fde28
commit 0da30abdec

View File

@ -410,14 +410,14 @@ void LoadDBCStores(const std::string& dataPath)
}
// prevent memory corruption; otherwise cls will become 12 below
if ((talentTabInfo->ClassMask & CLASSMASK_ALL_PLAYABLE) == 0)
if (! talentTabInfo->ClassMask & CLASSMASK_ALL_PLAYABLE)
{
continue;
}
// store class talent tab pages
uint32 cls = 1;
for (uint32 m = 1; !(m & talentTabInfo->ClassMask) && cls < MAX_CLASSES; m <<= 1, ++cls)
for (uint32 m = 1; !(m & talentTabInfo->ClassMask) && cls < 12 /*MAX_CLASSES*/; m << = 1, ++cls)
{
// TODO: WHAT, WHY... surely this is a mistake
}