Rename Position -> Index

This commit is contained in:
Dan Balasescu
2022-06-09 18:49:11 +09:00
parent f0ef2e610e
commit 6d2a2ba7d6
10 changed files with 22 additions and 22 deletions

View File

@ -25,8 +25,8 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Preprocessing
/// </summary> /// </summary>
public readonly double StrainTime; public readonly double StrainTime;
public CatchDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, float halfCatcherWidth, List<DifficultyHitObject> objects, int position) public CatchDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, float halfCatcherWidth, List<DifficultyHitObject> objects, int index)
: base(hitObject, lastObject, clockRate, objects, position) : base(hitObject, lastObject, clockRate, objects, index)
{ {
// We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps. // We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps.
float scalingFactor = normalized_hitobject_radius / halfCatcherWidth; float scalingFactor = normalized_hitobject_radius / halfCatcherWidth;

View File

@ -12,8 +12,8 @@ namespace osu.Game.Rulesets.Mania.Difficulty.Preprocessing
{ {
public new ManiaHitObject BaseObject => (ManiaHitObject)base.BaseObject; public new ManiaHitObject BaseObject => (ManiaHitObject)base.BaseObject;
public ManiaDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List<DifficultyHitObject> objects, int position) public ManiaDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List<DifficultyHitObject> objects, int index)
: base(hitObject, lastObject, clockRate, objects, position) : base(hitObject, lastObject, clockRate, objects, index)
{ {
} }
} }

View File

