Recipie.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma once
  2. #include <Array.h>
  3. #include <JSON.h>
  4. #include "ItemFilter.h"
  5. #include "CraftingStorage.h"
  6. class Recipie : public virtual Framework::ReferenceCounter
  7. {
  8. private:
  9. Framework::RCArray<ItemFilter> filters;
  10. Framework::Array<int> inputAmount;
  11. Framework::RCArray<Item> outputs;
  12. Framework::Array<int> outputAmount;
  13. public:
  14. Recipie();
  15. void addIngredient( ItemFilter* filter, int amount );
  16. void addOutput( Item* item, int amount );
  17. bool testApplicability( CraftingStorage* zStorage );
  18. void apply( CraftingStorage* zStorage );
  19. };
  20. class ShapedRecipie : public virtual Framework::ReferenceCounter
  21. {
  22. private:
  23. Framework::RCArray<ItemFilter> filters;
  24. int width;
  25. int height;
  26. Item* output;
  27. int outputAmount;
  28. public:
  29. ShapedRecipie( int width, int height );
  30. ~ShapedRecipie();
  31. void setIngredient( int x, int y, ItemFilter* filter );
  32. void setOutput( Item* item, int amount );
  33. bool testApplicability( ShapedCraftingStorage* zStorage );
  34. void apply( ShapedCraftingStorage* zStorage );
  35. };