From 5101aa13d6c675cd8ea4cc744286df9a4384dbf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Mangano-Tarumi?= Date: Sun, 27 Aug 2017 11:14:03 +0200 Subject: [PATCH] beatmap: handle degenerate arcs --- src/beatmap.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/beatmap.c b/src/beatmap.c index f524b1b..addc585 100644 --- a/src/beatmap.c +++ b/src/beatmap.c @@ -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' */ @@ -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; + } } /**