extra important / fix crash bug when onThinkYell

This commit is contained in:
ErikasKontenis 2021-05-04 23:12:51 +03:00
parent ab6a677b7a
commit bbd5aa0ac0

View File

@ -1072,8 +1072,8 @@ void Monster::onThinkYell(uint32_t)
int32_t randomResult = rand(); int32_t randomResult = rand();
if (rand() == 50 * (randomResult / 50)) { if (rand() == 50 * (randomResult / 50)) {
int32_t totalVoices = mType->info.voiceVector.size(); uint32_t index = uniform_random(0, mType->info.voiceVector.size() - 1);
const voiceBlock_t& voice = mType->info.voiceVector[rand() % totalVoices + 1]; const voiceBlock_t& voice = mType->info.voiceVector[index];
if (voice.yellText) { if (voice.yellText) {
g_game.internalCreatureSay(this, TALKTYPE_MONSTER_YELL, voice.text, false); g_game.internalCreatureSay(this, TALKTYPE_MONSTER_YELL, voice.text, false);