Slick Forums

Discuss the Slick 2D Library
It is currently Thu May 23, 2013 9:50 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue Mar 02, 2010 11:16 pm 
Offline
Regular

Joined: Tue Mar 03, 2009 11:53 pm
Posts: 123
Hi!

When a TileSet is created, loading a TiledMap, it should have a name, publicly accessible, but currently this string is empty.

Is this a confirmed mis-behaviour?

ciao!

_________________
Carotinho


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 02, 2010 11:27 pm 
Offline
Regular

Joined: Tue Mar 03, 2009 11:53 pm
Posts: 123
Ok it's a bug, here is the modified code. Sorry I'm not able to make a patch:) This is the constructor of TileSet

Code:
this.map = map;
// WRONG: here "element" is the node from TiledMap
//      name = element.getAttribute("name");
      firstGID = Integer.parseInt(element.getAttribute("firstgid"));
      String source = element.getAttribute("source");
      
      if ((source != null) && (!source.equals(""))) {
         try {
            InputStream in = ResourceLoader.getResourceAsStream(map.getTilesLocation() + "/" + source);
            DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
            Document doc = builder.parse(in);
            Element docElement = doc.getDocumentElement();
            element = docElement; //(Element) docElement.getElementsByTagName("tileset").item(0);

// RIGHT: Here we retrieve the correct name from the freshly loaded tileset xml
                                name = element.getAttribute("name");
         } catch (Exception e) {
            Log.error(e);
            throw new SlickException("Unable to load or parse sourced tileset: "+this.map.tilesLocation+"/"+source);
         }
      }


ciao!

_________________
Carotinho


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 04, 2010 7:45 pm 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
Added in SVN. Thanks for the fix.

Kev


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group