summaryrefslogtreecommitdiffstats
path: root/src/BrewingRecipes.h
diff options
context:
space:
mode:
authorJulian Laubstein <julianlaubstein@yahoo.de>2015-11-03 22:06:43 +0100
committerJulian Laubstein <julianlaubstein@yahoo.de>2015-11-03 22:06:43 +0100
commit1bc145ff44bee52d3b71812cc06ffe214f4ac216 (patch)
tree7ea9f3b0029bbf5041c2f05c7d3f3e156c3e6186 /src/BrewingRecipes.h
parentMerge pull request #2595 from cengizIO/master (diff)
parentImplemented brewing (diff)
downloadcuberite-1bc145ff44bee52d3b71812cc06ffe214f4ac216.tar
cuberite-1bc145ff44bee52d3b71812cc06ffe214f4ac216.tar.gz
cuberite-1bc145ff44bee52d3b71812cc06ffe214f4ac216.tar.bz2
cuberite-1bc145ff44bee52d3b71812cc06ffe214f4ac216.tar.lz
cuberite-1bc145ff44bee52d3b71812cc06ffe214f4ac216.tar.xz
cuberite-1bc145ff44bee52d3b71812cc06ffe214f4ac216.tar.zst
cuberite-1bc145ff44bee52d3b71812cc06ffe214f4ac216.zip
Diffstat (limited to 'src/BrewingRecipes.h')
-rw-r--r--src/BrewingRecipes.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/BrewingRecipes.h b/src/BrewingRecipes.h
new file mode 100644
index 000000000..82fb0b822
--- /dev/null
+++ b/src/BrewingRecipes.h
@@ -0,0 +1,55 @@
+
+#pragma once
+
+
+
+
+
+class cItem;
+
+
+
+
+
+class cBrewingRecipes
+{
+public:
+ cBrewingRecipes(void);
+ ~cBrewingRecipes();
+
+ void ReloadRecipes(void);
+
+ struct cRecipe
+ {
+ cRecipe() {}
+ cRecipe(cRecipe &&) {}
+
+ cRecipe(const cRecipe&) = delete;
+ cRecipe & operator=(const cRecipe&) = delete;
+
+ std::unique_ptr<cItem> Input;
+ std::unique_ptr<cItem> Output;
+ std::unique_ptr<cItem> Ingredient;
+ };
+
+ /** Returns a recipe for the specified input, nullptr if no recipe found */
+ const cRecipe * GetRecipeFrom(const cItem & a_Input, const cItem & a_Ingredient) const;
+
+ /** Returns true if the item is a ingredient, false if not. */
+ bool IsIngredient(const cItem & a_Ingredient) const;
+
+ /** Returns true if the item is a bottle / potion, false if not. */
+ bool IsBottle(const cItem & a_Bottle) const;
+private:
+ void ClearRecipes(void);
+
+ /** Parses the recipe contained in the line, adds it to m_pState's recipes.
+ Logs a warning to the console on input error. */
+ void AddRecipeFromLine(const AString & a_Line, unsigned int a_LineNum);
+
+ /** Parses an item string, returns true if successful. */
+ bool ParseItem(const AString & a_String, cItem & a_Item);
+
+ struct sBrewingRecipeState;
+ std::unique_ptr<sBrewingRecipeState> m_pState;
+};