From cf86c057383bd038cbdfd292e0ca98c7e6211d5c Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 29 Aug 2024 13:30:08 +0200 Subject: Core/Misc: Remove duplicate helper functions (cherry picked from commit bffc7ece61abf9fdc8c5dd599a8d22a549dc6b00) --- src/server/bnetserver/Server/Session.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src/server/bnetserver/Server/Session.cpp') diff --git a/src/server/bnetserver/Server/Session.cpp b/src/server/bnetserver/Server/Session.cpp index c3aaa972160..d95e99e34a6 100644 --- a/src/server/bnetserver/Server/Session.cpp +++ b/src/server/bnetserver/Server/Session.cpp @@ -557,15 +557,9 @@ uint32 Battlenet::Session::HandleProcessClientRequest(game_utilities::v1::Client return (this->*itr->second)(params, response); } -static Variant const* GetParam(std::unordered_map const& params, char const* paramName) -{ - auto itr = params.find(paramName); - return itr != params.end() ? itr->second : nullptr; -} - uint32 Battlenet::Session::GetRealmListTicket(std::unordered_map const& params, game_utilities::v1::ClientResponse* response) { - if (Variant const* identity = GetParam(params, "Param_Identity")) + if (Variant const* identity = Trinity::Containers::MapGetValuePtr(params, "Param_Identity")) { ::JSON::RealmList::RealmListTicketIdentity data; std::size_t jsonStart = identity->blob_value().find(':'); @@ -586,7 +580,7 @@ uint32 Battlenet::Session::GetRealmListTicket(std::unordered_mapblob_value().find(':'); @@ -620,7 +614,7 @@ uint32 Battlenet::Session::GetRealmListTicket(std::unordered_map const& params, game_utilities::v1::ClientResponse* response) { - if (Variant const* subRegion = GetParam(params, "Command_LastCharPlayedRequest_v1")) + if (Variant const* subRegion = Trinity::Containers::MapGetValuePtr(params, "Command_LastCharPlayedRequest_v1")) { auto lastPlayerChar = _gameAccountInfo->LastPlayedCharacters.find(subRegion->string_value()); if (lastPlayerChar != _gameAccountInfo->LastPlayedCharacters.end()) @@ -659,7 +653,7 @@ uint32 Battlenet::Session::GetRealmList(std::unordered_mapstring_value(); std::vector compressed = sRealmList->GetRealmList(_build, _gameAccountInfo->SecurityLevel, subRegionId); @@ -696,7 +690,7 @@ uint32 Battlenet::Session::GetRealmList(std::unordered_map const& params, game_utilities::v1::ClientResponse* response) { - if (Variant const* realmAddress = GetParam(params, "Param_RealmAddress")) + if (Variant const* realmAddress = Trinity::Containers::MapGetValuePtr(params, "Param_RealmAddress")) return sRealmList->JoinRealm(realmAddress->uint_value(), _build, GetRemoteIpAddress(), _clientSecret, GetLocaleByName(_locale), _os, _timezoneOffset, _gameAccountInfo->Name, _gameAccountInfo->SecurityLevel, response); -- cgit v1.2.3