diff options
Diffstat (limited to 'game/network')
-rw-r--r-- | game/network/link.h | 2 | ||||
-rw-r--r-- | game/network/rail.cpp | 4 | ||||
-rw-r--r-- | game/network/rail.h | 9 |
3 files changed, 8 insertions, 7 deletions
diff --git a/game/network/link.h b/game/network/link.h index 3fabf05..d4ae4c6 100644 --- a/game/network/link.h +++ b/game/network/link.h @@ -37,7 +37,7 @@ public: NO_COPY(Link); NO_MOVE(Link); - virtual Transform positionAt(float dist, unsigned char start) const = 0; + [[nodiscard]] virtual Transform positionAt(float dist, unsigned char start) const = 0; std::array<End, 2> ends; float length; diff --git a/game/network/rail.cpp b/game/network/rail.cpp index 56feec0..1f3cc01 100644 --- a/game/network/rail.cpp +++ b/game/network/rail.cpp @@ -8,7 +8,7 @@ #include <gfx/models/texture.h> #include <gfx/models/vertex.hpp> #include <glm/gtx/transform.hpp> -#include <glm/gtx/vector_angle.hpp> +#include <initializer_list> #include <maths.h> #include <type_traits> #include <utility> @@ -17,7 +17,7 @@ RailLinks::RailLinks() : texture {Texture::cachedTexture.get("rails.jpg")} { } void RailLinks::tick(TickDuration) { } void -RailLinks::joinLinks(LinkPtr l) const +RailLinks::joinLinks(const LinkPtr & l) const { for (const auto & ol : links.objects) { if (l != ol) { diff --git a/game/network/rail.h b/game/network/rail.h index 58c26c3..ac944f3 100644 --- a/game/network/rail.h +++ b/game/network/rail.h @@ -3,6 +3,7 @@ #include "collection.hpp" #include "game/worldobject.h" +#include "gfx/gl/transform.h" #include "gfx/models/mesh.h" #include "gfx/models/vertex.hpp" #include "gfx/renderable.h" @@ -36,7 +37,7 @@ protected: class RailLinkStraight : public RailLink { public: RailLinkStraight(const NodePtr &, const NodePtr &); - Transform positionAt(float dist, unsigned char start) const override; + [[nodiscard]] Transform positionAt(float dist, unsigned char start) const override; private: RailLinkStraight(NodePtr, NodePtr, const glm::vec3 & diff); @@ -45,7 +46,7 @@ private: class RailLinkCurve : public RailLink { public: RailLinkCurve(const NodePtr &, const NodePtr &, glm::vec2); - Transform positionAt(float dist, unsigned char start) const override; + [[nodiscard]] Transform positionAt(float dist, unsigned char start) const override; private: RailLinkCurve(const NodePtr &, const NodePtr &, glm::vec3, const Arc); @@ -65,7 +66,7 @@ public: { const auto node1 = *nodes.insert(std::make_shared<Node>(a)).first; const auto node2 = *nodes.insert(std::make_shared<Node>(b)).first; - auto l = links.create<T>(node1, node2, std::forward<Params>(params)...); + auto l {links.create<T>(node1, node2, std::forward<Params>(params)...)}; joinLinks(l); return l; } @@ -76,7 +77,7 @@ private: Nodes nodes; void render(const Shader &) const override; void tick(TickDuration elapsed) override; - void joinLinks(LinkPtr) const; + void joinLinks(const LinkPtr &) const; std::shared_ptr<Texture> texture; }; |