MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / GetGroupIDByHash

Method GetGroupIDByHash

src/openrct2/network/NetworkBase.cpp:1024–1044  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1022 }
1023
1024 uint8_t NetworkBase::GetGroupIDByHash(const std::string& keyhash)
1025 {
1026 const User* networkUser = _userManager.getUserByHash(keyhash);
1027
1028 uint8_t groupId = GetDefaultGroup();
1029 if (networkUser != nullptr && networkUser->groupId.has_value())
1030 {
1031 const uint8_t assignedGroup = *networkUser->groupId;
1032 if (GetGroupByID(assignedGroup) != nullptr)
1033 {
1034 groupId = assignedGroup;
1035 }
1036 else
1037 {
1038 LOG_WARNING(
1039 "User %s is assigned to non-existent group %u. Assigning to default group (%u)", keyhash.c_str(),
1040 assignedGroup, groupId);
1041 }
1042 }
1043 return groupId;
1044 }
1045
1046 uint8_t NetworkBase::GetDefaultGroup() const noexcept
1047 {

Callers

nothing calls this directly

Calls 2

GetDefaultGroupFunction · 0.85
getUserByHashMethod · 0.80

Tested by

no test coverage detected