From d7c980e0a46804bb3990cbe618b8df87d8266716 Mon Sep 17 00:00:00 2001 From: Matteo Signer Date: Mon, 4 Apr 2016 10:59:50 +0200 Subject: [PATCH] Misc. bugfixes --- src/itdelatrisu/opsu/Opsu.java | 1 + src/itdelatrisu/opsu/db/ScoreDB.java | 17 +++++++++++++++-- src/itdelatrisu/opsu/states/Game.java | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/itdelatrisu/opsu/Opsu.java b/src/itdelatrisu/opsu/Opsu.java index 82e9f553..4a7a3abd 100644 --- a/src/itdelatrisu/opsu/Opsu.java +++ b/src/itdelatrisu/opsu/Opsu.java @@ -230,6 +230,7 @@ public class Opsu extends StateBasedGame { } else { if (id == STATE_GAME) { MusicController.pause(); + MusicController.setPitch(1.0f); MusicController.resume(); } else songMenu.resetTrackOnLoad(); diff --git a/src/itdelatrisu/opsu/db/ScoreDB.java b/src/itdelatrisu/opsu/db/ScoreDB.java index 34891987..e6f27aef 100644 --- a/src/itdelatrisu/opsu/db/ScoreDB.java +++ b/src/itdelatrisu/opsu/db/ScoreDB.java @@ -304,6 +304,16 @@ public class ScoreDB { * @return all scores for the beatmap, or null if any error occurred */ public static ScoreData[] getMapScores(Beatmap beatmap) { + return getMapScores(beatmap, null); + } + + /** + * Retrieves the game scores for a beatmap while excluding a score. + * @param beatmap the beatmap + * @param exclude the filename of the score to exclude + * @return all scores for the beatmap except for exclude, or null if any error occurred + */ + public static ScoreData[] getMapScores(Beatmap beatmap, String exclude) { if (connection == null) return null; @@ -317,7 +327,11 @@ public class ScoreDB { ResultSet rs = selectMapStmt.executeQuery(); while (rs.next()) { ScoreData s = new ScoreData(rs); - list.add(s); + if (s.replayString != null && s.replayString.equals(exclude)) { + // dont return this score + } else { + list.add(s); + } } rs.close(); } catch (SQLException e) { @@ -326,7 +340,6 @@ public class ScoreDB { } return getSortedArray(list); } - /** * Retrieves the game scores for a beatmap set. * @param beatmap the beatmap diff --git a/src/itdelatrisu/opsu/states/Game.java b/src/itdelatrisu/opsu/states/Game.java index df6d9f10..2ad24db9 100644 --- a/src/itdelatrisu/opsu/states/Game.java +++ b/src/itdelatrisu/opsu/states/Game.java @@ -1210,7 +1210,7 @@ public class Game extends BasicGameState { if (beatmap == null || beatmap.objects == null) throw new RuntimeException("Running game with no beatmap loaded."); // fetch previous results - previousScores = ScoreDB.getMapScores(beatmap); + previousScores = ScoreDB.getMapScores(beatmap, replay == null ? null : replay.getReplayFilename()); lastRankUpdateTime = -1000; if (previousScores != null) currentRank = previousScores.length;