Skip to content

Commit

Permalink
Fix for issue 799. Last uid is now also read. (prime31#800)
Browse files Browse the repository at this point in the history
  • Loading branch information
stallratte authored and NowSayPillow committed Aug 2, 2024
1 parent da86d4b commit 729b3dc
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions Nez.Portable/Assets/Tiled/Runtime/TiledMapLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -354,21 +354,28 @@ public static TmxLayer LoadTmxLayer(this TmxLayer layer, TmxMap map, XElement xL
else if (encoding == "csv")
{
var csvData = xData.Value;
int k = 0;

int startIndex = 0;
var k = 0;
var startIndex = 0;
uint gid;

for (var i = 0; i < csvData.Length; i++)
{
if (csvData[i] == ',')
{
var gid = ParseString(csvData, startIndex, i - startIndex);
gid = ParseString(csvData, startIndex, i - startIndex);

AddTile(layer, map, gid);
layer.Grid[k++] = gid;
layer.Grid[k++] = gid;

startIndex = i + 1;
}
}

// Add remaining uid
gid = ParseString(csvData, startIndex, csvData.Length - 1 - startIndex);

AddTile(layer, map, gid);
layer.Grid[k] = gid;
}
else if (encoding == null)
{
Expand Down

0 comments on commit 729b3dc

Please sign in to comment.