2018-06-24 07:11:50 +02:00
|
|
|
/*
|
|
|
|
* =====================================================================================
|
|
|
|
*
|
|
|
|
* Filename: CraftingRecipe.hpp
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
*
|
|
|
|
* Created: 24/06/2018 06:38:11
|
|
|
|
*
|
|
|
|
* Author: Quentin Bazin, <quent42340@gmail.com>
|
|
|
|
*
|
|
|
|
* =====================================================================================
|
|
|
|
*/
|
|
|
|
#ifndef CRAFTINGRECIPE_HPP_
|
|
|
|
#define CRAFTINGRECIPE_HPP_
|
|
|
|
|
|
|
|
#include <array>
|
2018-06-27 09:07:57 +02:00
|
|
|
#include <map>
|
2018-06-24 07:11:50 +02:00
|
|
|
|
2018-06-30 03:47:39 +02:00
|
|
|
#include "Recipe.hpp"
|
2018-06-24 07:11:50 +02:00
|
|
|
|
2018-06-30 03:47:39 +02:00
|
|
|
class CraftingRecipe : public Recipe {
|
2018-06-24 07:11:50 +02:00
|
|
|
public:
|
2018-06-27 09:07:57 +02:00
|
|
|
CraftingRecipe(const std::vector<std::string> &pattern, const std::map<char, std::vector<u32>> &keys, const ItemStack &result, bool isShapeless = false);
|
2018-06-24 07:11:50 +02:00
|
|
|
|
2018-06-30 03:47:39 +02:00
|
|
|
bool isMatching(const Inventory &inventory) const override;
|
2018-06-24 07:11:50 +02:00
|
|
|
|
|
|
|
private:
|
2018-06-27 09:07:57 +02:00
|
|
|
bool checkMatch(const Inventory &inventory, int offsetX, int offsetY) const;
|
|
|
|
|
|
|
|
std::vector<std::string> m_pattern;
|
|
|
|
std::map<char, std::vector<u32>> m_keys;
|
2018-06-24 07:46:34 +02:00
|
|
|
|
|
|
|
bool m_isShapeless;
|
2018-06-24 07:11:50 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CRAFTINGRECIPE_HPP_
|