mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 16:02:55 +08:00
Use ctor in a place that looks visually weird
I read through this thinking "why doesn't Previous get assigned to currentEncoding here? But it's because the initializer runs right after the ctor and before the "method" returns. So really there's 3 operations running on one line here - ctor, init, and assignment.
This commit is contained in:
parent
502e31dd37
commit
94c6beeaf7
@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="MonoEncoding"/>s that are grouped together within this <see cref="ColourEncoding"/>.
|
/// <see cref="MonoEncoding"/>s that are grouped together within this <see cref="ColourEncoding"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<MonoEncoding> Payload { get; private set; } = new List<MonoEncoding>();
|
public readonly List<MonoEncoding> Payload = new List<MonoEncoding>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The parent <see cref="CoupledColourEncoding"/> that contains this <see cref="ColourEncoding"/>
|
/// The parent <see cref="CoupledColourEncoding"/> that contains this <see cref="ColourEncoding"/>
|
||||||
|
@ -20,12 +20,12 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="ColourEncoding"/>s that are grouped together within this <see cref="CoupledColourEncoding"/>.
|
/// The <see cref="ColourEncoding"/>s that are grouped together within this <see cref="CoupledColourEncoding"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<ColourEncoding> Payload = new List<ColourEncoding>();
|
public readonly List<ColourEncoding> Payload = new List<ColourEncoding>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The previous <see cref="CoupledColourEncoding"/>. This is used to determine the repetition interval.
|
/// The previous <see cref="CoupledColourEncoding"/>. This is used to determine the repetition interval.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public CoupledColourEncoding? Previous = null;
|
public readonly CoupledColourEncoding? Previous;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How many <see cref="CoupledColourEncoding"/> between the current and previous identical <see cref="CoupledColourEncoding"/>.
|
/// How many <see cref="CoupledColourEncoding"/> between the current and previous identical <see cref="CoupledColourEncoding"/>.
|
||||||
@ -33,6 +33,11 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int RepetitionInterval { get; private set; } = max_repetition_interval + 1;
|
public int RepetitionInterval { get; private set; } = max_repetition_interval + 1;
|
||||||
|
|
||||||
|
public CoupledColourEncoding(CoupledColourEncoding? previous)
|
||||||
|
{
|
||||||
|
Previous = previous;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if other is considered a repetition of this encoding. This is true if other's first two payloads
|
/// Returns true if other is considered a repetition of this encoding. This is true if other's first two payloads
|
||||||
/// have identical mono lengths.
|
/// have identical mono lengths.
|
||||||
|
@ -118,10 +118,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour
|
|||||||
for (int i = 0; i < data.Count; i++)
|
for (int i = 0; i < data.Count; i++)
|
||||||
{
|
{
|
||||||
// Start a new CoupledColourEncoding. ColourEncodings that should be grouped together will be handled later within this loop.
|
// Start a new CoupledColourEncoding. ColourEncodings that should be grouped together will be handled later within this loop.
|
||||||
currentEncoding = new CoupledColourEncoding
|
currentEncoding = new CoupledColourEncoding(currentEncoding);
|
||||||
{
|
|
||||||
Previous = currentEncoding
|
|
||||||
};
|
|
||||||
|
|
||||||
// Determine if future ColourEncodings should be grouped.
|
// Determine if future ColourEncodings should be grouped.
|
||||||
bool isCoupled = i < data.Count - 2 && data[i].IsRepetitionOf(data[i + 2]);
|
bool isCoupled = i < data.Count - 2 && data[i].IsRepetitionOf(data[i + 2]);
|
||||||
|
Loading…
Reference in New Issue
Block a user