Skip to content

Commit

Permalink
Fix tournament bracket parsing's ruleset refetch logic not working co…
Browse files Browse the repository at this point in the history
…rrectly

Due to equality being based on `ShortName`, it was feasible that the
re-fetch exited early (in bindable shortcutting logic) causing the
ruleset's `OnlineID` to remain `-1` or something equally wrong.

Resolves issue pointed out at
#17538 (reply in thread).
  • Loading branch information
peppy committed Mar 31, 2022
1 parent a7a7584 commit a06b0a4
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions osu.Game.Tournament/TournamentGameBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ private void load(Storage baseStorage)
dependencies.CacheAs(new StableInfo(storage));
}

protected override void LoadComplete()
{
MenuCursorContainer.Cursor.AlwaysPresent = true; // required for tooltip display

// we don't want to show the menu cursor as it would appear on stream output.
MenuCursorContainer.Cursor.Alpha = 0;

base.LoadComplete();

Task.Run(readBracket);
}

private void readBracket()
{
try
Expand All @@ -79,10 +91,14 @@ private void readBracket()

ladder ??= new LadderInfo();

ladder.Ruleset.Value = ladder.Ruleset.Value != null
var resolvedRuleset = ladder.Ruleset.Value != null
? RulesetStore.GetRuleset(ladder.Ruleset.Value.ShortName)
: RulesetStore.AvailableRulesets.First();

// Must set to null initially to avoid the following re-fetch hitting `ShortName` based equality check.
ladder.Ruleset.Value = null;
ladder.Ruleset.Value = resolvedRuleset;

bool addedInfo = false;

// assign teams
Expand Down Expand Up @@ -280,18 +296,6 @@ void populate()
}
}

protected override void LoadComplete()
{
MenuCursorContainer.Cursor.AlwaysPresent = true; // required for tooltip display

// we don't want to show the menu cursor as it would appear on stream output.
MenuCursorContainer.Cursor.Alpha = 0;

base.LoadComplete();

Task.Run(readBracket);
}

protected virtual void SaveChanges()
{
if (!bracketLoadTaskCompletionSource.Task.IsCompletedSuccessfully)
Expand Down

0 comments on commit a06b0a4

Please sign in to comment.