diff --git a/source/abstract/Body.cpp b/source/abstract/Body.cpp index 0572876..31a6e58 100755 --- a/source/abstract/Body.cpp +++ b/source/abstract/Body.cpp @@ -110,10 +110,9 @@ Body::doesCollide(Body& other) { * to manage collision events. * * @param other Reference to the other Physical in the collision. - * @param category The Category of the other object (as passed in constructor). */ void -Body::onCollide(Body& other, Category type) { +Body::onCollide(Body& other) { } /** diff --git a/source/abstract/Body.h b/source/abstract/Body.h index d4f7e8c..2f1246c 100755 --- a/source/abstract/Body.h +++ b/source/abstract/Body.h @@ -68,7 +68,7 @@ public: sf::Vector2i getSize() const; virtual bool doesCollide(Body& other); - virtual void onCollide(Body& other, Category category); + virtual void onCollide(Body& other); // Public variables. public: diff --git a/source/effects/Bullet.cpp b/source/effects/Bullet.cpp index d863adc..fa393e7 100755 --- a/source/effects/Bullet.cpp +++ b/source/effects/Bullet.cpp @@ -41,11 +41,11 @@ Bullet::Bullet(const sf::Vector2f& position, Body& shooter, float direction, * @copydoc Physical::onCollide */ void -Bullet::onCollide(Body& other, Category type) { +Bullet::onCollide(Body& other) { // Make sure we do not damage twice. if (!getDelete()) { // Call onShot on other, with damage as param. - if (type == CATEGORY_ACTOR) { + if (other.getCategory() == CATEGORY_ACTOR) { Character& a = dynamic_cast(other); a.onDamage(mDamage); } diff --git a/source/effects/Bullet.h b/source/effects/Bullet.h index c59ae3b..bf1e34c 100755 --- a/source/effects/Bullet.h +++ b/source/effects/Bullet.h @@ -25,7 +25,7 @@ public: Bullet(const sf::Vector2f& position, Body& shooter, float direction, const Yaml& config); - void onCollide(Body& other, Category category); + void onCollide(Body& other); bool doesCollide(Body& other); // Private variables. diff --git a/source/sprites/Player.cpp b/source/sprites/Player.cpp index df0ceb4..ee806ac 100644 --- a/source/sprites/Player.cpp +++ b/source/sprites/Player.cpp @@ -103,8 +103,8 @@ Player::onThink(float elapsedTime) { * Stop movement if we collide with anything except bullets. */ void -Player::onCollide(Body& other, Category category) { - if (category != CATEGORY_PARTICLE) { +Player::onCollide(Body& other) { + if (other.getCategory() != CATEGORY_PARTICLE) { setDestination(getPosition()); } } diff --git a/source/sprites/Player.h b/source/sprites/Player.h index c340d85..0587584 100644 --- a/source/sprites/Player.h +++ b/source/sprites/Player.h @@ -50,7 +50,7 @@ public: // Private functions. private: - void onCollide(Body& other, Category category); + void onCollide(Body& other); void onThink(float elapsedTime); // Private variables.