Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Aragas committed Jul 3, 2023
1 parent 90548af commit 77a28fe
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Bannerlord.BUTR.Shared/Helpers/ModuleInfoHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,18 @@ public static bool ValidateLoadOrder(Type subModuleType, out string report)

public static bool ValidateLoadOrder(ModuleInfoExtended? moduleInfo, out string report)
{
static int IndexOf<T>(IReadOnlyList<T> self, T elementToFind)
{
var i = 0;
foreach (T element in self)
{
if (Equals(element, elementToFind))
return i;
i++;
}
return -1;
}

const string SErrorModuleNotFound = @"{=FE6ya1gzZR}{REQUIRED_MODULE} module was not found!";
const string SErrorIncompatibleModuleFound = @"{=EvI6KPAqTT}Incompatible module {DENIED_MODULE} was found!";
const string SErrorWrongModuleOrderTooEarly = @"{=5G9zffrgMh}{MODULE} is loaded before the {REQUIRED_MODULE}!{NL}Make sure {MODULE} is loaded after it!";
Expand All @@ -246,7 +258,7 @@ public static bool ValidateLoadOrder(ModuleInfoExtended? moduleInfo, out string
}

var loadedModules = ModuleInfoHelper.GetLoadedModules().ToList();
var moduleIndex = CollectionsExtensions.IndexOf(loadedModules, moduleInfo);
var moduleIndex = IndexOf(loadedModules, moduleInfo);

var sb = new StringBuilder();

Expand Down

0 comments on commit 77a28fe

Please sign in to comment.