feat: use shared_ptr for object state

This commit is contained in:
k0t9i
2023-01-23 23:40:51 +04:00
parent 3ccdf1d9e4
commit 032581512d
9 changed files with 19 additions and 22 deletions

View File

@@ -1,6 +1,7 @@
#pragma once
#include <map>
#include <memory>
#include "Domain/Repositories/EntityRepositoryInterface.h"
#include "Domain/DTO/EntityState.h"
#include "../Factories/DropFactory.h"
@@ -15,7 +16,7 @@ namespace Interlude
class DropRepository : public Repositories::EntityRepositoryInterface, public FindObjectsTrait
{
public:
const std::vector<DTO::EntityState*> GetEntities() override
const std::vector<std::shared_ptr<DTO::EntityState>> GetEntities() override
{
const std::map<uint32_t, Item*> items = FindAllObjects<Item*>(m_Radius, [this](float_t radius, int32_t prevId) {
return m_NetworkHandler.GetNextItem(radius, prevId);
@@ -24,7 +25,7 @@ namespace Interlude
return m_Factory.Create(item);
});
auto result = std::vector<DTO::EntityState*>();
auto result = std::vector<std::shared_ptr<DTO::EntityState>>();
for (const auto kvp : objects)
{