Added the new recipe parser, parsing the crafting.txt file. Included are a few recipes. The old parser still works, but will be replaced soon.
git-svn-id: http://mc-server.googlecode.com/svn/trunk@549 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
@@ -7,30 +7,51 @@
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef std::list< cFurnaceRecipe::Recipe > RecipeList;
|
||||
typedef std::list< cFurnaceRecipe::Fuel > FuelList;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct cFurnaceRecipe::sFurnaceRecipeState
|
||||
{
|
||||
RecipeList Recipes;
|
||||
FuelList Fuel;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
cFurnaceRecipe::cFurnaceRecipe()
|
||||
: m_pState( new sFurnaceRecipeState )
|
||||
{
|
||||
ReloadRecipes();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
cFurnaceRecipe::~cFurnaceRecipe()
|
||||
{
|
||||
ClearRecipes();
|
||||
delete m_pState;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cFurnaceRecipe::ReloadRecipes()
|
||||
{
|
||||
ClearRecipes();
|
||||
LOG("--Loading furnace recipes--");
|
||||
LOG("-- Loading furnace recipes --");
|
||||
|
||||
std::ifstream f;
|
||||
char a_File[] = "furnace.txt";
|
||||
@@ -152,9 +173,13 @@ void cFurnaceRecipe::ReloadRecipes()
|
||||
}
|
||||
LOG("Got %i furnace recipes, and %i fuels.", m_pState->Recipes.size(), m_pState->Fuel.size() );
|
||||
|
||||
LOG("--Done loading furnace recipes--");
|
||||
LOG("-- Done loading furnace recipes --");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cFurnaceRecipe::ClearRecipes()
|
||||
{
|
||||
for( RecipeList::iterator itr = m_pState->Recipes.begin(); itr != m_pState->Recipes.end(); ++itr )
|
||||
|
||||
Reference in New Issue
Block a user