diff --git a/apps/openmw/mwgui/hud.cpp b/apps/openmw/mwgui/hud.cpp index 89235b894..f22243335 100644 --- a/apps/openmw/mwgui/hud.cpp +++ b/apps/openmw/mwgui/hud.cpp @@ -3,6 +3,7 @@ #include "../mwmp/Main.hpp" #include "../mwmp/Networking.hpp" #include "../mwmp/LocalEvent.hpp" +#include "../mwmp/LocalPlayer.hpp" #include "../mwworld/cellstore.hpp" #include @@ -87,6 +88,8 @@ namespace MWGui event->addObject(worldObject); + // LocalPlayer's inventory has changed, so send a packet with it + mwmp::Main::get().getLocalPlayer()->sendInventory(); mwmp::Main::get().getNetworking()->getWorldPacket(ID_OBJECT_PLACE)->Send(event); LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Sending ID_OBJECT_PLACE\n- cellRef: %s, %i\n- count: %i", diff --git a/apps/openmw/mwmp/LocalEvent.cpp b/apps/openmw/mwmp/LocalEvent.cpp index 7a7138404..1ce76aed7 100644 --- a/apps/openmw/mwmp/LocalEvent.cpp +++ b/apps/openmw/mwmp/LocalEvent.cpp @@ -50,16 +50,19 @@ void LocalEvent::placeObjects(MWWorld::CellStore* cellStore) { worldObject = objectChanges.objects[i]; - LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s\n- count: %i", + LOG_APPEND(Log::LOG_WARN, "- cellRef: %s, %i\n- cell: %s\n- charge: %i\n- count: %i", worldObject.refId.c_str(), worldObject.refNumIndex, cell.getDescription().c_str(), + worldObject.charge, worldObject.count); MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), worldObject.refId, 1); MWWorld::Ptr newPtr = ref.getPtr(); - newPtr.getCellRef().setCharge(worldObject.charge); + + if (worldObject.charge > -1) + newPtr.getCellRef().setCharge(worldObject.charge); if (worldObject.count > 1) newPtr.getRefData().setCount(worldObject.count);