diff options
author | Paul Ouellette <oue.paul18@gmail.com> | 2019-08-10 17:28:00 -0400 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2019-08-10 23:28:00 +0200 |
commit | 120155f312cb1977b9a325acc7c7679103eb3800 (patch) | |
tree | 1cb5c07716be7d4579fa614555f9d74c12ea07eb /src/craftdef.h | |
parent | 86d7f84b899a507e979f1845f2057cce6f84e743 (diff) | |
download | minetest-120155f312cb1977b9a325acc7c7679103eb3800.tar.gz minetest-120155f312cb1977b9a325acc7c7679103eb3800.tar.bz2 minetest-120155f312cb1977b9a325acc7c7679103eb3800.zip |
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()
Diffstat (limited to 'src/craftdef.h')
-rw-r--r-- | src/craftdef.h | 8 |
1 files changed, 5 insertions, 3 deletions
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<CraftDefinition*> 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<std::string> &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; |