From 423328de708ffa93961c329de13445ce2da6e328 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 1 Jan 2024 22:03:10 +0000 Subject: Remove more use of legacy types and unnecessary pointers from selectable interface --- game/vehicles/railVehicle.cpp | 4 ++-- game/vehicles/railVehicle.h | 3 +-- game/vehicles/train.cpp | 2 +- game/vehicles/train.h | 4 +--- 4 files changed, 5 insertions(+), 8 deletions(-) (limited to 'game/vehicles') 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 #include #include -#include 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 #include #include -#include -#include 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; -- cgit v1.2.3