Skip to content

Commit

Permalink
Allow totally incompatible modules in changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Sep 14, 2019
1 parent 910d89b commit f9e1fa8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
29 changes: 14 additions & 15 deletions GUI/GUIMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,29 +288,28 @@ public CkanModule ToModule()

public IEnumerable<KeyValuePair<CkanModule, GUIModChangeType>> GetRequestedChanges()
{
if (IsInstalled && !IsInstallChecked)
{
// Uninstall the version we have installed
yield return new KeyValuePair<CkanModule, GUIModChangeType>(InstalledMod.Module, GUIModChangeType.Remove);
}
else if (!IsInstalled && IsInstallChecked)
{
yield return new KeyValuePair<CkanModule, GUIModChangeType>(SelectedMod ?? Mod, GUIModChangeType.Install);
}
else if (IsInstalled && (IsInstallChecked && HasUpdate && IsUpgradeChecked))
bool selectedIsInstalled = SelectedMod?.Equals(InstalledMod?.Module)
?? InstalledMod?.Module.Equals(SelectedMod)
// Both null
?? true;
if (IsInstalled && (IsInstallChecked && HasUpdate && IsUpgradeChecked))
{
yield return new KeyValuePair<CkanModule, GUIModChangeType>(Mod, GUIModChangeType.Update);
}
else if (IsReplaceChecked)
{
yield return new KeyValuePair<CkanModule, GUIModChangeType>(Mod, GUIModChangeType.Replace);
}
else if (IsInstalled
&& SelectedMod != null
&& !InstalledMod.Module.Equals(SelectedMod))
else if (!selectedIsInstalled)
{
yield return new KeyValuePair<CkanModule, GUIModChangeType>(InstalledMod.Module, GUIModChangeType.Remove);
yield return new KeyValuePair<CkanModule, GUIModChangeType>(SelectedMod, GUIModChangeType.Install);
if (InstalledMod != null)
{
yield return new KeyValuePair<CkanModule, GUIModChangeType>(InstalledMod.Module, GUIModChangeType.Remove);
}
if (SelectedMod != null)
{
yield return new KeyValuePair<CkanModule, GUIModChangeType>(SelectedMod, GUIModChangeType.Install);
}
}
}

Expand Down
1 change: 0 additions & 1 deletion GUI/MainModList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,6 @@ public HashSet<ModChange> ComputeUserChangeSet(IRegistryQuerier registry)
?? new InstalledModule[] {};
return new HashSet<ModChange>(
Modules
.Where(mod => mod.IsInstallable())
.SelectMany(mod => mod.GetRequestedChanges())
.Select(change => new ModChange(change.Key, change.Value, null))
.Union(removableAuto.Select(im => new ModChange(
Expand Down

0 comments on commit f9e1fa8

Please sign in to comment.