]> git.localhorst.tv Git - blobs.git/blobdiff - src/creature/Composition.hpp
scale compatibility to same state resources only
[blobs.git] / src / creature / Composition.hpp
index 06b1c744b51b2a94e2b961feb8222c72563c813d..969407f89b1ff7d42e6cf7c3a6dfef43699a9d9a 100644 (file)
@@ -1,10 +1,16 @@
 #ifndef BLOBLS_CREATURE_COMPOSITION_HPP_
 #define BLOBLS_CREATURE_COMPOSITION_HPP_
 
+#include "../world/Set.hpp"
+#include "../world/Resource.hpp"
+
 #include <vector>
 
 
 namespace blobs {
+namespace world {
+       class Resource;
+}
 namespace creature {
 
 class Composition {
@@ -18,21 +24,27 @@ public:
        };
 
 public:
-       Composition();
+       explicit Composition(const world::Set<world::Resource> &);
        ~Composition();
 
-       Composition(const Composition &) = delete;
-       Composition &operator =(const Composition &) = delete;
+       Composition(const Composition &) = default;
+       Composition &operator =(const Composition &) = default;
 
-       Composition(Composition &&) = delete;
-       Composition &operator =(Composition &&) = delete;
+       Composition(Composition &&) = default;
+       Composition &operator =(Composition &&) = default;
 
 public:
        void Add(int res, double amount);
        bool Has(int res) const noexcept;
        double Get(int res) const noexcept;
+       double Proportion(int res) const noexcept;
+       double StateProportion(int res) const noexcept;
+       double Compatibility(int res) const noexcept;
+       double TotalMass() const noexcept { return total_mass; }
+       double StateMass(world::Resource::State s) const noexcept { return state_mass[s]; }
 
 public:
+       std::vector<Component>::size_type size() const noexcept { return components.size(); }
        std::vector<Component>::iterator begin() noexcept { return components.begin(); }
        std::vector<Component>::iterator end() noexcept { return components.end(); }
        std::vector<Component>::const_iterator begin() const noexcept { return components.begin(); }
@@ -41,7 +53,10 @@ public:
        std::vector<Component>::const_iterator cend() noexcept { return components.cend(); }
 
 private:
+       const world::Set<world::Resource> &resources;
        std::vector<Component> components;
+       double total_mass;
+       double state_mass[4];
 
 };