Build configuration fixes/improvements on Windows
[oweals/minetest.git] / src / serverobject.cpp
index ca3d2c3b98d2790de87d64905446a6fb0e273e99..4d7f1924359bdee0889942620b8378dd5550ddcd 100644 (file)
@@ -20,7 +20,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "serverobject.h"
 #include <fstream>
 #include "inventory.h"
-#include "tooldef.h"
 
 ServerActiveObject::ServerActiveObject(ServerEnvironment *env, v3f pos):
        ActiveObject(0),
@@ -67,10 +66,31 @@ void ServerActiveObject::registerType(u16 type, Factory f)
        m_types.insert(type, f);
 }
 
-void ServerActiveObject::getWieldDiggingProperties(ToolDiggingProperties *dst)
+ItemStack ServerActiveObject::getWieldedItem() const
 {
-       *dst = ToolDiggingProperties();
+       const Inventory *inv = getInventory();
+       if(inv)
+       {
+               const InventoryList *list = inv->getList(getWieldList());
+               if(list)
+                       return list->getItem(getWieldIndex());
+       }
+       return ItemStack();
 }
 
-
+bool ServerActiveObject::setWieldedItem(const ItemStack &item)
+{
+       Inventory *inv = getInventory();
+       if(inv)
+       {
+               InventoryList *list = inv->getList(getWieldList());
+               if (list)
+               {
+                       list->changeItem(getWieldIndex(), item);
+                       setInventoryModified();
+                       return true;
+               }
+       }
+       return false;
+}