mirror of
https://github.com/packwiz/packwiz.git
synced 2025-04-19 13:06:30 +02:00
CF: Treat versions with no loader as equal in loader comparison
This commit is contained in:
parent
7b380f23df
commit
cbd38b3b73
@ -305,9 +305,14 @@ func findLatestFile(modInfoData modInfo, mcVersions []string, packLoaders []stri
|
|||||||
// Compare first by Minecraft version (prefer higher indexes of mcVersions)
|
// Compare first by Minecraft version (prefer higher indexes of mcVersions)
|
||||||
compare := int32(mcVerIdx - bestMcVer)
|
compare := int32(mcVerIdx - bestMcVer)
|
||||||
if compare == 0 {
|
if compare == 0 {
|
||||||
|
// Treat unmarked versions as neutral (i.e. same as others)
|
||||||
|
if bestLoaderType == modloaderTypeAny || loaderIdx == modloaderTypeAny {
|
||||||
|
compare = 0
|
||||||
|
} else {
|
||||||
// Prefer higher loader indexes
|
// Prefer higher loader indexes
|
||||||
compare = int32(loaderIdx) - int32(bestLoaderType)
|
compare = int32(loaderIdx) - int32(bestLoaderType)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if compare == 0 {
|
if compare == 0 {
|
||||||
// Other comparisons are equal, compare by ID instead
|
// Other comparisons are equal, compare by ID instead
|
||||||
compare = int32(int64(v.ID) - int64(fileID))
|
compare = int32(int64(v.ID) - int64(fileID))
|
||||||
@ -332,9 +337,14 @@ func findLatestFile(modInfoData modInfo, mcVersions []string, packLoaders []stri
|
|||||||
// Compare first by Minecraft version (prefer higher indexes of mcVersions)
|
// Compare first by Minecraft version (prefer higher indexes of mcVersions)
|
||||||
compare := int32(mcVerIdx - bestMcVer)
|
compare := int32(mcVerIdx - bestMcVer)
|
||||||
if compare == 0 {
|
if compare == 0 {
|
||||||
|
// Treat unmarked versions as neutral (i.e. same as others)
|
||||||
|
if bestLoaderType == modloaderTypeAny || loaderIdx == modloaderTypeAny {
|
||||||
|
compare = 0
|
||||||
|
} else {
|
||||||
// Prefer higher loader indexes
|
// Prefer higher loader indexes
|
||||||
compare = int32(loaderIdx) - int32(bestLoaderType)
|
compare = int32(loaderIdx) - int32(bestLoaderType)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if compare == 0 {
|
if compare == 0 {
|
||||||
// Other comparisons are equal, compare by ID instead
|
// Other comparisons are equal, compare by ID instead
|
||||||
compare = int32(int64(v.ID) - int64(fileID))
|
compare = int32(int64(v.ID) - int64(fileID))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user