v2.3.1: shifted music tracks are now considered equivalent

This commit is contained in:
Evan Debenham
2024-01-25 13:38:59 -05:00
parent 5f735ffe6e
commit d8aa84ae46
3 changed files with 19 additions and 11 deletions

View File

@@ -94,12 +94,19 @@ public enum Music {
if (isPlaying() && this.trackList != null && tracks.length == trackList.length){
boolean sameList = true;
for (int i = 0; i < tracks.length; i ++){
if (!tracks[i].equals(trackList[i]) || chances[i] != trackChances[i]){
sameList = false;
break;
//lists are considered the same if they are identical or merely shifted
// e.g. the regular title theme and the victory theme are considered equivalent
boolean sameList = false;
for (int ofs = 0; ofs < tracks.length; ofs++){
sameList = true;
for (int j = 0; j < tracks.length; j++){
int i = (j+ofs)%tracks.length;
if (!tracks[i].equals(trackList[j]) || chances[i] != trackChances[j]){
sameList = false;
break;
}
}
if (sameList) break;
}
if (sameList) {