Skip to content

Commit

Permalink
Fixed float localization outputting portal coordinates with comma dec…
Browse files Browse the repository at this point in the history
…imal separator

Fixed level map path failing if not ending in slash
  • Loading branch information
Dnawrkshp committed Feb 19, 2021
1 parent 0b47e76 commit 325fece
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions mod-manager/mod-manager/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,17 @@ static class Program
public static string TyDirectory = String.Empty;
public static string LocalePath = "Localization";

public static IFormatProvider TyFormat = new NumberFormatInfo()
{
NumberDecimalSeparator = "."
};

public static ulong ErrorCount = 0;

public static double RVersion = 0d;
public static double VVersion = 0d;

public const double AppVersion = 0.03;
public const double AppVersion = 0.04;

public static string PortalEntry = "pos = %x, %y, %z\r\n" +
"ID = %i,%l\r\n" +
Expand Down Expand Up @@ -420,15 +425,18 @@ private static void ApplyMods_Level(List<TyLevel> levels, ref Dictionary<string,
// Add portal for level
z1LV2 = z1LV2.Insert(z1LV2.IndexOf("\r\n", portal.Index) + 2, "\r\n" + Program.PortalEntry
.Replace("%l", levelID)
.Replace("%i", (x+levelStart).ToString())
.Replace("%x", level.X.ToString("F"))
.Replace("%y", level.Y.ToString("F"))
.Replace("%z", level.Z.ToString("F"))
.Replace("%i", (x+levelStart).ToString(TyFormat))
.Replace("%x", level.X.ToString("F", TyFormat))
.Replace("%y", level.Y.ToString("F", TyFormat))
.Replace("%z", level.Z.ToString("F", TyFormat))
.Replace("%a", level.Authors)
);

// Ensure input path ends in a backslash
string inputPath = level.InputPath.TrimEnd(Path.DirectorySeparatorChar).TrimEnd(Path.AltDirectorySeparatorChar) + Path.DirectorySeparatorChar;

// Add to list of custom levels (to be used by the OpenAL32 proxy)
customLevels.Add((x + levelStart).ToString() + " " + levelID + " " + Path.Combine("Mods", level.InputPath));
customLevels.Add((x + levelStart).ToString() + " " + levelID + " " + Path.Combine("Mods", inputPath));
}
}

Expand Down

0 comments on commit 325fece

Please sign in to comment.