X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2FSimulation.hpp;h=19023406ace73a2466886fb2c71c960cea208bb7;hb=631f0cfd6b421f5be68d60375db2ce91176d923d;hp=6d22ed3ef9e5087f886e2f1c62e94ef34af57aea;hpb=0453d6da05d4b29d953f00857d743310d9344ce0;p=blobs.git diff --git a/src/world/Simulation.hpp b/src/world/Simulation.hpp index 6d22ed3..1902340 100644 --- a/src/world/Simulation.hpp +++ b/src/world/Simulation.hpp @@ -1,16 +1,31 @@ #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; +class Planet; +class Resource; +class Sun; +class TileType; class Simulation { public: - explicit Simulation(Body &root); + explicit Simulation(Body &root, app::Assets &); ~Simulation(); Simulation(const Simulation &) = delete; @@ -20,16 +35,52 @@ public: Simulation &operator =(Simulation &&) = delete; public: - void Tick(); + void Tick(double dt); + + Body &Root() noexcept { return root; } + const Body &Root() const noexcept { return root; } + + 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 &); + + const std::set &Bodies() const noexcept { return bodies; } + const std::set &Planets() const noexcept { return planets; } + const std::set &Suns() const noexcept { return suns; } - Body &Root() { return root; } - const Body &Root() const { return root; } + 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; };