From b355bdeccecf727d30e48634df9b5d424db570bc Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Mon, 4 Jun 2012 12:08:20 +0000 Subject: 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 --- source/cFurnaceRecipe.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'source/cFurnaceRecipe.cpp') diff --git a/source/cFurnaceRecipe.cpp b/source/cFurnaceRecipe.cpp index 321253422..b17ec51cd 100644 --- a/source/cFurnaceRecipe.cpp +++ b/source/cFurnaceRecipe.cpp @@ -7,30 +7,51 @@ #include #include + + + + 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 ) -- cgit v1.2.3