From fa0041db0c32c4dd8f7432051bc620f60e93472f Mon Sep 17 00:00:00 2001 From: a Date: Fri, 6 Dec 2024 23:12:35 +0200 Subject: [PATCH] minor fix for `Steam_User_Stats::FindLeaderboard()` --- dll/steam_user_stats_leaderboard.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/dll/steam_user_stats_leaderboard.cpp b/dll/steam_user_stats_leaderboard.cpp index 3665e82e..e1a8d3e3 100644 --- a/dll/steam_user_stats_leaderboard.cpp +++ b/dll/steam_user_stats_leaderboard.cpp @@ -318,12 +318,11 @@ SteamAPICall_t Steam_User_Stats::FindLeaderboard( const char *pchLeaderboardName return ret; } - std::string name_lower(common_helpers::ascii_to_lowercase(pchLeaderboardName)); + std::string board_name(pchLeaderboardName); const auto &settings_Leaderboards = settings->getLeaderboards(); - auto it = settings_Leaderboards.begin(); - for (; settings_Leaderboards.end() != it; ++it) { - if (common_helpers::str_cmp_insensitive(it->first, name_lower)) break; - } + auto it = std::find_if(settings_Leaderboards.begin(), settings_Leaderboards.end(), [&board_name](const std::pair &item){ + return common_helpers::str_cmp_insensitive(item.first, board_name); + }); if (settings_Leaderboards.end() != it) { auto &config = it->second; return FindOrCreateLeaderboard(pchLeaderboardName, config.sort_method, config.display_type); @@ -331,7 +330,7 @@ SteamAPICall_t Steam_User_Stats::FindLeaderboard( const char *pchLeaderboardName return FindOrCreateLeaderboard(pchLeaderboardName, k_ELeaderboardSortMethodDescending, k_ELeaderboardDisplayTypeNumeric); } else { LeaderboardFindResult_t data{}; - data.m_hSteamLeaderboard = find_cached_leaderboard(name_lower); + data.m_hSteamLeaderboard = find_cached_leaderboard(board_name); data.m_bLeaderboardFound = !!data.m_hSteamLeaderboard; auto ret = callback_results->addCallResult(data.k_iCallback, &data, sizeof(data)); callbacks->addCBResult(data.k_iCallback, &data, sizeof(data));