@ -75,8 +75,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
private readonly OsuHitObject lastLastObject; private readonly OsuHitObject lastLastObject;
private readonly OsuHitObject lastObject; private readonly OsuHitObject lastObject;
public OsuDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List<DifficultyHitObject> objects, int position) public OsuDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List<DifficultyHitObject> objects, int index)
: base(hitObject, lastObject, clockRate, objects, position) : base(hitObject, lastObject, clockRate, objects, index)
{ {
lastLastObject = (OsuHitObject)Previous(1)?.BaseObject; lastLastObject = (OsuHitObject)Previous(1)?.BaseObject;
this.lastObject = (OsuHitObject)lastObject; this.lastObject = (OsuHitObject)lastObject;

View File

@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
private double strainValueOf(DifficultyHitObject current) private double strainValueOf(DifficultyHitObject current)
{ {
if (current.BaseObject is Spinner || current.Position <= 1 || current.Previous(0).BaseObject is Spinner) if (current.BaseObject is Spinner || current.Index <= 1 || current.Previous(0).BaseObject is Spinner)
return 0; return 0;
var osuCurrObj = (OsuDifficultyHitObject)current; var osuCurrObj = (OsuDifficultyHitObject)current;

View File

@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
OsuDifficultyHitObject lastObj = osuCurrent; OsuDifficultyHitObject lastObj = osuCurrent;
// This is iterating backwards in time from the current object. // This is iterating backwards in time from the current object.
for (int i = 0; i < Math.Min(current.Position, 10); i++) for (int i = 0; i < Math.Min(current.Index, 10); i++)
{ {
var currentObj = (OsuDifficultyHitObject)current.Previous(i); var currentObj = (OsuDifficultyHitObject)current.Previous(i);
var currentHitObject = (OsuHitObject)(currentObj.BaseObject); var currentHitObject = (OsuHitObject)(currentObj.BaseObject);

View File

@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
bool firstDeltaSwitch = false; bool firstDeltaSwitch = false;
int historicalNoteCount = Math.Min(current.Position, 32); int historicalNoteCount = Math.Min(current.Index, 32);
int rhythmStart = 0; int rhythmStart = 0;
@ -136,7 +136,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
// derive strainTime for calculation // derive strainTime for calculation
var osuCurrObj = (OsuDifficultyHitObject)current; var osuCurrObj = (OsuDifficultyHitObject)current;
var osuPrevObj = current.Position > 0 ? (OsuDifficultyHitObject)current.Previous(0) : null; var osuPrevObj = current.Index > 0 ? (OsuDifficultyHitObject)current.Previous(0) : null;
double strainTime = osuCurrObj.StrainTime; double strainTime = osuCurrObj.StrainTime;
double greatWindowFull = greatWindow * 2; double greatWindowFull = greatWindow * 2;

View File

@ -39,9 +39,9 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing
/// <param name="lastLastObject">The gameplay <see cref="HitObject"/> preceding <paramref name="lastObject"/>.</param> /// <param name="lastLastObject">The gameplay <see cref="HitObject"/> preceding <paramref name="lastObject"/>.</param>
/// <param name="clockRate">The rate of the gameplay clock. Modified by speed-changing mods.</param> /// <param name="clockRate">The rate of the gameplay clock. Modified by speed-changing mods.</param>
/// <param name="objects">The list of <see cref="DifficultyHitObject"/>s in the current beatmap.</param> /// <param name="objects">The list of <see cref="DifficultyHitObject"/>s in the current beatmap.</param>
/// /// <param name="position">The position of this <see cref="DifficultyHitObject"/> in the <paramref name="objects"/> list.</param> /// /// <param name="index">The position of this <see cref="DifficultyHitObject"/> in the <paramref name="objects"/> list.</param>
public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObject lastLastObject, double clockRate, List<DifficultyHitObject> objects, int position) public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, HitObject lastLastObject, double clockRate, List<DifficultyHitObject> objects, int index)
: base(hitObject, lastObject, clockRate, objects, position) : base(hitObject, lastObject, clockRate, objects, index)
{ {
var currentHit = hitObject as Hit; var currentHit = hitObject as Hit;

View File

@ -106,7 +106,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
if (!samePattern(start, mostRecentPatternsToCompare)) if (!samePattern(start, mostRecentPatternsToCompare))
continue; continue;
int notesSince = hitObject.Position - rhythmHistory[start].Position; int notesSince = hitObject.Index - rhythmHistory[start].Index;
penalty *= repetitionPenalty(notesSince); penalty *= repetitionPenalty(notesSince);
break; break;
} }

View File

@ -15,9 +15,9 @@ namespace osu.Game.Rulesets.Difficulty.Preprocessing
private readonly IReadOnlyList<DifficultyHitObject> difficultyHitObjects; private readonly IReadOnlyList<DifficultyHitObject> difficultyHitObjects;
/// <summary> /// <summary>
/// The position of this <see cref="DifficultyHitObject"/> in the <see cref="difficultyHitObjects"/> list. /// The index of this <see cref="DifficultyHitObject"/> in the list of all <see cref="DifficultyHitObject"/>s.
/// </summary> /// </summary>
public int Position; public int Index;
/// <summary> /// <summary>
/// The <see cref="HitObject"/> this <see cref="DifficultyHitObject"/> wraps. /// The <see cref="HitObject"/> this <see cref="DifficultyHitObject"/> wraps.
@ -51,11 +51,11 @@ namespace osu.Game.Rulesets.Difficulty.Preprocessing
/// <param name="lastObject">The last <see cref="HitObject"/> which occurs before <paramref name="hitObject"/> in the beatmap.</param> /// <param name="lastObject">The last <see cref="HitObject"/> which occurs before <paramref name="hitObject"/> in the beatmap.</param>
/// <param name="clockRate">The rate at which the gameplay clock is run at.</param> /// <param name="clockRate">The rate at which the gameplay clock is run at.</param>
/// <param name="objects">The list of <see cref="DifficultyHitObject"/>s in the current beatmap.</param> /// <param name="objects">The list of <see cref="DifficultyHitObject"/>s in the current beatmap.</param>
/// <param name="position">The position of this <see cref="DifficultyHitObject"/> in the <see cref="difficultyHitObjects"/> list.</param> /// <param name="index">The index of this <see cref="DifficultyHitObject"/> in <paramref name="objects"/> list.</param>
public DifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List<DifficultyHitObject> objects, int position) public DifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, List<DifficultyHitObject> objects, int index)
{ {
difficultyHitObjects = objects; difficultyHitObjects = objects;
Position = position; Index = index;
BaseObject = hitObject; BaseObject = hitObject;
LastObject = lastObject; LastObject = lastObject;
DeltaTime = (hitObject.StartTime - lastObject.StartTime) / clockRate; DeltaTime = (hitObject.StartTime - lastObject.StartTime) / clockRate;
@ -63,8 +63,8 @@ namespace osu.Game.Rulesets.Difficulty.Preprocessing
EndTime = hitObject.GetEndTime() / clockRate; EndTime = hitObject.GetEndTime() / clockRate;
} }
public DifficultyHitObject Previous(int backwardsIndex) => difficultyHitObjects.ElementAtOrDefault(Position - (backwardsIndex + 1)); public DifficultyHitObject Previous(int backwardsIndex) => difficultyHitObjects.ElementAtOrDefault(Index - (backwardsIndex + 1));
public DifficultyHitObject Next(int forwardsIndex) => difficultyHitObjects.ElementAtOrDefault(Position + (forwardsIndex + 1)); public DifficultyHitObject Next(int forwardsIndex) => difficultyHitObjects.ElementAtOrDefault(Index + (forwardsIndex + 1));
} }
} }

View File

@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Difficulty.Skills
public sealed override void Process(DifficultyHitObject current) public sealed override void Process(DifficultyHitObject current)
{ {
// The first object doesn't generate a strain, so we begin with an incremented section end // The first object doesn't generate a strain, so we begin with an incremented section end
if (current.Position == 0) if (current.Index == 0)
currentSectionEnd = Math.Ceiling(current.StartTime / SectionLength) * SectionLength; currentSectionEnd = Math.Ceiling(current.StartTime / SectionLength) * SectionLength;
while (current.StartTime > currentSectionEnd) while (current.StartTime > currentSectionEnd)