summaryrefslogtreecommitdiff
path: root/game/vehicles
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-02-14 14:32:25 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-02-14 14:32:25 +0000
commit169068b417323232cc6aac440f3d7a2d918b5917 (patch)
tree6a97eba1b3027feaa8e5530f7df625c0430a61b1 /game/vehicles
parentAdd our first vehicle (diff)
downloadilt-169068b417323232cc6aac440f3d7a2d918b5917.tar.bz2
ilt-169068b417323232cc6aac440f3d7a2d918b5917.tar.xz
ilt-169068b417323232cc6aac440f3d7a2d918b5917.zip
Code tidy-up
Diffstat (limited to 'game/vehicles')
-rw-r--r--game/vehicles/railloco.cpp8
-rw-r--r--game/vehicles/railloco.h3
-rw-r--r--game/vehicles/vehicle.cpp6
-rw-r--r--game/vehicles/vehicle.h3
4 files changed, 14 insertions, 6 deletions
diff --git a/game/vehicles/railloco.cpp b/game/vehicles/railloco.cpp
index baa9b81..54582c2 100644
--- a/game/vehicles/railloco.cpp
+++ b/game/vehicles/railloco.cpp
@@ -1,8 +1,12 @@
#include "railloco.h"
-#include "game/vehicles/vehicle.h"
#include "gfx/gl/transform.h"
+#include <algorithm>
+#include <array>
#include <glm/glm.hpp>
#include <maths.h>
+#include <memory>
+#include <utility>
+#include <vector>
void
RailLoco::tick(TickDuration dur)
@@ -27,4 +31,4 @@ RailLoco::tick(TickDuration dur)
location = link->positionAt(linkDist, linkDir);
}
-Brush47::Brush47(LinkPtr l) : RailLoco(l, "brush47.obj", "brush47.png") { }
+Brush47::Brush47(const LinkPtr & l) : RailLoco(l, "brush47.obj", "brush47.png") { }
diff --git a/game/vehicles/railloco.h b/game/vehicles/railloco.h
index 05e3e48..833b661 100644
--- a/game/vehicles/railloco.h
+++ b/game/vehicles/railloco.h
@@ -1,3 +1,4 @@
+#include "game/network/link.h"
#include "game/worldobject.h"
#include "vehicle.h"
#include <string>
@@ -10,5 +11,5 @@ public:
class Brush47 : public RailLoco {
public:
- Brush47(LinkPtr p);
+ explicit Brush47(const LinkPtr & p);
};
diff --git a/game/vehicles/vehicle.cpp b/game/vehicles/vehicle.cpp
index 4c4ac71..c12181f 100644
--- a/game/vehicles/vehicle.cpp
+++ b/game/vehicles/vehicle.cpp
@@ -1,6 +1,10 @@
#include "vehicle.h"
+#include "game/network/link.h"
+#include <array>
+#include <memory>
+#include <utility>
-Vehicle::Vehicle(LinkPtr l, const std::string & obj, const std::string & tex) :
+Vehicle::Vehicle(const LinkPtr & l, const std::string & obj, const std::string & tex) :
Physical(l->ends.front().first->pos, obj, tex), link(l)
{
}
diff --git a/game/vehicles/vehicle.h b/game/vehicles/vehicle.h
index 01be6a6..cd2249d 100644
--- a/game/vehicles/vehicle.h
+++ b/game/vehicles/vehicle.h
@@ -4,12 +4,11 @@
#include "game/physical.h"
#include <game/network/link.h>
#include <game/worldobject.h>
-#include <glm/glm.hpp>
#include <string>
class Vehicle : public WorldObject, public Physical {
public:
- Vehicle(LinkPtr link, const std::string & obj, const std::string & tex);
+ Vehicle(const LinkPtr & link, const std::string & obj, const std::string & tex);
LinkPtr link; // Which link are we travelling along
unsigned char linkDir {0}; // Starting end e0->e1 or e1->e0
float linkDist {0}; // distance long current link