X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2FSimulation.hpp;h=19023406ace73a2466886fb2c71c960cea208bb7;hb=631f0cfd6b421f5be68d60375db2ce91176d923d;hp=ee497a8f97a47b1ded9176b85f973ea7f5a645a9;hpb=42db7d9d2286e50896ad172e2e4a8fbe65c8a4a9;p=blobs.git diff --git a/src/world/Simulation.hpp b/src/world/Simulation.hpp index ee497a8..1902340 100644 --- a/src/world/Simulation.hpp +++ b/src/world/Simulation.hpp @@ -1,13 +1,19 @@ #ifndef BLOBS_WORLD_SIMULATION_HPP_ #define BLOBS_WORLD_SIMULATION_HPP_ +#include "Record.hpp" #include "Set.hpp" #include "../app/Assets.hpp" +#include #include +#include namespace blobs { +namespace creature { + class Creature; +} namespace world { class Body; @@ -29,11 +35,7 @@ public: Simulation &operator =(Simulation &&) = delete; public: - void Tick(); - - void AddBody(Body &); - void AddPlanet(Planet &); - void AddSun(Sun &); + void Tick(double dt); Body &Root() noexcept { return root; } const Body &Root() const noexcept { return root; } @@ -43,19 +45,42 @@ public: const Set &Resources() const noexcept { return assets.data.resources; } const Set &TileTypes() const noexcept { return assets.data.tile_types; } + void AddBody(Body &); + void AddPlanet(Planet &); + void AddSun(Sun &); + const std::set &Bodies() const noexcept { return bodies; } const std::set &Planets() const noexcept { return planets; } const std::set &Suns() const noexcept { return suns; } + void SetAlive(creature::Creature *); + std::vector &LiveCreatures() noexcept { return alive; } + const std::vector &LiveCreatures() const noexcept { return alive; } + + void SetDead(creature::Creature *); + std::vector &DeadCreatures() noexcept { return dead; } + const std::vector &DeadCreatures() const noexcept { return dead; } + double Time() const noexcept { return time; } + const std::vector &Records() const noexcept { return records; } + void CheckRecords(creature::Creature &) noexcept; + + std::ostream &Log(); + private: Body &root; app::Assets &assets; + std::set bodies; std::set planets; std::set suns; + + std::vector alive; + std::vector dead; + double time; + std::vector records; };