EFH: Fix 3 Coverity issues

This commit is contained in:
Strangerke 2023-02-25 09:22:52 +01:00
parent 0027ab8290
commit f8883f9867
2 changed files with 9 additions and 5 deletions

View File

@ -750,8 +750,8 @@ void EfhEngine::getDeathTypeDescription(int16 victimId, int16 attackerId) {
else
deathType = _items[exclusiveItemId]._attackType + 1;
}
// The check "attackerId > 5" is a safeguard for a Coverity "OVERRUN" ticket, not present in the original
} else if (attackerId > 5 || _teamMonster[attackerId]._id == -1) {
// The check "attackerId >= 5" is a safeguard for a Coverity "OVERRUN" ticket, not present in the original
} else if (attackerId >= 5 || _teamMonster[attackerId]._id == -1) {
deathType = 0;
} else {
int16 itemId = _mapMonsters[_techId][_teamMonster[attackerId]._id]._weaponItemId;

View File

@ -35,9 +35,13 @@ void EfhEngine::songDelay(int delay) {
void EfhEngine::playNote(int frequencyIndex, int totalDelay) {
debugC(3, kDebugEngine, "playNote %d %d", frequencyIndex, totalDelay);
_speakerStream->play(Audio::PCSpeaker::kWaveFormSquare, 0x1234DD / kSoundFrequency[frequencyIndex], -1);
songDelay(totalDelay);
_speakerStream->stop();
if (frequencyIndex > 0 && frequencyIndex < 72) {
_speakerStream->play(Audio::PCSpeaker::kWaveFormSquare, 0x1234DD / kSoundFrequency[frequencyIndex], -1);
songDelay(totalDelay);
_speakerStream->stop();
} else {
warning("playNote - Skip note with frequency index %d", frequencyIndex);
}
}
Common::KeyCode EfhEngine::playSong(uint8 *buffer) {