Skip to content

Commit

Permalink
avoid double initilization of Obstacle fields
Browse files Browse the repository at this point in the history
  • Loading branch information
atupone committed Dec 17, 2023
1 parent 1eb20f4 commit 65cb20a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 32 deletions.
13 changes: 3 additions & 10 deletions src/obstacle/ArcObstacle.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 5 additions & 11 deletions src/obstacle/ConeObstacle.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 6 additions & 11 deletions src/obstacle/SphereObstacle.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 65cb20a

Please sign in to comment.