Skip to content

Commit c86649a

Browse files
author
nexovec
committed
bugreport: added a sample for a bug report with a failing load (see lafriks#92 (comment))
1 parent be90f06 commit c86649a

File tree

4 files changed

+73
-0
lines changed

4 files changed

+73
-0
lines changed

bugs/failing_load/go.mod

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module tmx_bug_repro
2+
3+
go 1.23.4
4+
5+
require (
6+
github.com/lafriks/go-tiled v0.13.0 // indirect
7+
github.com/pkg/errors v0.9.1 // indirect
8+
)

bugs/failing_load/go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
github.com/lafriks/go-tiled v0.13.0 h1:xZE2rEKCNJPya+g92FCIjzEH4fZLQcZVqvpw174P2MY=
2+
github.com/lafriks/go-tiled v0.13.0/go.mod h1:FRhv/27R9S9IOmDl7+XrSUjFrV0uCUCu23rTCHRuj5c=
3+
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
4+
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=

bugs/failing_load/main.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package main
2+
3+
import (
4+
"log/slog"
5+
6+
"github.com/lafriks/go-tiled"
7+
"github.com/pkg/errors"
8+
)
9+
10+
func main() {
11+
tiledMap, err := tiled.LoadFile("platform.tmx")
12+
if err != nil {
13+
panic(errors.WithStack(err))
14+
}
15+
slog.Debug("tiled level", "tiles", tiledMap.Layers[0].Tiles)
16+
17+
}

bugs/failing_load/platform.tmx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<map version="1.8" tiledversion="1.8.0" orientation="orthogonal" renderorder="right-down" width="100" height="100" tilewidth="8" tileheight="8" infinite="1" nextlayerid="2" nextobjectid="1">
3+
<tileset firstgid="1" source="ship-01.tsx"/>
4+
<layer id="1" name="Tile Layer 1" width="100" height="100">
5+
<data encoding="csv">
6+
<chunk x="-16" y="0" width="16" height="16">
7+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
8+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
9+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
10+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
11+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
12+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
13+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
14+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
15+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
16+
0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,
17+
0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,
18+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
19+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
20+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
21+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
22+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
23+
</chunk>
24+
<chunk x="0" y="0" width="16" height="16">
25+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
26+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
27+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
28+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
29+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
30+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
31+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
32+
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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