X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fcreature%2FComposition.hpp;h=243c079c899bca91e9c36af607e89d00e592bc04;hb=cead4f0686af352cdbac1f2c2df9b6a21ad9faec;hp=621f6406f77dbd696bbdf248f77f31854e9471b0;hpb=392826deaf802ac0960ed3924a3f98b9d18d381b;p=blobs.git diff --git a/src/creature/Composition.hpp b/src/creature/Composition.hpp index 621f640..243c079 100644 --- a/src/creature/Composition.hpp +++ b/src/creature/Composition.hpp @@ -1,10 +1,16 @@ #ifndef BLOBLS_CREATURE_COMPOSITION_HPP_ #define BLOBLS_CREATURE_COMPOSITION_HPP_ +#include "../world/Set.hpp" +#include "../world/Resource.hpp" + #include namespace blobs { +namespace world { + class Resource; +} namespace creature { class Composition { @@ -18,20 +24,26 @@ public: }; public: - Composition(); + explicit Composition(const world::Set &); ~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 TotalVolume() const noexcept { return total_volume; } + double TotalDensity() const noexcept { return total_mass / total_volume; } + double StateMass(world::Resource::State s) const noexcept { return state_mass[s]; } public: std::vector::size_type size() const noexcept { return components.size(); } @@ -43,8 +55,11 @@ public: std::vector::const_iterator cend() noexcept { return components.cend(); } private: + const world::Set &resources; std::vector components; double total_mass; + double total_volume; + double state_mass[4]; };