aboutsummaryrefslogtreecommitdiff
path: root/go/game/map.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/game/map.go')
-rw-r--r--go/game/map.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/go/game/map.go b/go/game/map.go
index ea733833..6002eb96 100644
--- a/go/game/map.go
+++ b/go/game/map.go
@@ -11,7 +11,7 @@ import (
"strconv"
"strings"
- "gopkg.in/yaml.v3"
+ "github.com/goccy/go-yaml"
"muhq.space/muhqs-game/go/assets"
"muhq.space/muhqs-game/go/log"
@@ -74,9 +74,11 @@ func ParseMap(data []byte) (*Map, error) {
m.StartDeckList = mapYml.StartDeckList
}
- rows := strings.Split(mapYml.Map, "\n")
- for y := range len(rows) {
- row := rows[y]
+ // Trim trailing newlines
+ mapDef := strings.TrimRight(mapYml.Map, "\n")
+
+ rows := strings.Split(mapDef, "\n")
+ for y, row := range rows {
m.Tiles = append(m.Tiles, []Tile{})
for x := range len(rows[y]) {
pos := Position{x, y}