diff options
| author | Peter Keresztes Schmidt <carbenium@outlook.com> | 2020-08-15 15:29:43 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-15 15:29:43 +0200 |
| commit | 6c7837f947ff4eb5110a116a371daa6f9e2b3bbe (patch) | |
| tree | 68c0338b65932b47b62903f8b09a3f573909b66e /src/server/game/AI/SmartScripts | |
| parent | 34d403e83f42304332f89ffc73549f6f2c695ccd (diff) | |
Core/Unit: Make HandleEmoteCommand typesafe (#25249)
* Scripts/ScarletMonastery: Fix wrong emote during Headless Horseman encounter
* Scripts/HoR: Fix wrong emote during escape event
* Core/Unit: Make improve type safety of HandleEmoteCommand
Change argument type to the expected enum type Emote
* Scripts/CoS: Use SetUInt32Value to set UNIT_NPC_EMOTESTATE
UNIT_NPC_EMOTESTATE is no flag field
Diffstat (limited to 'src/server/game/AI/SmartScripts')
| -rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index feb0cbd978e..4df56079d1f 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -307,7 +307,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { if (IsUnit(target)) { - target->ToUnit()->HandleEmoteCommand(e.action.emote.emote); + target->ToUnit()->HandleEmoteCommand(static_cast<Emote>(e.action.emote.emote)); TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_PLAY_EMOTE: target: %s %s, emote: %u", target->GetName().c_str(), target->GetGUID().ToString().c_str(), e.action.emote.emote); } @@ -461,7 +461,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { if (IsUnit(target)) { - uint32 emote = Trinity::Containers::SelectRandomContainerElement(emotes); + Emote emote = static_cast<Emote>(Trinity::Containers::SelectRandomContainerElement(emotes)); target->ToUnit()->HandleEmoteCommand(emote); TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_RANDOM_EMOTE: Creature %s handle random emote %u", target->GetGUID().ToString().c_str(), emote); |
