these calls should be pLevelsTxtRecord->nNumNMon * sizeof(uint16_t) and pLevelsTxtRecord->nNumNormMon * sizeof(uint16_t) respectively, else std::copy should be used in place of memcpy.
Additionally the default array initializer of monsterIds does not exist in the assembly code (apart from being redundant due to the memcpy). the compiler should elide this, but there may be scenarios where a pointless memset may be done.
The following 2 calls to
memcpy
inMONSTERREGION_InitializeAll
use the incorrect size, as the monster id's are auint16_t
butmemcpy
takes a byte count: https://github.com/ThePhrozenKeep/D2MOO/blob/923506cbed938f21656e0562efa854f8d8fb9f8b/source/D2Game/src/MONSTER/MonsterRegion.cpp#L960 https://github.com/ThePhrozenKeep/D2MOO/blob/923506cbed938f21656e0562efa854f8d8fb9f8b/source/D2Game/src/MONSTER/MonsterRegion.cpp#L967these calls should be
pLevelsTxtRecord->nNumNMon * sizeof(uint16_t)
andpLevelsTxtRecord->nNumNormMon * sizeof(uint16_t)
respectively, elsestd::copy
should be used in place ofmemcpy
.Additionally the default array initializer of
monsterIds
does not exist in the assembly code (apart from being redundant due to thememcpy
). the compiler should elide this, but there may be scenarios where a pointlessmemset
may be done.