From 120155f312cb1977b9a325acc7c7679103eb3800 Mon Sep 17 00:00:00 2001 From: Paul Ouellette Date: Sat, 10 Aug 2019 17:28:00 -0400 Subject: Fix some issues with minetest.clear_craft (#8712) * Fix some issues with minetest.clear_craft - Fix memory leak - Fix crafts with an output count not being cleared when clearing by input. - Fix recipe list being reversed when clearing by input. * Add CraftInput::empty() --- src/craftdef.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/craftdef.h') diff --git a/src/craftdef.h b/src/craftdef.h index 37ae6df43..5971a89bf 100644 --- a/src/craftdef.h +++ b/src/craftdef.h @@ -80,6 +80,9 @@ struct CraftInput method(method_), width(width_), items(items_) {} + // Returns true if all items are empty. + bool empty() const; + std::string dump() const; }; @@ -431,9 +434,8 @@ public: virtual std::vector getCraftRecipes(CraftOutput &output, IGameDef *gamedef, unsigned limit=0) const=0; - virtual bool clearCraftRecipesByOutput(const CraftOutput &output, IGameDef *gamedef) = 0; - virtual bool clearCraftRecipesByInput(CraftMethod craft_method, - unsigned int craft_grid_width, const std::vector &recipe, IGameDef *gamedef) = 0; + virtual bool clearCraftsByOutput(const CraftOutput &output, IGameDef *gamedef) = 0; + virtual bool clearCraftsByInput(const CraftInput &input, IGameDef *gamedef) = 0; // Print crafting recipes for debugging virtual std::string dump() const=0; -- cgit v1.2.3