X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2FSimulation.hpp;h=3357e520ec86d0ee0619ab4e78e56c386ae8a15c;hb=HEAD;hp=2f2239efe1d9c77b03b1bd10e7151a7c0c659a0c;hpb=2025d49798b93180237b6ce62d3ff5d6ee8ebc6e;p=blobs.git diff --git a/src/world/Simulation.hpp b/src/world/Simulation.hpp index 2f2239e..3357e52 100644 --- a/src/world/Simulation.hpp +++ b/src/world/Simulation.hpp @@ -1,12 +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; @@ -18,7 +25,7 @@ class TileType; class Simulation { public: - explicit Simulation(Body &root, const Set &, const Set &); + explicit Simulation(app::Assets &); ~Simulation(); Simulation(const Simulation &) = delete; @@ -28,32 +35,50 @@ public: Simulation &operator =(Simulation &&) = delete; public: - void Tick(); + void Tick(double dt); + + app::Assets &Assets() noexcept { return assets; } + const app::Assets &Assets() const noexcept { return assets; } + 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 &); - Body &Root() noexcept { return root; } - const Body &Root() const noexcept { return root; } - - const Set &Resources() const noexcept { return resources; } - const Set &TileTypes() const noexcept { return tile_types; } - const std::set &Bodies() const noexcept { return bodies; } const std::set &Planets() const noexcept { return planets; } const std::set &Suns() const noexcept { return suns; } + Planet &PlanetByName(const std::string &); + + 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; + void LogRecord(const Record &); + + std::ostream &Log(); + private: - Body &root; - const Set &resources; - const Set &tile_types; + app::Assets &assets; + std::set bodies; std::set planets; std::set suns; + + std::vector alive; + std::vector dead; + double time; + std::vector records; };