From 716809f2dbd320ac08400dfbcbc0d4189fd15eee Mon Sep 17 00:00:00 2001 From: David Cernat Date: Fri, 13 Apr 2018 16:23:42 +0300 Subject: [PATCH] [Client] Prevent errors from NPC-only packets for DedicatedPlayers --- apps/openmw/mwmp/DedicatedPlayer.cpp | 3 +++ apps/openmw/mwmp/processors/player/ProcessorPlayerSkill.hpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/apps/openmw/mwmp/DedicatedPlayer.cpp b/apps/openmw/mwmp/DedicatedPlayer.cpp index 10c3f8770..5ce364450 100644 --- a/apps/openmw/mwmp/DedicatedPlayer.cpp +++ b/apps/openmw/mwmp/DedicatedPlayer.cpp @@ -276,6 +276,9 @@ void DedicatedPlayer::setAnimFlags() void DedicatedPlayer::setEquipment() { + // Go no further if the player is disguised as a creature + if (!ptr.getClass().hasInventoryStore(ptr)) return; + MWWorld::InventoryStore& invStore = ptr.getClass().getInventoryStore(ptr); for (int slot = 0; slot < MWWorld::InventoryStore::Slots; ++slot) { diff --git a/apps/openmw/mwmp/processors/player/ProcessorPlayerSkill.hpp b/apps/openmw/mwmp/processors/player/ProcessorPlayerSkill.hpp index 4b61b0a0a..eeee67a80 100644 --- a/apps/openmw/mwmp/processors/player/ProcessorPlayerSkill.hpp +++ b/apps/openmw/mwmp/processors/player/ProcessorPlayerSkill.hpp @@ -30,6 +30,10 @@ namespace mwmp else if (player != 0) { MWWorld::Ptr ptrPlayer = static_cast(player)->getPtr(); + + // Go no further if the player is disguised as a creature + if (ptrPlayer.getTypeName() != typeid(ESM::NPC).name()) return; + MWMechanics::NpcStats *ptrNpcStats = &ptrPlayer.getClass().getNpcStats(ptrPlayer); MWMechanics::SkillValue skillValue;