2012-06-14 09:06:06 -04:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class cItem;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class cFurnaceRecipe
|
|
|
|
{
|
|
|
|
public:
|
2013-06-16 16:24:07 -04:00
|
|
|
cFurnaceRecipe(void);
|
2012-06-14 09:06:06 -04:00
|
|
|
~cFurnaceRecipe();
|
|
|
|
|
2013-06-16 16:24:07 -04:00
|
|
|
void ReloadRecipes(void);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2014-08-31 13:00:36 -04:00
|
|
|
struct cFuel
|
2012-06-14 09:06:06 -04:00
|
|
|
{
|
2013-06-16 16:24:07 -04:00
|
|
|
cItem * In;
|
|
|
|
int BurnTime; ///< How long this fuel burns, in ticks
|
2012-06-14 09:06:06 -04:00
|
|
|
};
|
|
|
|
|
2014-08-31 13:00:36 -04:00
|
|
|
struct cRecipe
|
2012-06-14 09:06:06 -04:00
|
|
|
{
|
2013-06-16 16:24:07 -04:00
|
|
|
cItem * In;
|
|
|
|
cItem * Out;
|
|
|
|
int CookTime; ///< How long this recipe takes to smelt, in ticks
|
2012-06-14 09:06:06 -04:00
|
|
|
};
|
2013-06-16 16:24:07 -04:00
|
|
|
|
2014-10-20 16:55:07 -04:00
|
|
|
/** Returns a recipe for the specified input, nullptr if no recipe found */
|
2014-08-31 13:00:36 -04:00
|
|
|
const cRecipe * GetRecipeFrom(const cItem & a_Ingredient) const;
|
2013-06-16 16:24:07 -04:00
|
|
|
|
2014-08-31 13:00:36 -04:00
|
|
|
/** Returns the amount of time that the specified fuel burns, in ticks */
|
2013-06-16 16:24:07 -04:00
|
|
|
int GetBurnTime(const cItem & a_Fuel) const;
|
2012-06-14 09:06:06 -04:00
|
|
|
|
|
|
|
private:
|
2013-06-16 16:24:07 -04:00
|
|
|
void ClearRecipes(void);
|
2012-06-14 09:06:06 -04:00
|
|
|
|
2014-06-26 12:18:41 -04:00
|
|
|
/** Parses the fuel contained in the line, adds it to m_pState's fuels.
|
|
|
|
Logs a warning to the console on input error. */
|
2014-08-31 14:53:41 -04:00
|
|
|
void AddFuelFromLine(const AString & a_Line, unsigned int a_LineNum);
|
2014-06-26 12:18:41 -04:00
|
|
|
|
|
|
|
/** Parses the recipe contained in the line, adds it to m_pState's recipes.
|
|
|
|
Logs a warning to the console on input error. */
|
2014-08-31 14:53:41 -04:00
|
|
|
void AddRecipeFromLine(const AString & a_Line, unsigned int a_LineNum);
|
2014-06-26 12:18:41 -04:00
|
|
|
|
2014-09-01 07:43:10 -04:00
|
|
|
/** Parses an item string in the format "<ItemType>[: <Damage>][, <Amount>]", returns true if successful. */
|
2014-08-31 13:00:36 -04:00
|
|
|
bool ParseItem(const AString & a_String, cItem & a_Item);
|
2014-06-21 15:33:23 -04:00
|
|
|
|
2012-06-14 09:06:06 -04:00
|
|
|
struct sFurnaceRecipeState;
|
2013-06-16 16:24:07 -04:00
|
|
|
sFurnaceRecipeState * m_pState;
|
2012-06-14 09:06:06 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|