From fe293827e642bd0c55324b9db49554e2d4b4d6f6 Mon Sep 17 00:00:00 2001 From: Jeffrey Han Date: Sat, 19 Jul 2014 03:31:54 -0400 Subject: [PATCH] More small bug fixes. - Always use '.' as decimal separator in options file, regardless of locale. - Properly handle bad input when initially parsing hit objects. Signed-off-by: Jeffrey Han --- src/itdelatrisu/opsu/OsuParser.java | 4 ++-- src/itdelatrisu/opsu/states/Options.java | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/itdelatrisu/opsu/OsuParser.java b/src/itdelatrisu/opsu/OsuParser.java index 71797755..7eaf0268 100644 --- a/src/itdelatrisu/opsu/OsuParser.java +++ b/src/itdelatrisu/opsu/OsuParser.java @@ -371,7 +371,7 @@ public class OsuParser { osu.combo = colors.toArray(new Color[colors.size()]); break; case "[HitObjects]": - int type = -1; + int type = 0; while ((line = in.readLine()) != null) { line = line.trim(); if (!isValidLine(line)) @@ -396,7 +396,7 @@ public class OsuParser { if (index != -1) tokens[5] = tokens[5].substring(0, index); osu.endTime = Integer.parseInt(tokens[5]); - } else + } else if (type != 0) osu.endTime = Integer.parseInt(tokens[2]); break; default: diff --git a/src/itdelatrisu/opsu/states/Options.java b/src/itdelatrisu/opsu/states/Options.java index 4b802bce..d15b1ef0 100644 --- a/src/itdelatrisu/opsu/states/Options.java +++ b/src/itdelatrisu/opsu/states/Options.java @@ -33,6 +33,7 @@ import java.io.IOException; import java.io.OutputStreamWriter; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.Locale; import java.util.concurrent.TimeUnit; import org.lwjgl.input.Keyboard; @@ -1449,13 +1450,13 @@ public class Options extends BasicGameState { writer.newLine(); writer.write(String.format("PerfectHit = %b", showPerfectHit)); writer.newLine(); - writer.write(String.format("FixedCS = %.1f", fixedCS)); + writer.write(String.format(Locale.US, "FixedCS = %.1f", fixedCS)); writer.newLine(); - writer.write(String.format("FixedHP = %.1f", fixedHP)); + writer.write(String.format(Locale.US, "FixedHP = %.1f", fixedHP)); writer.newLine(); - writer.write(String.format("FixedAR = %.1f", fixedAR)); + writer.write(String.format(Locale.US, "FixedAR = %.1f", fixedAR)); writer.newLine(); - writer.write(String.format("FixedOD = %.1f", fixedOD)); + writer.write(String.format(Locale.US, "FixedOD = %.1f", fixedOD)); writer.newLine(); writer.write(String.format("Checkpoint = %d", checkpoint)); writer.newLine();