Make Creature use smart pointers.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-06-02 16:20:47 +02:00
parent 1ef50fd3a6
commit 62583ecb17
6 changed files with 19 additions and 14 deletions

View File

@@ -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;

View File

@@ -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;
};
}