Fix max version column for wildcard compat #4142
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Before KSP-CKAN/NetKAN#10149,
StockWaterfallEffects
's latest version was compatible with all of 1.11–1.12, but the max compat game version column showed 1.12.2.Cause
AvailableModule.LatestCompatibleGameVersion
tries to avoid checking compatibility of every single version of every mod against every known game version by quitting early if any of them are marked as compatible with all game versions:CKAN/Core/Repositories/AvailableModule.cs
Lines 196 to 218 in a37eca5
As it loops through that list, it tries to remember the highest max bound and then uses it at the end to get the compatibility. Unfortunately, the
best < v
comparison of twoGameVersion
s can give wrong answers becauseGameVersion.Undefined
is-1
, which makes unbounded versions always compare as less than bounded ones, despite being able to match later versions. This makes 1.12.2 compare as greater than 1.12, so it's not a good idea to directly compare mixed bounded and unbounded game versions.Changes
Now that comparison logic is performed by
GameVersionBound.Highest
, which properly handles comparisons with unbounded values.Fixes #4141.