diff --git a/MeleeWeapon.cpp b/MeleeWeapon.cpp index de3f8191cbc7133a1d422faad846d1d4961589e4..12e6585dfbdd5b4d265ac9c4a5ea76ced6c16392 100644 --- a/MeleeWeapon.cpp +++ b/MeleeWeapon.cpp @@ -10,7 +10,7 @@ namespace weapons { { return victim->damage(this->getDamage(), *victim); } - bool MeleeWeapon::damageIf(std::shared_ptr<LivingEntity>& user, bool(*predicate)(std::shared_ptr<Entity> self, std::shared_ptr<Entity> other)) + bool MeleeWeapon::damageIf(std::shared_ptr<LivingEntity>& user, std::function<bool(std::shared_ptr<Entity>, std::shared_ptr<Entity>)> predicate) { bool bl = false; for(auto& entity : GameClient::getInstance().getEntities()){ @@ -28,6 +28,7 @@ namespace weapons { { if (this->cooldown != 0) return false; this->cooldown = this->cooldownTime; + damageIf() } void MeleeWeapon::setPos(const olc::vf2d& newPos) { diff --git a/MeleeWeapon.h b/MeleeWeapon.h index e106c0909cc3f33df73130c4d4ae05dcdb3a628f..db481510f43bc8c2d932a686a7916482344e1740 100644 --- a/MeleeWeapon.h +++ b/MeleeWeapon.h @@ -9,7 +9,7 @@ namespace weapons { protected: virtual int getDamage() const; virtual bool damageEntity(std::shared_ptr<LivingEntity> user, std::shared_ptr<Entity>& victim); - virtual bool damageIf(std::shared_ptr<LivingEntity>& user, bool(*predicate)(std::shared_ptr<Entity> self, std::shared_ptr<Entity> other)); + virtual bool damageIf(std::shared_ptr<LivingEntity>& user, std::function<bool(std::shared_ptr<Entity> self, std::shared_ptr<Entity> other)> predicate); //virtual bool(*getPredicator())(std::shared_ptr<Entity>, std::shared_ptr<Entity>) = 0; virtual std::function<bool(std::shared_ptr<Entity>, std::shared_ptr<Entity>)> getPredicator() = 0;