mirror of
				https://github.com/packwiz/packwiz.git
				synced 2025-10-31 02:34:31 +01:00 
			
		
		
		
	CF: Treat versions with no loader as equal in loader comparison
This commit is contained in:
		| @@ -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)) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user