mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-24 15:24:30 +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:
@@ -1018,8 +1018,8 @@ void NetworkBase::SaveGroups()
|
||||
{
|
||||
if (GetMode() == NETWORK_MODE_SERVER)
|
||||
{
|
||||
auto env = GetContext().GetPlatformEnvironment();
|
||||
auto path = Path::Combine(env->GetDirectoryPath(DirBase::user), u8"groups.json");
|
||||
auto& env = GetContext().GetPlatformEnvironment();
|
||||
auto path = Path::Combine(env.GetDirectoryPath(DirBase::user), u8"groups.json");
|
||||
|
||||
json_t jsonGroups = json_t::array();
|
||||
for (auto& group : group_list)
|
||||
@@ -1078,8 +1078,8 @@ void NetworkBase::LoadGroups()
|
||||
{
|
||||
group_list.clear();
|
||||
|
||||
auto env = GetContext().GetPlatformEnvironment();
|
||||
auto path = Path::Combine(env->GetDirectoryPath(DirBase::user), u8"groups.json");
|
||||
auto& env = GetContext().GetPlatformEnvironment();
|
||||
auto path = Path::Combine(env.GetDirectoryPath(DirBase::user), u8"groups.json");
|
||||
|
||||
json_t jsonGroupConfig;
|
||||
if (File::Exists(path))
|
||||
@@ -1165,8 +1165,8 @@ void NetworkBase::AppendLog(std::ostream& fs, std::string_view s)
|
||||
|
||||
void NetworkBase::BeginChatLog()
|
||||
{
|
||||
auto env = GetContext().GetPlatformEnvironment();
|
||||
auto directory = env->GetDirectoryPath(DirBase::user, DirId::chatLogs);
|
||||
auto& env = GetContext().GetPlatformEnvironment();
|
||||
auto directory = env.GetDirectoryPath(DirBase::user, DirId::chatLogs);
|
||||
_chatLogPath = BeginLog(directory, "", _chatLogFilenameFormat);
|
||||
_chat_log_fs.open(fs::u8path(_chatLogPath), std::ios::out | std::ios::app);
|
||||
}
|
||||
@@ -1186,8 +1186,8 @@ void NetworkBase::CloseChatLog()
|
||||
|
||||
void NetworkBase::BeginServerLog()
|
||||
{
|
||||
auto env = GetContext().GetPlatformEnvironment();
|
||||
auto directory = env->GetDirectoryPath(DirBase::user, DirId::serverLogs);
|
||||
auto& env = GetContext().GetPlatformEnvironment();
|
||||
auto directory = env.GetDirectoryPath(DirBase::user, DirId::serverLogs);
|
||||
_serverLogPath = BeginLog(directory, ServerName, _serverLogFilenameFormat);
|
||||
_server_log_fs.open(fs::u8path(_serverLogPath), std::ios::out | std::ios::app | std::ios::binary);
|
||||
|
||||
@@ -2556,7 +2556,7 @@ void NetworkBase::Client_Handle_GAMESTATE(NetworkConnection& connection, Network
|
||||
{
|
||||
GameStateCompareData cmpData = snapshots->Compare(serverSnapshot, *desyncSnapshot);
|
||||
|
||||
std::string outputPath = GetContext().GetPlatformEnvironment()->GetDirectoryPath(DirBase::user, DirId::desyncLogs);
|
||||
std::string outputPath = GetContext().GetPlatformEnvironment().GetDirectoryPath(DirBase::user, DirId::desyncLogs);
|
||||
|
||||
Path::CreateDirectory(outputPath);
|
||||
|
||||
@@ -4010,8 +4010,8 @@ void NetworkAppendServerLog(const utf8* text)
|
||||
|
||||
static u8string NetworkGetKeysDirectory()
|
||||
{
|
||||
auto env = GetContext()->GetPlatformEnvironment();
|
||||
return Path::Combine(env->GetDirectoryPath(DirBase::user), u8"keys");
|
||||
auto& env = GetContext()->GetPlatformEnvironment();
|
||||
return Path::Combine(env.GetDirectoryPath(DirBase::user), u8"keys");
|
||||
}
|
||||
|
||||
static u8string NetworkGetPrivateKeyPath(u8string_view playerName)
|
||||
|
||||
Reference in New Issue
Block a user