summaryrefslogtreecommitdiff
path: root/game/network/rail.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-03-10 00:53:08 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-03-10 00:53:08 +0000
commitc274ac05690b34ba05b41d6e7864e6a663c73c1a (patch)
treeb73b3654ae8cd99deba893b278378a4831e5c70c /game/network/rail.h
parentAdd findNodeAt to locate a node instance by position (diff)
downloadilt-c274ac05690b34ba05b41d6e7864e6a663c73c1a.tar.bz2
ilt-c274ac05690b34ba05b41d6e7864e6a663c73c1a.tar.xz
ilt-c274ac05690b34ba05b41d6e7864e6a663c73c1a.zip
Push RailLinks functionality into new base classes Network and NetworkOf<>
Diffstat (limited to 'game/network/rail.h')
-rw-r--r--game/network/rail.h11
1 files changed, 2 insertions, 9 deletions
diff --git a/game/network/rail.h b/game/network/rail.h
index 4460fcd..1d0ef68 100644
--- a/game/network/rail.h
+++ b/game/network/rail.h
@@ -7,17 +7,16 @@
#include "gfx/models/vertex.hpp"
#include "gfx/renderable.h"
#include "link.h"
+#include "network.h"
#include <glm/glm.hpp>
#include <location.hpp>
#include <maths.h>
#include <memory>
#include <set>
-#include <sorting.hpp>
#include <utility>
#include <vector>
class Shader;
-class Texture;
// A piece of rail track
class RailLink : public Link, public Renderable {
@@ -57,7 +56,7 @@ private:
template<typename T> concept RailLinkConcept = std::is_base_of_v<RailLink, T>;
-class RailLinks : public Renderable, public WorldObject {
+class RailLinks : public NetworkOf<RailLink>, public WorldObject {
public:
RailLinks();
template<RailLinkConcept T, typename... Params>
@@ -72,16 +71,10 @@ public:
}
std::shared_ptr<RailLink> addLinksBetween(glm::vec3 start, glm::vec3 end);
- [[nodiscard]] NodePtr findNodeAt(glm::vec3) const;
private:
- using Nodes = std::set<NodePtr, PtrSorter<NodePtr>>;
- Collection<RailLink> links;
- Nodes nodes;
- void render(const Shader &) const override;
void tick(TickDuration elapsed) override;
void joinLinks(const LinkPtr &) const;
- std::shared_ptr<Texture> texture;
};
#endif