aboutsummaryrefslogtreecommitdiff
path: root/src/content_sao.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/content_sao.cpp')
-rw-r--r--src/content_sao.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/content_sao.cpp b/src/content_sao.cpp
index ea2a4ebf6..282a6546c 100644
--- a/src/content_sao.cpp
+++ b/src/content_sao.cpp
@@ -1277,6 +1277,16 @@ ItemStack PlayerSAO::getWieldedItem() const
const InventoryList *mlist = inv->getList(getWieldList());
if (mlist && getWieldIndex() < (s32)mlist->getSize())
ret = mlist->getItem(getWieldIndex());
+ return ret;
+}
+
+ItemStack PlayerSAO::getWieldedItemOrHand() const
+{
+ const Inventory *inv = getInventory();
+ ItemStack ret;
+ const InventoryList *mlist = inv->getList(getWieldList());
+ if (mlist && getWieldIndex() < (s32)mlist->getSize())
+ ret = mlist->getItem(getWieldIndex());
if (ret.name.empty()) {
const InventoryList *hlist = inv->getList("hand");
if (hlist)
@@ -1291,14 +1301,6 @@ bool PlayerSAO::setWieldedItem(const ItemStack &item)
if (inv) {
InventoryList *mlist = inv->getList(getWieldList());
if (mlist) {
- ItemStack olditem = mlist->getItem(getWieldIndex());
- if (olditem.name.empty()) {
- InventoryList *hlist = inv->getList("hand");
- if (hlist) {
- hlist->changeItem(0, item);
- return true;
- }
- }
mlist->changeItem(getWieldIndex(), item);
return true;
}