aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Ouellette <oue.paul18@gmail.com>2019-08-08 08:30:38 -0400
committersfan5 <sfan5@live.de>2019-12-07 23:46:24 +0100
commit27ce6d0ecc55af7e46a586b97b3ec9e1d406a897 (patch)
tree814e12f932e3b66e6464f2c565c3af5182ebabe2 /src
parent103d9c5c536abd15a79eb7ed899fee29168bb14c (diff)
downloadhax-minetest-server-27ce6d0ecc55af7e46a586b97b3ec9e1d406a897.tar.gz
hax-minetest-server-27ce6d0ecc55af7e46a586b97b3ec9e1d406a897.zip
Clean up craft replacements docs
Diffstat (limited to '')
-rw-r--r--src/craftdef.h17
-rw-r--r--src/inventorymanager.cpp2
2 files changed, 14 insertions, 5 deletions
diff --git a/src/craftdef.h b/src/craftdef.h
index 5971a89bf..7c14e702a 100644
--- a/src/craftdef.h
+++ b/src/craftdef.h
@@ -113,9 +113,6 @@ struct CraftOutput
Example: If ("bucket:bucket_water", "bucket:bucket_empty") is a
replacement pair, the crafting input slot that contained a water
bucket will contain an empty bucket after crafting.
-
- Note: replacements only work correctly when stack_max of the item
- to be replaced is 1. It is up to the mod writer to ensure this.
*/
struct CraftReplacements
{
@@ -410,10 +407,22 @@ public:
ICraftDefManager() = default;
virtual ~ICraftDefManager() = default;
- // The main crafting function
+ /**
+ * The main crafting function.
+ *
+ * @param input The input grid.
+ * @param output CraftOutput where the result is placed.
+ * @param output_replacements A vector of ItemStacks where replacements are
+ * placed if they cannot be placed in the input. Replacements can be placed
+ * in the input if the stack of the replaced item has a count of 1.
+ * @param decrementInput If true, consume or replace input items.
+ * @param gamedef
+ * @return true if a result was found, otherwise false.
+ */
virtual bool getCraftResult(CraftInput &input, CraftOutput &output,
std::vector<ItemStack> &output_replacements,
bool decrementInput, IGameDef *gamedef) const=0;
+
virtual std::vector<CraftDefinition*> getCraftRecipes(CraftOutput &output,
IGameDef *gamedef, unsigned limit=0) const=0;
diff --git a/src/inventorymanager.cpp b/src/inventorymanager.cpp
index 57b561477..5a24f95a4 100644
--- a/src/inventorymanager.cpp
+++ b/src/inventorymanager.cpp
@@ -861,7 +861,7 @@ void ICraftAction::apply(InventoryManager *mgr,
}
// Put the replacements in the inventory or drop them on the floor, if
- // the invenotry is full
+ // the inventory is full
for (auto &output_replacement : output_replacements) {
if (list_main)
output_replacement = list_main->addItem(output_replacement);