Skip to content

Commit

Permalink
beatmap: handle degenerate arcs
Browse files Browse the repository at this point in the history
  • Loading branch information
fmang committed Aug 27, 2017
1 parent 6d79116 commit 5101aa1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/beatmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ static void build_linear_slider(char *line, struct oshu_hit *hit)
/**
* Build a perfect arc.
*
* If the points are aligned or something weird, transform it into a linear
* slider.
*
* Sample input:
* `396:140|448:80'
*/
Expand All @@ -304,7 +307,13 @@ static void build_perfect_slider(char *line, struct oshu_hit *hit)
a.y = hit->y;
build_point(pass, &b);
build_point(end, &c);
oshu_build_arc(a, b, c, &hit->slider.path.arc);

if (oshu_build_arc(a, b, c, &hit->slider.path.arc) < 0) {
/* tranform it into a linear path */
hit->slider.path.type = OSHU_PATH_LINEAR;
hit->slider.path.line.start = a;
hit->slider.path.line.end = c;
}
}

/**
Expand Down

0 comments on commit 5101aa1

Please sign in to comment.