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 <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han 2014-07-19 03:31:54 -04:00
parent 834682a6ca
commit fe293827e6
2 changed files with 7 additions and 6 deletions

View File

@ -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:

View File

@ -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();