summaryrefslogtreecommitdiffstats
path: root/src/BrewingRecipes.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/BrewingRecipes.h31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/BrewingRecipes.h b/src/BrewingRecipes.h
index f42384896..78e1c196b 100644
--- a/src/BrewingRecipes.h
+++ b/src/BrewingRecipes.h
@@ -5,7 +5,7 @@
-class cItem;
+#include "Item.h"
@@ -15,21 +15,21 @@ 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;
+ cRecipe()
+ {
+ // These items always have the same type
+ Input.m_ItemType = E_ITEM_POTION;
+ Output.m_ItemType = E_ITEM_POTION;
+ }
+
+ cItem Input;
+ cItem Output;
+ cItem Ingredient;
};
/** Returns a recipe for the specified input, nullptr if no recipe found */
@@ -44,15 +44,18 @@ public:
/** Returns true if the item is the fuel, false if not. */
bool IsFuel(const cItem & a_Item) const;
private:
+ using cRecipes = std::vector<std::unique_ptr<cBrewingRecipes::cRecipe>>;
+
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);
+ void AddRecipeFromLine(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;
+ /** The collection of parsed recipes.
+ GetRecipeFrom may cache splash variants of recipes here but the observable behaviour is constant, so this should be mutable. */
+ mutable cRecipes m_Recipes;
};