Skip to content

Commit

Permalink
Merge pull request #23 from NedoProgrammer/main
Browse files Browse the repository at this point in the history
Use InvariantCulture for float parsing
  • Loading branch information
TheBoneJarmer authored Oct 9, 2021
2 parents 325fc7d + 8a5da3b commit bea9404
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/TiledMap.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Xml;
Expand Down Expand Up @@ -438,8 +439,8 @@ private TiledObject[] ParseObjects(XmlNodeList nodeList)
obj.name = node.Attributes["name"]?.Value;
obj.type = node.Attributes["type"]?.Value;
obj.gid = int.Parse(node.Attributes["gid"]?.Value ?? "0");
obj.x = float.Parse(node.Attributes["x"].Value);
obj.y = float.Parse(node.Attributes["y"].Value);
obj.x = float.Parse(node.Attributes["x"].Value, CultureInfo.InvariantCulture);
obj.y = float.Parse(node.Attributes["y"].Value, CultureInfo.InvariantCulture);

if (nodesProperty != null)
{
Expand All @@ -448,12 +449,12 @@ private TiledObject[] ParseObjects(XmlNodeList nodeList)

if (node.Attributes["width"] != null)
{
obj.width = float.Parse(node.Attributes["width"].Value);
obj.width = float.Parse(node.Attributes["width"].Value, CultureInfo.InvariantCulture);
}

if (node.Attributes["height"] != null)
{
obj.height = float.Parse(node.Attributes["height"].Value);
obj.height = float.Parse(node.Attributes["height"].Value, CultureInfo.InvariantCulture);
}

if (node.Attributes["rotation"] != null)
Expand Down

0 comments on commit bea9404

Please sign in to comment.