Skip to content

Commit

Permalink
Make crafting recipe load function public
Browse files Browse the repository at this point in the history
  • Loading branch information
IAmMoltony committed Feb 7, 2024
1 parent dac93db commit fc6fdd5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions include/crafting.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ class CraftingRecipe
*/
std::vector<InventoryItem> recipe;

/**
* @brief Construct a crafting recipe
* @param recipeFile recipe file
*/
void construct(const char *recipeFile);

public:
// constructors are marked as explicit because cppcheck said so

Expand All @@ -46,6 +40,12 @@ class CraftingRecipe
*/
explicit CraftingRecipe(const std::string &recipeFile);

/**
* @brief Load recipe from file
* @param recipeFile recipe file to load from
*/
void load(const char *recipeFile);

/**
* @brief Get the full name of the recipe
* @param inventory Player's inventory
Expand Down
6 changes: 3 additions & 3 deletions source/crafting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ static const char *_craftingDir(void)
return (const char *)_dir;
}

void CraftingRecipe::construct(const char *recipeFile)
void CraftingRecipe::load(const char *recipeFile)
{
std::string path = std::string(_craftingDir()) + "/" + std::string(recipeFile) + ".rcp";

Expand Down Expand Up @@ -79,13 +79,13 @@ void CraftingRecipe::construct(const char *recipeFile)
CraftingRecipe::CraftingRecipe(const char *recipeFile)
: output(InventoryItem::ID::None, 0), recipe()
{
construct(recipeFile);
load(recipeFile);
}

CraftingRecipe::CraftingRecipe(const std::string &recipeFile)
: output(InventoryItem::ID::None, 0), recipe()
{
construct(recipeFile.c_str());
load(recipeFile.c_str());
}

std::string CraftingRecipe::getFullName(Inventory *inventory)
Expand Down

0 comments on commit fc6fdd5

Please sign in to comment.