mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-07-04 02:01:51 +00:00
refactor: make memory from zone a reference instead of ptr
This commit is contained in:
@ -1,13 +1,13 @@
|
||||
#include "Zone.h"
|
||||
|
||||
Zone::Zone(std::string name, const zone_priority_t priority, IGame* game)
|
||||
: m_memory(std::make_unique<ZoneMemory>()),
|
||||
m_registered(false),
|
||||
m_name(std::move(name)),
|
||||
: m_name(std::move(name)),
|
||||
m_priority(priority),
|
||||
m_language(GameLanguage::LANGUAGE_NONE),
|
||||
m_game(game),
|
||||
m_pools(ZoneAssetPools::CreateForGame(game->GetId(), this, priority))
|
||||
m_pools(ZoneAssetPools::CreateForGame(game->GetId(), this, priority)),
|
||||
m_memory(std::make_unique<ZoneMemory>()),
|
||||
m_registered(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ void Zone::Register()
|
||||
}
|
||||
}
|
||||
|
||||
ZoneMemory* Zone::GetMemory() const
|
||||
ZoneMemory& Zone::Memory() const
|
||||
{
|
||||
return m_memory.get();
|
||||
return *m_memory;
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "Game/GameLanguage.h"
|
||||
#include "Game/IGame.h"
|
||||
#include "Pool/ZoneAssetPools.h"
|
||||
#include "Utils/ClassUtils.h"
|
||||
#include "Zone/ZoneTypes.h"
|
||||
#include "ZoneMemory.h"
|
||||
#include "ZoneScriptStrings.h"
|
||||
@ -16,10 +15,6 @@ class ZoneAssetPools;
|
||||
|
||||
class Zone
|
||||
{
|
||||
std::unique_ptr<ZoneMemory> m_memory;
|
||||
|
||||
bool m_registered;
|
||||
|
||||
public:
|
||||
std::string m_name;
|
||||
zone_priority_t m_priority;
|
||||
@ -37,5 +32,10 @@ public:
|
||||
|
||||
void Register();
|
||||
|
||||
_NODISCARD ZoneMemory* GetMemory() const;
|
||||
[[nodiscard]] ZoneMemory& Memory() const;
|
||||
|
||||
private:
|
||||
std::unique_ptr<ZoneMemory> m_memory;
|
||||
|
||||
bool m_registered;
|
||||
};
|
||||
|
Reference in New Issue
Block a user