From ea8a41160c12f2427cb3b037f603bd6d9132f734 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 24 Jul 2018 22:43:00 +0300 Subject: [PATCH] [General] Make ActorAttack packet consistent with PlayerAttack Additionally, fix a typo in PlayerAttack where a boolean argument was outside of the parentheses it should have been in. --- .../Packets/Actor/PacketActorAttack.cpp | 28 +++++++++++-------- .../Packets/Player/PacketPlayerAttack.cpp | 2 +- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/components/openmw-mp/Packets/Actor/PacketActorAttack.cpp b/components/openmw-mp/Packets/Actor/PacketActorAttack.cpp index 23b06e11b..289fdbc50 100644 --- a/components/openmw-mp/Packets/Actor/PacketActorAttack.cpp +++ b/components/openmw-mp/Packets/Actor/PacketActorAttack.cpp @@ -24,22 +24,28 @@ void PacketActorAttack::Actor(BaseActor &actor, bool send) RW(actor.attack.target.mpNum, send); } - RW(actor.attack.pressed, send); - RW(actor.attack.instant, send); - RW(actor.attack.success, send); RW(actor.attack.type, send); - if (actor.attack.type == mwmp::Attack::MELEE) + if (actor.attack.type == mwmp::Attack::MELEE || actor.attack.type == mwmp::Attack::MAGIC) { - RW(actor.attack.damage, send); - RW(actor.attack.block, send); - RW(actor.attack.knockdown, send); + RW(actor.attack.pressed, send); + RW(actor.attack.success, send); - RW(actor.attack.applyWeaponEnchantment, send); - RW(actor.attack.applyProjectileEnchantment, send); + if (actor.attack.type == mwmp::Attack::MELEE) + { + RW(actor.attack.damage, send); + RW(actor.attack.block, send); + RW(actor.attack.knockdown, send); + + RW(actor.attack.applyWeaponEnchantment, send); + RW(actor.attack.applyProjectileEnchantment, send); + } + else if (actor.attack.type == mwmp::Attack::MAGIC) + { + RW(actor.attack.instant, send); + RW(actor.attack.spellId, send, true); + } } - else if (actor.attack.type == mwmp::Attack::MAGIC) - RW(actor.attack.spellId, send, true); else if (actor.attack.type == mwmp::Attack::ITEM_MAGIC) RW(actor.attack.itemId, send, true); } diff --git a/components/openmw-mp/Packets/Player/PacketPlayerAttack.cpp b/components/openmw-mp/Packets/Player/PacketPlayerAttack.cpp index 356cd983f..7c5d4aaa6 100644 --- a/components/openmw-mp/Packets/Player/PacketPlayerAttack.cpp +++ b/components/openmw-mp/Packets/Player/PacketPlayerAttack.cpp @@ -48,5 +48,5 @@ void PacketPlayerAttack::Packet(RakNet::BitStream *bs, bool send) } } else if (player->attack.type == mwmp::Attack::ITEM_MAGIC) - RW(player->attack.itemId, send), true; + RW(player->attack.itemId, send, true); }