Removed redundant parameter.
This commit is contained in:
parent
e6b6bc58fc
commit
88270ad28c
6 changed files with 8 additions and 9 deletions
|
@ -110,10 +110,9 @@ Body::doesCollide(Body& other) {
|
||||||
* to manage collision events.
|
* to manage collision events.
|
||||||
*
|
*
|
||||||
* @param other Reference to the other Physical in the collision.
|
* @param other Reference to the other Physical in the collision.
|
||||||
* @param category The Category of the other object (as passed in constructor).
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Body::onCollide(Body& other, Category type) {
|
Body::onCollide(Body& other) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -68,7 +68,7 @@ public:
|
||||||
sf::Vector2i getSize() const;
|
sf::Vector2i getSize() const;
|
||||||
|
|
||||||
virtual bool doesCollide(Body& other);
|
virtual bool doesCollide(Body& other);
|
||||||
virtual void onCollide(Body& other, Category category);
|
virtual void onCollide(Body& other);
|
||||||
|
|
||||||
// Public variables.
|
// Public variables.
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -41,11 +41,11 @@ Bullet::Bullet(const sf::Vector2f& position, Body& shooter, float direction,
|
||||||
* @copydoc Physical::onCollide
|
* @copydoc Physical::onCollide
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Bullet::onCollide(Body& other, Category type) {
|
Bullet::onCollide(Body& other) {
|
||||||
// Make sure we do not damage twice.
|
// Make sure we do not damage twice.
|
||||||
if (!getDelete()) {
|
if (!getDelete()) {
|
||||||
// Call onShot on other, with damage as param.
|
// Call onShot on other, with damage as param.
|
||||||
if (type == CATEGORY_ACTOR) {
|
if (other.getCategory() == CATEGORY_ACTOR) {
|
||||||
Character& a = dynamic_cast<Character&>(other);
|
Character& a = dynamic_cast<Character&>(other);
|
||||||
a.onDamage(mDamage);
|
a.onDamage(mDamage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
Bullet(const sf::Vector2f& position, Body& shooter, float direction,
|
Bullet(const sf::Vector2f& position, Body& shooter, float direction,
|
||||||
const Yaml& config);
|
const Yaml& config);
|
||||||
|
|
||||||
void onCollide(Body& other, Category category);
|
void onCollide(Body& other);
|
||||||
bool doesCollide(Body& other);
|
bool doesCollide(Body& other);
|
||||||
|
|
||||||
// Private variables.
|
// Private variables.
|
||||||
|
|
|
@ -103,8 +103,8 @@ Player::onThink(float elapsedTime) {
|
||||||
* Stop movement if we collide with anything except bullets.
|
* Stop movement if we collide with anything except bullets.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Player::onCollide(Body& other, Category category) {
|
Player::onCollide(Body& other) {
|
||||||
if (category != CATEGORY_PARTICLE) {
|
if (other.getCategory() != CATEGORY_PARTICLE) {
|
||||||
setDestination(getPosition());
|
setDestination(getPosition());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ public:
|
||||||
|
|
||||||
// Private functions.
|
// Private functions.
|
||||||
private:
|
private:
|
||||||
void onCollide(Body& other, Category category);
|
void onCollide(Body& other);
|
||||||
void onThink(float elapsedTime);
|
void onThink(float elapsedTime);
|
||||||
|
|
||||||
// Private variables.
|
// Private variables.
|
||||||
|
|
Reference in a new issue