From 7f25abb9c8bfa94e6ab3cc197bffe95944a98c8c Mon Sep 17 00:00:00 2001 From: David Cernat Date: Fri, 18 Nov 2016 01:50:55 +0200 Subject: [PATCH] Implement UnequipItem() script function --- apps/openmw-mp/Script/Functions/Items.cpp | 6 ++++-- apps/openmw/mwmp/LocalPlayer.cpp | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/openmw-mp/Script/Functions/Items.cpp b/apps/openmw-mp/Script/Functions/Items.cpp index 5d987cee3..25fa41e36 100644 --- a/apps/openmw-mp/Script/Functions/Items.cpp +++ b/apps/openmw-mp/Script/Functions/Items.cpp @@ -36,8 +36,10 @@ void ItemFunctions::EquipItem(unsigned short pid, unsigned short slot, const cha void ItemFunctions::UnequipItem(unsigned short pid, unsigned short slot) noexcept { - LOG_MESSAGE(Log::LOG_WARN, "stub"); - //ItemFunctions::EquipItem(pid, slot, "", 0); + Player *player; + GET_PLAYER(pid, player, ); + + ItemFunctions::EquipItem(pid, slot, "", 0, -1); } void ItemFunctions::AddItem(unsigned short pid, const char* itemName, unsigned int count, int health) noexcept diff --git a/apps/openmw/mwmp/LocalPlayer.cpp b/apps/openmw/mwmp/LocalPlayer.cpp index eda559b8a..da242d083 100644 --- a/apps/openmw/mwmp/LocalPlayer.cpp +++ b/apps/openmw/mwmp/LocalPlayer.cpp @@ -794,6 +794,10 @@ void LocalPlayer::setEquipment() else ptrInventory.equip(slot, it, ptrPlayer); } + else + { + ptrInventory.unequipSlot(slot, ptrPlayer); + } } }