mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-15 12:42:43 -04:00
Core/SAI: Code improvements to SMART_ACTION_RANDOM_SOUND
Warning fixes and extra sanity checks
Ref #16376
(cherry picked from commit 77087db793)
This commit is contained in:
@@ -841,12 +841,20 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
|
||||
return false;
|
||||
break;
|
||||
case SMART_ACTION_RANDOM_SOUND:
|
||||
for (uint8 i = 0; i < SMART_ACTION_PARAM_COUNT - 1; i++)
|
||||
{
|
||||
if (std::all_of(e.action.randomSound.sounds.begin(), e.action.randomSound.sounds.end(), [](uint32 sound) { return sound == 0; }))
|
||||
{
|
||||
if (e.action.randomSound.sound[i] && !IsSoundValid(e, e.action.randomSound.sound[i]))
|
||||
return false;
|
||||
TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u does not have any non-zero sound",
|
||||
e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
|
||||
return false;
|
||||
}
|
||||
|
||||
for (uint32 sound : e.action.randomSound.sounds)
|
||||
if (sound && !IsSoundValid(e, sound))
|
||||
return false;
|
||||
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_CAST:
|
||||
{
|
||||
if (!IsSpellValid(e, e.action.cast.spell))
|
||||
|
||||
Reference in New Issue
Block a user