12345678910111213141516171819202122232425262728293031323334353637383940 |
- #pragma once
- #include <Text.h>
- #include "Recipie.h"
- template<typename T, typename S> class RecipieListType
- : public virtual Framework::ReferenceCounter
- {
- private:
- Framework::RCArray<T> recipies;
- Framework::Text name;
- public:
- RecipieListType(const char* name)
- : ReferenceCounter(),
- name(name)
- {}
- void addRecipie(T* recipie)
- {
- recipies.add(recipie);
- }
- T* zFirstRecipie(S* zStorage)
- {
- for (T* recipie : recipies)
- {
- if (recipie->testApplicability(zStorage)) return recipie;
- }
- return 0;
- }
- const Framework::Text& getName() const
- {
- return name;
- }
- };
- typedef RecipieListType<Recipie, CraftingStorage> RecipieList;
- typedef RecipieListType<ShapedRecipie, ShapedCraftingStorage> ShapedRecipieList;
|