@@ -30,10 +30,8 @@ import (
3030 "strings"
3131)
3232
33- var (
34- // ErrInvalidObjectPoint error is returned if there is error parsing object points
35- ErrInvalidObjectPoint = errors .New ("tiled: invalid object point" )
36- )
33+ // ErrInvalidObjectPoint error is returned if there is error parsing object points
34+ var ErrInvalidObjectPoint = errors .New ("tiled: invalid object point" )
3735
3836// ObjectGroup is in fact a map layer, and is hence called "object layer" in Tiled Qt
3937type ObjectGroup struct {
@@ -64,18 +62,23 @@ type ObjectGroup struct {
6462}
6563
6664// DecodeObjectGroup decodes object group data
67- func (g * ObjectGroup ) DecodeObjectGroup (m * Map ) {
65+ func (g * ObjectGroup ) DecodeObjectGroup (m * Map ) error {
6866 for _ , object := range g .Objects {
6967 if object .GID > 0 {
7068 // Initialize all tilesets that are referenced by tile objects. Otherwise,
7169 // if a tileset is used by an object tile but not used by any layer it
7270 // won't be loaded.
73- m .TileGIDToTile (object .GID )
71+ if _ , err := m .TileGIDToTile (object .GID ); err != nil {
72+ return err
73+ }
7474 }
7575 if len (object .TemplateSource ) > 0 {
76- object .initTemplate (m )
76+ if err := object .initTemplate (m ); err != nil {
77+ return err
78+ }
7779 }
7880 }
81+ return nil
7982}
8083
8184// UnmarshalXML decodes a single XML element beginning with the given start element.
@@ -181,8 +184,7 @@ func (o *Object) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
181184}
182185
183186// Ellipse is used to mark an object as an ellipse.
184- type Ellipse struct {
185- }
187+ type Ellipse struct {}
186188
187189// Polygon object is made up of a space-delimited list of x,y coordinates. The origin for these coordinates is the location of the parent object.
188190// By default, the first point is created as 0,0 denoting that the point will originate exactly where the object is placed.
0 commit comments