X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fcreature%2FComposition.hpp;h=243c079c899bca91e9c36af607e89d00e592bc04;hb=cead4f0686af352cdbac1f2c2df9b6a21ad9faec;hp=da669923972a340d8c68a4219014cad105648256;hpb=c49dd02dfabb123e0c6c4b49f761ce6578dfc464;p=blobs.git diff --git a/src/creature/Composition.hpp b/src/creature/Composition.hpp index da66992..243c079 100644 --- a/src/creature/Composition.hpp +++ b/src/creature/Composition.hpp @@ -2,6 +2,7 @@ #define BLOBLS_CREATURE_COMPOSITION_HPP_ #include "../world/Set.hpp" +#include "../world/Resource.hpp" #include @@ -23,7 +24,7 @@ public: }; public: - Composition(); + explicit Composition(const world::Set &); ~Composition(); Composition(const Composition &) = default; @@ -37,8 +38,12 @@ public: bool Has(int res) const noexcept; double Get(int res) const noexcept; double Proportion(int res) const noexcept; - double Compatibility(const world::Set &, 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(); } @@ -50,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]; };