#ifndef STAR_SYSTEM_WORLD_CLIENT_HPP #define STAR_SYSTEM_WORLD_CLIENT_HPP #include "StarCelestialParameters.hpp" #include "StarCelestialCoordinate.hpp" #include "StarSystemWorld.hpp" #include "StarNetPackets.hpp" namespace Star { STAR_CLASS(CelestialDatabase); STAR_CLASS(PlayerUniverseMap); STAR_CLASS(Celestial); STAR_CLASS(Clock); STAR_CLASS(ClientContext); class SystemWorldClient : public SystemWorld { public: SystemWorldClient(ClockConstPtr universeClock, CelestialDatabasePtr celestialDatabase, PlayerUniverseMapPtr clientContext); CelestialCoordinate currentSystem() const; Maybe shipPosition() const; SystemLocation shipLocation() const; SystemLocation shipDestination() const; bool flying() const; void update(float dt); List objects() const override; SystemObjectPtr getObject(Uuid const& uuid) const override; List ships() const; SystemClientShipPtr getShip(Uuid const& uuid) const; Uuid spawnObject(String typeName, Maybe position = {}, Maybe const& uuid = {}, JsonObject parameters = {}); // returns whether the packet was handled bool handleIncomingPacket(PacketPtr packet); List pullOutgoingPackets(); private: SystemObjectPtr netLoadObject(ByteArray netStore); SystemClientShipPtr netLoadShip(ByteArray netStore); // m_ship can be a null pointer, indicating that the system is not initialized SystemClientShipPtr m_ship; HashMap m_objects; HashMap m_clientShips; PlayerUniverseMapPtr m_universeMap; List m_outgoingPackets; }; } #endif