Misc. bugfixes

This commit is contained in:
Matteo Signer 2016-04-04 10:59:50 +02:00
parent 4b76d2c3cf
commit d7c980e0a4
3 changed files with 17 additions and 3 deletions

View File

@ -230,6 +230,7 @@ public class Opsu extends StateBasedGame {
} else { } else {
if (id == STATE_GAME) { if (id == STATE_GAME) {
MusicController.pause(); MusicController.pause();
MusicController.setPitch(1.0f);
MusicController.resume(); MusicController.resume();
} else } else
songMenu.resetTrackOnLoad(); songMenu.resetTrackOnLoad();

View File

@ -304,6 +304,16 @@ public class ScoreDB {
* @return all scores for the beatmap, or null if any error occurred * @return all scores for the beatmap, or null if any error occurred
*/ */
public static ScoreData[] getMapScores(Beatmap beatmap) { 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) if (connection == null)
return null; return null;
@ -317,8 +327,12 @@ public class ScoreDB {
ResultSet rs = selectMapStmt.executeQuery(); ResultSet rs = selectMapStmt.executeQuery();
while (rs.next()) { while (rs.next()) {
ScoreData s = new ScoreData(rs); ScoreData s = new ScoreData(rs);
if (s.replayString != null && s.replayString.equals(exclude)) {
// dont return this score
} else {
list.add(s); list.add(s);
} }
}
rs.close(); rs.close();
} catch (SQLException e) { } catch (SQLException e) {
ErrorHandler.error("Failed to read scores from database.", e, true); ErrorHandler.error("Failed to read scores from database.", e, true);
@ -326,7 +340,6 @@ public class ScoreDB {
} }
return getSortedArray(list); return getSortedArray(list);
} }
/** /**
* Retrieves the game scores for a beatmap set. * Retrieves the game scores for a beatmap set.
* @param beatmap the beatmap * @param beatmap the beatmap

View File

@ -1210,7 +1210,7 @@ public class Game extends BasicGameState {
if (beatmap == null || beatmap.objects == null) if (beatmap == null || beatmap.objects == null)
throw new RuntimeException("Running game with no beatmap loaded."); throw new RuntimeException("Running game with no beatmap loaded.");
// fetch previous results // fetch previous results
previousScores = ScoreDB.getMapScores(beatmap); previousScores = ScoreDB.getMapScores(beatmap, replay == null ? null : replay.getReplayFilename());
lastRankUpdateTime = -1000; lastRankUpdateTime = -1000;
if (previousScores != null) if (previousScores != null)
currentRank = previousScores.length; currentRank = previousScores.length;