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/Handlers/ChatHandler.cpp | |
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/Handlers/ChatHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/ChatHandler.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp index 56e4ed2066b..a43707d0ef6 100644 --- a/src/server/game/Handlers/ChatHandler.cpp +++ b/src/server/game/Handlers/ChatHandler.cpp @@ -562,7 +562,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) void WorldSession::HandleEmoteOpcode(WorldPackets::Chat::EmoteClient& packet) { - uint32 emoteId = packet.EmoteID; + Emote emoteId = static_cast<Emote>(packet.EmoteID); // restrict to the only emotes hardcoded in client if (emoteId != EMOTE_ONESHOT_NONE && emoteId != EMOTE_ONESHOT_WAVE) @@ -632,9 +632,9 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket& recvData) if (!em) return; - uint32 emote_anim = em->EmoteID; + Emote emote = static_cast<Emote>(em->EmoteID); - switch (emote_anim) + switch (emote) { case EMOTE_STATE_SLEEP: case EMOTE_STATE_SIT: @@ -645,7 +645,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket& recvData) // Only allow text-emotes for "dead" entities (feign death included) if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) break; - GetPlayer()->HandleEmoteCommand(emote_anim); + GetPlayer()->HandleEmoteCommand(emote); break; } |