From 7811b11565b485ad7bd6bf12588c526e60489750 Mon Sep 17 00:00:00 2001 From: James Turner Date: Tue, 24 Mar 2020 22:37:13 +0000 Subject: [PATCH] Fix Yasim ground interface recursion bug The base (non-FlightGear) implementation of YASim ground getBody would always call itself. Fortunately we always replace it with the FG-specific subclass (FGGround). --- src/FDM/YASim/FGGround.hpp | 22 +++++++++++----------- src/FDM/YASim/Ground.cpp | 11 +---------- src/FDM/YASim/Ground.hpp | 7 +++---- 3 files changed, 15 insertions(+), 25 deletions(-) diff --git a/src/FDM/YASim/FGGround.hpp b/src/FDM/YASim/FGGround.hpp index 78325b955..df85489f7 100644 --- a/src/FDM/YASim/FGGround.hpp +++ b/src/FDM/YASim/FGGround.hpp @@ -18,26 +18,26 @@ public: FGGround(FGInterface *iface); virtual ~FGGround(); - virtual void getGroundPlane(const double pos[3], + void getGroundPlane(const double pos[3], double plane[4], float vel[3], - unsigned int &body); + unsigned int &body) override; - virtual void getGroundPlane(const double pos[3], + void getGroundPlane(const double pos[3], double plane[4], float vel[3], const simgear::BVHMaterial **material, - unsigned int &body); + unsigned int &body) override; - virtual bool getBody(double t, double bodyToWorld[16], double linearVel[3], - double angularVel[3], unsigned int &id); + bool getBody(double t, double bodyToWorld[16], double linearVel[3], + double angularVel[3], unsigned int &id) override; - virtual bool caughtWire(const double pos[4][3]); + bool caughtWire(const double pos[4][3]) override; - virtual bool getWire(double end[2][3], float vel[2][3]); + bool getWire(double end[2][3], float vel[2][3]) override; - virtual void releaseWire(void); + void releaseWire(void) override; - virtual float getCatapult(const double pos[3], - double end[2][3], float vel[2][3]); + float getCatapult(const double pos[3], + double end[2][3], float vel[2][3]) override; void setTimeOffset(double toff); diff --git a/src/FDM/YASim/Ground.cpp b/src/FDM/YASim/Ground.cpp index af01a065c..47274aaa7 100644 --- a/src/FDM/YASim/Ground.cpp +++ b/src/FDM/YASim/Ground.cpp @@ -8,14 +8,6 @@ #include "Ground.hpp" namespace yasim { -Ground::Ground() -{ -} - -Ground::~Ground() -{ -} - void Ground::getGroundPlane(const double pos[3], double plane[4], float vel[3], unsigned int &body) @@ -47,8 +39,7 @@ void Ground::getGroundPlane(const double pos[3], bool Ground::getBody(double t, double bodyToWorld[16], double linearVel[3], double angularVel[3], unsigned int &body) { - return getBody(t, bodyToWorld, linearVel, - angularVel, body); + return false; } bool Ground::caughtWire(const double pos[4][3]) diff --git a/src/FDM/YASim/Ground.hpp b/src/FDM/YASim/Ground.hpp index 433caca76..52d6284b0 100644 --- a/src/FDM/YASim/Ground.hpp +++ b/src/FDM/YASim/Ground.hpp @@ -8,8 +8,7 @@ namespace yasim { class Ground { public: - Ground(); - virtual ~Ground(); + virtual ~Ground() = default; virtual void getGroundPlane(const double pos[3], double plane[4], float vel[3], @@ -20,8 +19,8 @@ public: const simgear::BVHMaterial **material, unsigned int &body); - virtual bool getBody(double t, double bodyToWorld[16], double linearVel[3], - double angularVel[3], unsigned int &id); + virtual bool getBody(double t, double bodyToWorld[16], double linearVel[3], + double angularVel[3], unsigned int &id); virtual bool caughtWire(const double pos[4][3]);