feat: use shared_ptr for object state
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include "../Entities/WorldObject.h"
|
||||
#include "../DTO/EntityState.h"
|
||||
|
||||
@@ -8,7 +9,7 @@ namespace L2Bot::Domain::Repositories
|
||||
class EntityRepositoryInterface
|
||||
{
|
||||
public:
|
||||
virtual const std::vector<DTO::EntityState*> GetEntities() = 0;
|
||||
virtual const std::vector<std::shared_ptr<DTO::EntityState>> GetEntities() = 0;
|
||||
virtual void Reset() = 0;
|
||||
};
|
||||
}
|
||||
|
@@ -42,7 +42,7 @@ namespace L2Bot::Domain::Serializers
|
||||
return result;
|
||||
}
|
||||
|
||||
SerializableStateContainer(const std::vector<DTO::EntityState*> objects, const std::string containerName) :
|
||||
SerializableStateContainer(const std::vector<std::shared_ptr<DTO::EntityState>> objects, const std::string containerName) :
|
||||
m_Objects(objects), m_ContainerName(containerName)
|
||||
{
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace L2Bot::Domain::Serializers
|
||||
SerializableStateContainer() = delete;
|
||||
virtual ~SerializableStateContainer() = default;
|
||||
private:
|
||||
const std::vector<DTO::EntityState*> m_Objects;
|
||||
const std::vector<std::shared_ptr<DTO::EntityState>> m_Objects;
|
||||
const std::string m_ContainerName;
|
||||
};
|
||||
}
|
@@ -19,7 +19,7 @@ namespace L2Bot::Domain::Services
|
||||
EntityService() = delete;
|
||||
virtual ~EntityService() = default;
|
||||
|
||||
virtual const std::vector<DTO::EntityState*> GetEntities()
|
||||
virtual const std::vector<std::shared_ptr<DTO::EntityState>> GetEntities()
|
||||
{
|
||||
return m_Repository.GetEntities();
|
||||
}
|
||||
|
Reference in New Issue
Block a user