Fix legacy beatmap encoding

This commit is contained in:
smoogipoo 2021-04-05 19:59:54 +09:00
parent a3faf0a28e
commit d0510222ae
1 changed files with 7 additions and 1 deletions

View File

@ -329,7 +329,13 @@ private void addPathData(TextWriter writer, IHasPath pathData, Vector2 position)
if (point.Type.Value != null)
{
if (point.Type.Value != lastType)
// We've reached a new segment!
// To preserve compatibility with osu-stable as much as possible, segments with the same type are converted to use implicit segments by duplicating the control point.
// One exception to this is when the last control point of the last segment was itself a duplicate, which can't be supported by osu-stable.
bool lastPointWasDuplicate = i > 1 && pathData.Path.ControlPoints[i - 1].Position.Value == pathData.Path.ControlPoints[i - 2].Position.Value;
if (lastPointWasDuplicate || point.Type.Value != lastType)
{
switch (point.Type.Value)
{