From 65cb20ac2f4fe2c2015e680b829a8887d52cd766 Mon Sep 17 00:00:00 2001 From: Alfredo Tupone Date: Sun, 17 Dec 2023 20:07:09 +0100 Subject: [PATCH] avoid double initilization of Obstacle fields --- src/obstacle/ArcObstacle.cxx | 13 +++---------- src/obstacle/ConeObstacle.cxx | 16 +++++----------- src/obstacle/SphereObstacle.cxx | 17 ++++++----------- 3 files changed, 14 insertions(+), 32 deletions(-) diff --git a/src/obstacle/ArcObstacle.cxx b/src/obstacle/ArcObstacle.cxx index cc2a569188..fa350ad452 100644 --- a/src/obstacle/ArcObstacle.cxx +++ b/src/obstacle/ArcObstacle.cxx @@ -40,17 +40,10 @@ ArcObstacle::ArcObstacle(const MeshTransform& xform, float _rotation, float _sweepAngle, float _ratio, const float _texsize[4], bool _useNormals, int _divisions, const BzMaterial* mats[MaterialCount], - int physics, bool bounce, bool drive, bool shoot, bool rico) + int physics, bool bounce, bool drive, bool shoot, + bool rico) : + Obstacle(_pos, _rotation, _size[0], _size[1], _size[2], drive, shoot, rico) { - // common obstace parameters - memcpy(pos, _pos, sizeof(pos)); - memcpy(size, _size, sizeof(size)); - angle = _rotation; - ZFlip = false; - driveThrough = drive; - shootThrough = shoot; - ricochet = rico; - // arc specific parameters transform = xform; divisions = _divisions; diff --git a/src/obstacle/ConeObstacle.cxx b/src/obstacle/ConeObstacle.cxx index 43c6fdd723..19aedf8ed4 100644 --- a/src/obstacle/ConeObstacle.cxx +++ b/src/obstacle/ConeObstacle.cxx @@ -38,18 +38,12 @@ ConeObstacle::ConeObstacle(const MeshTransform& xform, const float* _pos, const float* _size, float _rotation, float _sweepAngle, const float _texsize[2], bool _useNormals, - int _divisions, const BzMaterial* mats[MaterialCount], - int physics, bool bounce, bool drive, bool shoot, bool rico) + int _divisions, + const BzMaterial* mats[MaterialCount], + int physics, bool bounce, bool drive, bool shoot, + bool rico) : + Obstacle(_pos, _rotation, _size[0], _size[1], _size[2], drive, shoot, rico) { - // common obstace parameters - memcpy(pos, _pos, sizeof(pos)); - memcpy(size, _size, sizeof(size)); - angle = _rotation; - ZFlip = false; - driveThrough = drive; - shootThrough = shoot; - ricochet = rico; - // arc specific parameters transform = xform; divisions = _divisions; diff --git a/src/obstacle/SphereObstacle.cxx b/src/obstacle/SphereObstacle.cxx index 807d21030a..a98865fdc6 100644 --- a/src/obstacle/SphereObstacle.cxx +++ b/src/obstacle/SphereObstacle.cxx @@ -38,18 +38,13 @@ SphereObstacle::SphereObstacle(const MeshTransform& xform, const float* _pos, const float* _size, float _rotation, const float _texsize[2], bool _useNormals, bool _hemisphere, - int _divisions, const BzMaterial* mats[MaterialCount], - int physics, bool bounce, bool drive, bool shoot, bool rico) + int _divisions, + const BzMaterial* mats[MaterialCount], + int physics, bool bounce, bool drive, + bool shoot, bool rico) : + Obstacle(_pos, _rotation, _size[0], _size[1], _size[2], drive, shoot, + rico) { - // common obstace parameters - memcpy(pos, _pos, sizeof(pos)); - memcpy(size, _size, sizeof(size)); - angle = _rotation; - ZFlip = false; - driveThrough = drive; - ricochet = rico; - shootThrough = shoot; - // arc specific parameters transform = xform; divisions = _divisions;