Skip to content

Commit aed15fd

Browse files
committed
fix osu parsing to be HL compatible
1 parent b7e0ef6 commit aed15fd

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

source/funkin/data/song/importer/OsuManiaImporter.hx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class OsuManiaImporter
4545
{
4646
var parts:Array<String> = line.split(":");
4747
var key:String = StringTools.trim(parts.shift());
48-
var value:String = StringTools.trim(parts.join(":"));
48+
var value:Any = parseValue(StringTools.trim(parts.join(":")));
4949
if (Reflect.field(result, currentSection) == null) Reflect.setField(result, currentSection, {});
5050
Reflect.setField(Reflect.field(result, currentSection), key, value);
5151
}
@@ -189,4 +189,22 @@ class OsuManiaImporter
189189
return new ManiaHitObject(time, noteD, holdDuration);
190190
});
191191
}
192+
193+
static function parseValue(v:String):Any
194+
{
195+
var result:Null<Any>;
196+
197+
if (v.contains('.'))
198+
{
199+
result = Std.parseFloat(v);
200+
if (!Math.isNaN(result)) return result;
201+
}
202+
else
203+
{
204+
result = Std.parseInt(v);
205+
if (result != null) return result;
206+
}
207+
208+
return v;
209+
}
192210
}

0 commit comments

Comments
 (0)