From 0ce02cac8705da54f290e6fac361423b2e0fe642 Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Tue, 3 Dec 2024 23:13:17 -0800 Subject: [PATCH] bug fixes --- dDatabase/GameDatabase/MySQL/Tables/Leaderboard.cpp | 2 +- dGame/LeaderboardManager.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dDatabase/GameDatabase/MySQL/Tables/Leaderboard.cpp b/dDatabase/GameDatabase/MySQL/Tables/Leaderboard.cpp index 949de9c9..5c5c0521 100644 --- a/dDatabase/GameDatabase/MySQL/Tables/Leaderboard.cpp +++ b/dDatabase/GameDatabase/MySQL/Tables/Leaderboard.cpp @@ -41,7 +41,7 @@ std::vector MySQLDatabase::GetDefaultLeaderboard(const uint } std::vector MySQLDatabase::GetAgsLeaderboard(const uint32_t activityId) { - auto query = Game::config->GetValue("classic_survival_scoring") == "1" ? + auto query = Game::config->GetValue("classic_survival_scoring") != "1" ? "SELECT *, UNIX_TIMESTAMP(last_played) as lp_unix, ci.name as char_name FROM leaderboard lb JOIN charinfo ci on ci.id = lb.character_id where game_id = ? ORDER BY primaryscore DESC, secondaryscore DESC, tertiaryScore DESC, last_played ASC;" : "SELECT *, UNIX_TIMESTAMP(last_played) as lp_unix, ci.name as char_name FROM leaderboard lb JOIN charinfo ci on ci.id = lb.character_id where game_id = ? ORDER BY secondaryscore DESC, primaryscore DESC, tertiaryScore DESC, last_played ASC;"; auto leaderboard = ExecuteSelect(query, activityId); diff --git a/dGame/LeaderboardManager.cpp b/dGame/LeaderboardManager.cpp index 89634cee..e4b9db35 100644 --- a/dGame/LeaderboardManager.cpp +++ b/dGame/LeaderboardManager.cpp @@ -149,7 +149,7 @@ std::vector FilterTo10(const std::vector FilterTo10(const std::vector leaderboard.size() - 10) { toReturn.assign(leaderboard.end() - 10, leaderboard.end()); // get the bottom 10 since we are in the bottom 10 + index = leaderboard.size() - 10; } else { toReturn.assign(leaderboard.begin() + index - 5, leaderboard.begin() + index + 5); // get the 5 above and below + index -= 5; } int32_t i = index;