summaryrefslogtreecommitdiff
path: root/game/vehicles
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-01-01 22:03:10 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-01-01 22:03:10 +0000
commit423328de708ffa93961c329de13445ce2da6e328 (patch)
tree6b4500d0d6af5ee5bff967233d82bfae078b279c /game/vehicles
parentRemove more use of legacy types from camera controller (diff)
downloadilt-423328de708ffa93961c329de13445ce2da6e328.tar.bz2
ilt-423328de708ffa93961c329de13445ce2da6e328.tar.xz
ilt-423328de708ffa93961c329de13445ce2da6e328.zip
Remove more use of legacy types and unnecessary pointers from selectable interface
Diffstat (limited to 'game/vehicles')
-rw-r--r--game/vehicles/railVehicle.cpp4
-rw-r--r--game/vehicles/railVehicle.h3
-rw-r--r--game/vehicles/train.cpp2
-rw-r--r--game/vehicles/train.h4
4 files changed, 5 insertions, 8 deletions
diff --git a/game/vehicles/railVehicle.cpp b/game/vehicles/railVehicle.cpp
index 7e4b1ee..6653333 100644
--- a/game/vehicles/railVehicle.cpp
+++ b/game/vehicles/railVehicle.cpp
@@ -44,7 +44,7 @@ RailVehicle::move(const Train * t, float & trailBy)
}
bool
-RailVehicle::intersectRay(const Ray & ray, BaryPosition * baryPos, float * distance) const
+RailVehicle::intersectRay(const Ray & ray, BaryPosition & baryPos, RelativeDistance & distance) const
{
constexpr const auto X = 1350.F;
const auto Y = this->rvClass->length / 2.F;
@@ -80,6 +80,6 @@ RailVehicle::intersectRay(const Ray & ray, BaryPosition * baryPos, float * dista
return std::any_of(
triangles.begin(), triangles.end(), [&cornerVertices, &ray, &baryPos, &distance](const auto & idx) {
return glm::intersectRayTriangle(ray.start, ray.direction, cornerVertices[idx[0]],
- cornerVertices[idx[1]], cornerVertices[idx[2]], *baryPos, *distance);
+ cornerVertices[idx[1]], cornerVertices[idx[2]], baryPos, distance);
});
}
diff --git a/game/vehicles/railVehicle.h b/game/vehicles/railVehicle.h
index 8cbc49d..f6e4764 100644
--- a/game/vehicles/railVehicle.h
+++ b/game/vehicles/railVehicle.h
@@ -6,7 +6,6 @@
#include <game/selectable.h>
#include <glm/glm.hpp>
#include <memory>
-#include <utility>
class Ray;
class Train;
@@ -17,7 +16,7 @@ public:
void move(const Train *, float & trailBy);
- [[nodiscard]] bool intersectRay(const Ray &, BaryPosition *, float *) const override;
+ [[nodiscard]] bool intersectRay(const Ray &, BaryPosition &, RelativeDistance &) const override;
RailVehicleClassPtr rvClass;
using LV = RailVehicleClass::LocationVertex;
diff --git a/game/vehicles/train.cpp b/game/vehicles/train.cpp
index 13905a3..05b2d8a 100644
--- a/game/vehicles/train.cpp
+++ b/game/vehicles/train.cpp
@@ -20,7 +20,7 @@ Train::getBogiePosition(float linkDist, float dist) const
}
bool
-Train::intersectRay(const Ray & ray, BaryPosition * baryPos, float * distance) const
+Train::intersectRay(const Ray & ray, BaryPosition & baryPos, RelativeDistance & distance) const
{
return applyOne(&RailVehicle::intersectRay, ray, baryPos, distance) != end();
}
diff --git a/game/vehicles/train.h b/game/vehicles/train.h
index c77cd23..bb668ed 100644
--- a/game/vehicles/train.h
+++ b/game/vehicles/train.h
@@ -10,8 +10,6 @@
#include <collection.h>
#include <glm/glm.hpp>
#include <location.h>
-#include <memory>
-#include <vector>
class SceneShader;
class ShadowMapper;
@@ -27,7 +25,7 @@ public:
return objects.front()->location;
}
- [[nodiscard]] bool intersectRay(const Ray &, BaryPosition *, float *) const override;
+ [[nodiscard]] bool intersectRay(const Ray &, BaryPosition &, RelativeDistance &) const override;
void tick(TickDuration elapsed) override;
void doActivity(Go *, TickDuration) override;