123456789101112131415161718192021222324252627282930313233343536373839 |
- #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;
- }
- }
- const Framework::Text& getName() const
- {
- return name;
- }
- };
- typedef RecipieListType<Recipie, CraftingStorage> RecipieList;
- typedef RecipieListType<ShapedRecipie, ShapedCraftingStorage> ShapedRecipieList;
|