1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +01:00

Remove Nullable and use std::optional instead

This commit is contained in:
ζeh Matt
2021-09-12 15:44:28 +03:00
parent 65a484105e
commit f999b0acb2
6 changed files with 9 additions and 67 deletions

View File

@@ -61,7 +61,6 @@ static constexpr uint32_t MaxPacketsPerUpdate = 100;
# include "../core/Console.hpp"
# include "../core/FileStream.h"
# include "../core/MemoryStream.h"
# include "../core/Nullable.hpp"
# include "../core/Path.hpp"
# include "../core/String.hpp"
# include "../interface/Chat.h"
@@ -912,9 +911,9 @@ uint8_t NetworkBase::GetGroupIDByHash(const std::string& keyhash)
const NetworkUser* networkUser = _userManager.GetUserByHash(keyhash);
uint8_t groupId = GetDefaultGroup();
if (networkUser != nullptr && networkUser->GroupId.HasValue())
if (networkUser != nullptr && networkUser->GroupId.has_value())
{
const uint8_t assignedGroup = networkUser->GroupId.GetValue();
const uint8_t assignedGroup = *networkUser->GroupId;
if (GetGroupByID(assignedGroup) != nullptr)
{
groupId = assignedGroup;
@@ -2058,7 +2057,7 @@ NetworkPlayer* NetworkBase::AddPlayer(const std::string& name, const std::string
}
else
{
player->Group = networkUser->GroupId.GetValueOrDefault(GetDefaultGroup());
player->Group = networkUser->GroupId.has_value() ? *networkUser->GroupId : GetDefaultGroup();
player->SetName(networkUser->Name);
}