Make Creature use smart pointers.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
#include "../Models/Creature.hpp"
|
||||
|
||||
void CreatureLib::Battling::ExperienceLibrary::HandleExperienceGain(
|
||||
CreatureLib::Battling::Creature* faintedMon, const std::unordered_set<Creature*>& opponents) const {
|
||||
CreatureLib::Battling::Creature* faintedMon,
|
||||
const std::unordered_set<ArbUt::BorrowedPtr<Creature>>& opponents) const {
|
||||
for (auto opponent : opponents) {
|
||||
if (opponent == nullptr)
|
||||
continue;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#ifndef CREATURELIB_EXPERIENCELIBRARY_HPP
|
||||
#define CREATURELIB_EXPERIENCELIBRARY_HPP
|
||||
#include <Arbutils/Memory/BorrowedPtr.hpp>
|
||||
#include <unordered_set>
|
||||
|
||||
namespace CreatureLib::Battling {
|
||||
@@ -9,7 +10,8 @@ namespace CreatureLib::Battling {
|
||||
public:
|
||||
virtual ~ExperienceLibrary() = default;
|
||||
|
||||
virtual void HandleExperienceGain(Creature* faintedMon, const std::unordered_set<Creature*>& opponents) const;
|
||||
virtual void HandleExperienceGain(Creature* faintedMon,
|
||||
const std::unordered_set<ArbUt::BorrowedPtr<Creature>>& opponents) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user