1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-02-03 18:07:53 +01:00

Remove the use of shared_ptr for the Context (#24404)

* Replace shared_ptr with unique_ptr for Context systems, return refs

* Fix all the users

* clang-format fix

* Fix linux builds
This commit is contained in:
Matt
2025-05-15 22:46:06 +03:00
committed by GitHub
parent c2e042e5e1
commit 42df41efdb
68 changed files with 286 additions and 303 deletions

View File

@@ -108,7 +108,7 @@ std::string RegisteredShortcut::GetDisplayString() const
return result;
}
ShortcutManager::ShortcutManager(const std::shared_ptr<IPlatformEnvironment>& env)
ShortcutManager::ShortcutManager(IPlatformEnvironment& env)
: _env(env)
{
RegisterDefaultShortcuts();
@@ -196,7 +196,7 @@ void ShortcutManager::LoadUserBindings()
{
try
{
auto path = fs::u8path(_env->GetFilePath(PathId::configShortcuts));
auto path = fs::u8path(_env.GetFilePath(PathId::configShortcuts));
if (fs::exists(path))
{
LoadUserBindings(path);
@@ -206,7 +206,7 @@ void ShortcutManager::LoadUserBindings()
try
{
Console::WriteLine("Importing legacy shortcuts...");
auto legacyPath = fs::u8path(_env->GetFilePath(PathId::configShortcutsLegacy));
auto legacyPath = fs::u8path(_env.GetFilePath(PathId::configShortcutsLegacy));
if (fs::exists(legacyPath))
{
LoadLegacyBindings(legacyPath);
@@ -317,7 +317,7 @@ void ShortcutManager::SaveUserBindings()
{
try
{
auto path = fs::u8path(_env->GetFilePath(PathId::configShortcuts));
auto path = fs::u8path(_env.GetFilePath(PathId::configShortcuts));
SaveUserBindings(path);
}
catch (const std::exception& e)