From 9d3afc019a1ffe84eeeba91fe4f971a132e05e86 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 25 Feb 2020 09:53:42 +0200 Subject: [PATCH] [Client] Add logging for items added to & removed from player by server Additionally, adjust comment related to potion creation to mention sending of stored item removals. --- apps/openmw/mwmechanics/alchemy.cpp | 3 ++- apps/openmw/mwmp/LocalPlayer.cpp | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwmechanics/alchemy.cpp b/apps/openmw/mwmechanics/alchemy.cpp index a2266f48f..0ec780e0e 100644 --- a/apps/openmw/mwmechanics/alchemy.cpp +++ b/apps/openmw/mwmechanics/alchemy.cpp @@ -576,7 +576,8 @@ MWMechanics::Alchemy::Result MWMechanics::Alchemy::create (const std::string& na Send an ID_RECORD_DYNAMIC packet with the potion we've been creating now that we know its quantity - Stop avoiding the sending of ID_PLAYER_INVENTORY packets + Stop avoiding the sending of ID_PLAYER_INVENTORY packets and send all + item removals stored so far */ mwmp::Main::get().getNetworking()->getWorldstate()->sendPotionRecord(&mStoredPotion, brewedCount); mwmp::Main::get().getLocalPlayer()->avoidSendingInventoryPackets = false; diff --git a/apps/openmw/mwmp/LocalPlayer.cpp b/apps/openmw/mwmp/LocalPlayer.cpp index b11ab474c..d26d54191 100644 --- a/apps/openmw/mwmp/LocalPlayer.cpp +++ b/apps/openmw/mwmp/LocalPlayer.cpp @@ -685,6 +685,8 @@ void LocalPlayer::addItems() if (!item.soul.empty()) itemPtr.getCellRef().setSoul(item.soul); + LOG_APPEND(TimedLog::LOG_INFO, "- Adding inventory item %s with count %i", item.refId.c_str(), item.count); + ptrStore.add(itemPtr, item.count, ptrPlayer); } catch (std::exception&) @@ -779,7 +781,11 @@ void LocalPlayer::removeItems() MWWorld::ContainerStore &ptrStore = ptrPlayer.getClass().getContainerStore(ptrPlayer); for (const auto &item : inventoryChanges.items) + { ptrStore.remove(item.refId, item.count, ptrPlayer); + + LOG_APPEND(TimedLog::LOG_INFO, "- Removing inventory item %s with count %i", item.refId.c_str(), item.count); + } } void LocalPlayer::removeSpells()