Skip to content

Commit 5da132c

Browse files
authored
Merge pull request #35482 from smoogipoo/qp-fix-initial-placement-display
Ensure to never display "0th" placement
2 parents 9fac96c + c524bf5 commit 5da132c

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

osu.Game/Online/Multiplayer/MatchTypes/Matchmaking/MatchmakingUser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class MatchmakingUser
2323
/// The aggregate room placement (1-based).
2424
/// </summary>
2525
[Key(1)]
26-
public int Placement { get; set; }
26+
public int? Placement { get; set; }
2727

2828
/// <summary>
2929
/// The aggregate points.

osu.Game/Screens/OnlinePlay/Matchmaking/Match/PlayerPanel.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,11 @@ private void onRoomStateChanged(MatchRoomState? state) => Scheduler.Add(() =>
414414
if (!matchmakingState.Users.UserDictionary.TryGetValue(User.Id, out MatchmakingUser? userScore))
415415
return;
416416

417-
rankText.Text = userScore.Placement.Ordinalize(CultureInfo.CurrentCulture);
418-
rankText.FadeColour(SubScreenResults.ColourForPlacement(userScore.Placement));
417+
if (userScore.Placement == null)
418+
return;
419+
420+
rankText.Text = userScore.Placement.Value.Ordinalize(CultureInfo.CurrentCulture);
421+
rankText.FadeColour(SubScreenResults.ColourForPlacement(userScore.Placement.Value));
419422
scoreText.Text = $"{userScore.Points} pts";
420423
});
421424

osu.Game/Screens/OnlinePlay/Matchmaking/Match/PlayerPanelOverlay.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ public void AcquirePanels(PlayerPanel[] panels)
239239
if (client.Room?.MatchState is not MatchmakingRoomState matchmakingState)
240240
continue;
241241

242-
if (matchmakingState.Users.UserDictionary.TryGetValue(panels[i].User.Id, out MatchmakingUser? user))
243-
SetLayoutPosition(Children[i], user.Placement);
242+
if (matchmakingState.Users.UserDictionary.TryGetValue(panels[i].User.Id, out MatchmakingUser? user) && user.Placement != null)
243+
SetLayoutPosition(Children[i], user.Placement.Value);
244244
else
245245
SetLayoutPosition(Children[i], float.MaxValue);
246246
}

osu.Game/Screens/OnlinePlay/Matchmaking/Match/Results/SubScreenResults.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,16 @@ private void populateUserStatistics(MatchmakingRoomState state)
201201
return;
202202
}
203203

204-
int overallPlacement = state.Users[client.LocalUser!.UserID].Placement;
204+
int? overallPlacement = state.Users[client.LocalUser!.UserID].Placement;
205205

206-
placementText.Text = overallPlacement.Ordinalize(CultureInfo.CurrentCulture);
207-
placementText.Colour = ColourForPlacement(overallPlacement);
206+
if (overallPlacement != null)
207+
{
208+
placementText.Text = overallPlacement.Value.Ordinalize(CultureInfo.CurrentCulture);
209+
placementText.Colour = ColourForPlacement(overallPlacement.Value);
208210

209-
int overallPoints = state.Users[client.LocalUser!.UserID].Points;
210-
addStatistic(overallPlacement, $"Overall position ({overallPoints} points)");
211+
int overallPoints = state.Users[client.LocalUser!.UserID].Points;
212+
addStatistic(overallPlacement.Value, $"Overall position ({overallPoints} points)");
213+
}
211214

212215
var accuracyOrderedUsers = state.Users.Select(u => (user: u, avgAcc: u.Rounds.Select(r => r.Accuracy).DefaultIfEmpty(0).Average()))
213216
.OrderByDescending(t => t.avgAcc)

0 commit comments

Comments
 (0)