diff --git a/src/items/flyable.hpp b/src/items/flyable.hpp index 205d2b7b2..91cb88af1 100644 --- a/src/items/flyable.hpp +++ b/src/items/flyable.hpp @@ -224,6 +224,10 @@ public: // ------------------------------------------------------------------------ /** Returns the type of flyable. */ PowerupManager::PowerupType getType() const {return m_type;} + + // ------------------------------------------------------------------------ + /** Returns the owner's kart */ + AbstractKart *getOwner() const { return m_owner;} // ------------------------------------------------------------------------ /** Sets wether Flyable should update TerrainInfo as part of its update * call, or if the inheriting object will update TerrainInfo itself diff --git a/src/items/projectile_manager.cpp b/src/items/projectile_manager.cpp index 6b5ca3909..7089abc1f 100644 --- a/src/items/projectile_manager.cpp +++ b/src/items/projectile_manager.cpp @@ -201,7 +201,8 @@ bool ProjectileManager::projectileIsClose(const AbstractKart * const kart, * \param type The type of projectile checked */ int ProjectileManager::getNearbyProjectileCount(const AbstractKart * const kart, - float radius, PowerupManager::PowerupType type) + float radius, PowerupManager::PowerupType type, + bool exclude_owned) { float r2 = radius * radius; int projectile_count = 0; @@ -212,6 +213,9 @@ int ProjectileManager::getNearbyProjectileCount(const AbstractKart * const kart, continue; if (i->second->getType() == type) { + if (exclude_owned && (i->second->getOwner() == kart)) + continue; + float dist2 = i->second->getXYZ().distance2(kart->getXYZ()); if (dist2 < r2) { @@ -310,3 +314,4 @@ std::shared_ptr return nullptr; } } // addProjectileFromNetworkState + diff --git a/src/items/projectile_manager.hpp b/src/items/projectile_manager.hpp index b96bd0a87..a1ab24630 100644 --- a/src/items/projectile_manager.hpp +++ b/src/items/projectile_manager.hpp @@ -72,7 +72,8 @@ public: float radius); int getNearbyProjectileCount(const AbstractKart * const kart, - float radius, PowerupManager::PowerupType type); + float radius, PowerupManager::PowerupType type, + bool exclude_owned=false); // ------------------------------------------------------------------------ /** Adds a special hit effect to be shown. * \param hit_effect The hit effect to be added. */ @@ -100,3 +101,4 @@ extern ProjectileManager *projectile_manager; #endif /* EOF */ +