From 86af520c9256e7e5af13e7cbbd499d5ffabde7e0 Mon Sep 17 00:00:00 2001 From: FajsiEx Date: Tue, 14 Dec 2021 20:23:45 +0100 Subject: [PATCH] / ir scores on leaderboard being out of order in some cases --- scripts/songselect/songwheel.lua | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/songselect/songwheel.lua b/scripts/songselect/songwheel.lua index 483b67a..cfd620d 100644 --- a/scripts/songselect/songwheel.lua +++ b/scripts/songselect/songwheel.lua @@ -570,26 +570,30 @@ function drawIrLeaderboard() gfx.Text("IR TOP", scoreBoardX + (sbBarWidth / 2), scoreBoardY + sbBarHeight/2); for i = 1, 4, 1 do - local irScore = irLeaderboard[i]; - gfx.BeginPath(); gfx.ImageRect(scoreBoardX, scoreBoardY + i*sbBarHeight, sbBarWidth, sbBarHeight, scoreBoardBarBgImage, 1, 0); + end + -- Becuase the scores are in "random order", we have to do this + for i = 1, 4, 1 do + local irScore = irLeaderboard[i]; + if irScore then + local rank = irScore.ranking gfx.TextAlign(gfx.TEXT_ALIGN_CENTER + gfx.TEXT_ALIGN_MIDDLE) gfx.BeginPath(); - gfx.Text(LEADERBOARD_PLACE_NAMES[i], sbBarContentLeftX-40, scoreBoardY + sbBarHeight/2 + i*sbBarHeight); + gfx.Text(LEADERBOARD_PLACE_NAMES[rank], sbBarContentLeftX-40, scoreBoardY + sbBarHeight/2 + rank*sbBarHeight); gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE) gfx.BeginPath(); - gfx.Text(string.upper(irScore.username), sbBarContentLeftX, scoreBoardY + sbBarHeight/2 + i*sbBarHeight); + gfx.Text(string.upper(irScore.username), sbBarContentLeftX, scoreBoardY + sbBarHeight/2 + rank*sbBarHeight); gfx.BeginPath(); - gfx.Text(string.format("%d", irScore.score), sbBarContentRightX, scoreBoardY + sbBarHeight/2 + i*sbBarHeight); + gfx.Text(string.format("%d", irScore.score), sbBarContentRightX, scoreBoardY + sbBarHeight/2 + rank*sbBarHeight); local badgeImage = badgeImages[irScore.lamp+1]; gfx.BeginPath() - gfx.ImageRect(scoreBoardX + sbBarWidth - 50, scoreBoardY + sbBarHeight/2 + i*sbBarHeight - 12.5, 31.6, 27.6, badgeImage, 1, 0) + gfx.ImageRect(scoreBoardX + sbBarWidth - 50, scoreBoardY + sbBarHeight/2 + rank*sbBarHeight - 12.5, 31.6, 27.6, badgeImage, 1, 0) end end end