-
-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace max KSP "9.9.9" with "any" #2432
Conversation
I still don't understand why we wouldn't want to display accurately the values from the metadata. |
Seems like a good approach to me, but should we really consider a.b.9 as the highest possible a.b version number? |
GUI/GUIMod.cs
Outdated
@@ -115,7 +115,27 @@ public GUIMod(CkanModule mod, IRegistryQuerier registry, KspVersionCriteria curr | |||
// KSP. | |||
if (latest_available_for_any_ksp != null) | |||
{ | |||
KSPCompatibility = KSPCompatibilityLong = registry.LatestCompatibleKSP(mod.identifier)?.ToString() ?? "any"; | |||
string str = registry.LatestCompatibleKSP(mod.identifier)?.ToString(); | |||
int major = registry.LatestCompatibleKSP(mod.identifier).Major; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't call LatestCompatibleKSP
more than once. It loops over all versions of the mod checking their compatibility, so the return value should go into a local variable.
GUI/GUIMod.cs
Outdated
|
||
if (str == null | ||
|| (major + 1) % 10 == 0 | ||
|| (major == 1 && (minor + 1) % 10 == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Treating 1.9 as "any" is going to get us in trouble if Squad ever releases a 1.10 or 2.0 version.
Now I start thinking about minor... it will reach 1.9.0 one day... so maybe 1.9.9 better leave unchanged @HebaruSan ok, will fix that |
GUI/GUIMod.cs
Outdated
&& minor != -1 | ||
&& (patch > 8 || patch == -1) | ||
) | ||
KSPCompatibility = major + "." + minor + ".9"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would cause problems if Squad released a 1.4.10 version.
Regardless of whether we can convince ourselves now that .5 or .9 are safe, it raises the question again of why do this in the first place? It's hard coding a series of dubious assumptions about not just how many patches there will be but how Squad chooses to represent those versions in their numbering scheme. If any of those assumptions is violated in the future, then this code will need to be patched again with the new assumptions. There's also value in being able to inspect the true values in the GUI, for example if you want to find these mods with weird versions for testing purposes. All things considered, I think we should leave this code as it is. |
removed patch changing, but still don't want to have 99.99.99's or 1.99.99's in the column |
ok... they really can switch to "chrome" numeration. |
We have a table of actual ksp versions; maybe we can use that to programmatically limit max ksp compatibility to actual versions. So, if a mod says max version is 1.3.99, but we know that the highest patch number in the 1.3 series is 2, then show max KSP as 1.3.2. |
@politas, where is this table? maybe find real_max_major, real_max_minor, and real_max patch (now they are 1, 90, 5 respectively), and use them to determine what should be converted to "any", and should be used x.y.9 or x.y.99 |
And you can access that file via: List<KspVersion> versions = new KspBuildMap(new Win32Registry()).KnownVersions; |
#2420
KSP-CKAN/NetKAN#5356
CKAN GUI replace: