diff --git a/src/core/RoundManager.cpp b/src/core/RoundManager.cpp index 93d6714..86dce75 100644 --- a/src/core/RoundManager.cpp +++ b/src/core/RoundManager.cpp @@ -13,7 +13,7 @@ #include "DomeRenderer.h" #include "Logging.h" -RoundController::RoundController(RoundConfig config, +RoundController::RoundController(RoundConfig& config, BleepoutParameters& appParams, std::list > players, PlayerManager& playerManager) diff --git a/src/core/RoundManager.h b/src/core/RoundManager.h index 22b3bfd..f8b7ada 100644 --- a/src/core/RoundManager.h +++ b/src/core/RoundManager.h @@ -26,7 +26,7 @@ class RendererBase; class RoundController : public EventSource { public: - RoundController(RoundConfig config, + RoundController(RoundConfig& config, BleepoutParameters& appParams, std::list > players, PlayerManager& playerManager); @@ -79,7 +79,7 @@ class RoundController : public EventSource float _startTime; BleepoutParameters& _appParams; PlayerManager& _playerManager; - RoundConfig _config; + RoundConfig& _config; RoundState _state; ofPtr _renderer; ofPtr _spaceController; diff --git a/src/game_objects/Ball.cpp b/src/game_objects/Ball.cpp index bfd9aed..54c30c6 100644 --- a/src/game_objects/Ball.cpp +++ b/src/game_objects/Ball.cpp @@ -14,22 +14,20 @@ const char GameObjectTypeTraits::typeName[] = "ball"; -Ball::Ball(const RoundConfig* config /*= NULL*/, const BallSpec* spec /*= NULL*/) +Ball::Ball(const RoundConfig& config, const BallSpec& spec) : GameObject(GAME_OBJECT_BALL) , _player(NULL) , PhysicsObject(CollisionSphere) { thisGameObject = this; - _color = ofColor(220, 220, 220); - if (config && spec) { - this->setSize(ofVec3f(config->ballRadius())); - auto t = new OrbitalTrajectory(); - t->setRadius(config->domeRadius() + config->domeMargin()); - t->setSpeed(0.03); - t->initWithTwoPoints(spec->elevation, spec->heading, -14, - spec->heading + ofRandom(-45, 45)); - this->setTrajectory(t); - } + _color = ofColor(220, 220, 220); + this->setSize(ofVec3f(config.ballRadius())); + auto t = new OrbitalTrajectory(); + t->setRadius(config.domeRadius() + config.domeMargin()); + t->setSpeed(0.03); + t->initWithTwoPoints(spec.elevation, spec.heading, -14, + spec.heading + ofRandom(-45, 45)); + this->setTrajectory(t); } void Ball::bounce(ofVec3f normal, float trueHitFactor /* = 0.0 */) { diff --git a/src/game_objects/Ball.h b/src/game_objects/Ball.h index 037d9b6..2acb5e3 100644 --- a/src/game_objects/Ball.h +++ b/src/game_objects/Ball.h @@ -21,7 +21,7 @@ struct BallSpec; class Ball : public GameObject, public PhysicsObject { public: - Ball(const RoundConfig* config = NULL, const BallSpec* spec = NULL); + Ball(const RoundConfig& config, const BallSpec& spec); Player* player() { return _player; } const Player* player() const { return _player; } diff --git a/src/game_objects/GameState.cpp b/src/game_objects/GameState.cpp index 2aa41e7..f4454d8 100644 --- a/src/game_objects/GameState.cpp +++ b/src/game_objects/GameState.cpp @@ -53,7 +53,7 @@ Wall& RoundState::addWall(const WallSpec& wallSpec) { } Ball& RoundState::addBall(const BallSpec& ballSpec) { - ofPtr ball(new Ball(&_config, &ballSpec)); + ofPtr ball(new Ball(_config, ballSpec)); _balls.push_back(ball); return *ball; }