Skip to content

Commit

Permalink
Create data layout version error message
Browse files Browse the repository at this point in the history
Avoid invalid comparisons on mismatched data layout versions
  • Loading branch information
searica committed Nov 23, 2024
1 parent 27a1470 commit a0d46a1
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions JotunnLib/Utils/ModCompatibility/ModCompatibility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,15 @@ private static void OpenTroubleshootingPage()
/// <returns></returns>
private static string CreateErrorMessage(ModuleVersionData serverData, ModuleVersionData clientData)
{

return CreateModModuleLayoutErrorMessage(serverData, clientData)+
CreateVanillaVersionErrorMessage(serverData, clientData) +
string dataLayoutErrMsg = CreateModModuleLayoutErrorMessage(serverData, clientData);
if (!string.IsNullOrEmpty(dataLayoutErrMsg))
{
return CreateVanillaVersionErrorMessage(serverData, clientData) +
dataLayoutErrMsg +
CreateFurtherStepsMessage();
}

return CreateVanillaVersionErrorMessage(serverData, clientData) +
CreateNotInstalledErrorMessage(serverData, clientData) +
CreateLowerVersionErrorMessage(serverData, clientData) +
CreateHigherVersionErrorMessage(serverData, clientData) +
Expand All @@ -362,6 +368,7 @@ private static string CreateErrorMessage(ModuleVersionData serverData, ModuleVer

private static string CreateModModuleLayoutErrorMessage(ModuleVersionData serverData, ModuleVersionData clientData)
{

if (!clientData.IsSupportedDataLayout)
{
return ColoredLine(Color.red, $"Jotunn version on client is higher than server version: {Main.Version}");
Expand All @@ -372,6 +379,11 @@ private static string CreateModModuleLayoutErrorMessage(ModuleVersionData server
return ColoredLine(Color.red, $"Jotunn version on server is higher than client version: {Main.Version}");
}

if (serverData.ModModuleDataLayout != clientData.ModModuleDataLayout)
{
return ColoredLine(Color.red, "Jotunn versions on server and client are not compatible.");
}

return string.Empty;
}

Expand Down

0 comments on commit a0d46a1

Please sign in to comment.