From f42c57d9a885450014cadd56a0eaf7c79eefebf4 Mon Sep 17 00:00:00 2001 From: Kahrl Date: Sun, 27 Nov 2011 05:01:38 +0200 Subject: Add IDropAction and related stuff --- src/inventory.h | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) (limited to 'src/inventory.h') diff --git a/src/inventory.h b/src/inventory.h index d6049f52f..441b2ca4d 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -62,7 +62,7 @@ public: // Returns the string used for inventory virtual std::string getItemString(); // Creates an object from the item, to be placed in the world. - virtual ServerActiveObject* createSAO(ServerEnvironment *env, u16 id, v3f pos); + virtual ServerActiveObject* createSAO(ServerEnvironment *env, v3f pos); // Gets amount of items that dropping one SAO will decrement virtual u16 getDropCount() const { return getCount(); } @@ -252,7 +252,7 @@ public: return os.str(); } - ServerActiveObject* createSAO(ServerEnvironment *env, u16 id, v3f pos); + ServerActiveObject* createSAO(ServerEnvironment *env, v3f pos); u16 getDropCount() const; virtual bool addableTo(const InventoryItem *other) const @@ -535,6 +535,7 @@ public: }; #define IACTION_MOVE 0 +#define IACTION_DROP 1 struct InventoryAction { @@ -542,7 +543,8 @@ struct InventoryAction virtual u16 getType() const = 0; virtual void serialize(std::ostream &os) const = 0; - virtual void apply(InventoryContext *c, InventoryManager *mgr) = 0; + virtual void apply(InventoryContext *c, InventoryManager *mgr, + ServerEnvironment *env) = 0; }; struct IMoveAction : public InventoryAction @@ -582,7 +584,42 @@ struct IMoveAction : public InventoryAction os<