Prevent downloading songs that are already loaded. (base: fluddokt/opsu/76778f8)

- All beatmap set IDs are now stored in a set in OsuGroupList.
- OsuParser now checks the directory name for beatmap set IDs if the OsuFile doesn't contain one (for older beatmap formats).

Tweaks:
- Clear completed downloads when hitting "Import All".
- Call Download.updateReadSoFar() upon starting downloads instead of waiting for user to hover over the button (causing an unnecessary delay).

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2015-02-09 23:22:58 -05:00
parent f56c02864b
commit be3b94f5db
7 changed files with 72 additions and 8 deletions

View File

@@ -438,6 +438,12 @@ public class DownloadsMenu extends BasicGameState {
if (index >= nodes.length)
break;
if (DownloadNode.resultContains(x, y, i)) {
DownloadNode node = nodes[index];
// check if map is already loaded
if (OsuGroupList.get().containsBeatmapSetID(node.getID()))
return;
SoundController.playSound(SoundEffect.MENUCLICK);
if (index == focusResult) {
if (focusTimer >= FOCUS_DELAY) {
@@ -445,7 +451,6 @@ public class DownloadsMenu extends BasicGameState {
focusTimer = 0;
} else {
// start download
DownloadNode node = nodes[index];
if (!DownloadList.get().contains(node.getID())) {
DownloadList.get().addNode(node);
node.createDownload(server);
@@ -515,6 +520,7 @@ public class DownloadsMenu extends BasicGameState {
}
}
DownloadList.get().clearDownloads(Download.Status.COMPLETE);
importThread = null;
}
};