summaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
Diffstat (limited to 'game')
-rw-r--r--game/vehicles/railVehicle.cpp15
-rw-r--r--game/vehicles/railVehicle.h5
2 files changed, 14 insertions, 6 deletions
diff --git a/game/vehicles/railVehicle.cpp b/game/vehicles/railVehicle.cpp
index fc43995..1ed904d 100644
--- a/game/vehicles/railVehicle.cpp
+++ b/game/vehicles/railVehicle.cpp
@@ -12,10 +12,19 @@
#include <ray.h>
RailVehicle::RailVehicle(RailVehicleClassPtr rvc) :
- RailVehicleClass::Instance {rvc->instances.acquire()}, rvClass {std::move(rvc)}, location {&LV::body, *this},
+ RailVehicleClass::Instance {rvc->instances.acquire()}, rvClass {std::move(rvc)},
+ location {[this](const BufferedLocation * l) {
+ this->get()->body = l->getTransform();
+ }},
bogies {{
- {&LV::front, *this, Position3D {0, rvClass->wheelBase / 2.F, 0}},
- {&LV::back, *this, Position3D {0, -rvClass->wheelBase / 2.F, 0}},
+ {[this](const BufferedLocation * l) {
+ this->get()->front = l->getTransform();
+ },
+ Position3D {0, rvClass->wheelBase / 2.F, 0}},
+ {[this](const BufferedLocation * l) {
+ this->get()->back = l->getTransform();
+ },
+ Position3D {0, -rvClass->wheelBase / 2.F, 0}},
}}
{
}
diff --git a/game/vehicles/railVehicle.h b/game/vehicles/railVehicle.h
index e034852..20d1ea1 100644
--- a/game/vehicles/railVehicle.h
+++ b/game/vehicles/railVehicle.h
@@ -21,9 +21,8 @@ public:
RailVehicleClassPtr rvClass;
using LV = RailVehicleClass::LocationVertex;
- using BLocation = BufferedLocationT<glm::mat4 LV::*, RailVehicleClass::Instance &>;
- BLocation location;
- std::array<BLocation, 2> bogies;
+ BufferedLocationUpdater location;
+ std::array<BufferedLocationUpdater, 2> bogies;
};
using RailVehiclePtr = std::unique_ptr<RailVehicle>;