summaryrefslogtreecommitdiff
path: root/game/vehicles/train.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-03-06 19:44:58 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-03-06 19:44:58 +0000
commite118b1f5d8071460e3a9d4d731c6d69221f785dc (patch)
tree64ea6b1761afba27d36319648e78ddd457670ff8 /game/vehicles/train.h
parentIntroduce the Train concept as a literal collection of rail vehicles (diff)
downloadilt-e118b1f5d8071460e3a9d4d731c6d69221f785dc.tar.bz2
ilt-e118b1f5d8071460e3a9d4d731c6d69221f785dc.tar.xz
ilt-e118b1f5d8071460e3a9d4d731c6d69221f785dc.zip
Carve up the mess in game/vehicles
Diffstat (limited to 'game/vehicles/train.h')
-rw-r--r--game/vehicles/train.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/game/vehicles/train.h b/game/vehicles/train.h
new file mode 100644
index 0000000..34a9d28
--- /dev/null
+++ b/game/vehicles/train.h
@@ -0,0 +1,33 @@
+#ifndef TRAIN_H
+#define TRAIN_H
+
+#include "game/network/link.h"
+#include "game/worldobject.h"
+#include "railVehicle.h"
+#include "vehicle.h"
+#include <collection.hpp>
+#include <location.hpp>
+#include <memory>
+#include <vector>
+
+class Shader;
+
+class Train : public Vehicle, public Collection<RailVehicle, false> {
+public:
+ explicit Train(const LinkPtr & link, float linkDist = 0) : Vehicle {link, linkDist} { }
+
+ [[nodiscard]] const Location &
+ getLocation() const override
+ {
+ return objects.front()->location;
+ }
+
+ void render(const Shader & shader) const override;
+
+ void tick(TickDuration elapsed) override;
+
+ void move(TickDuration dur);
+ [[nodiscard]] Location getBogiePosition(float linkDist, float dist) const;
+};
+
+#endif