TileImage: refactor: s/readTileImage/readTileImageM

this method is called in the context of the parent tag;
it reads all <image> tags that are children of the current tag
and only returns one of them
This commit is contained in:
Jason Long 2014-08-14 11:52:58 -04:00
parent 030abc4512
commit 55f054a63e
2 changed files with 8 additions and 4 deletions

View file

@ -109,7 +109,7 @@ public abstract class TileImage
BufferedImage getImage(String name); BufferedImage getImage(String name);
} }
public static SimpleTileImage readSimpleImage(XMLStreamReader in, LoaderContext ctx) static SimpleTileImage readSimpleImage(XMLStreamReader in, LoaderContext ctx)
throws XMLStreamException throws XMLStreamException
{ {
SimpleTileImage img = new SimpleTileImage(); SimpleTileImage img = new SimpleTileImage();
@ -142,7 +142,7 @@ public abstract class TileImage
} }
} }
public static AnimatedTile readAnimation(XMLStreamReader in, LoaderContext ctx) static AnimatedTile readAnimation(XMLStreamReader in, LoaderContext ctx)
throws XMLStreamException throws XMLStreamException
{ {
assert in.getLocalName().equals("animation"); assert in.getLocalName().equals("animation");
@ -162,7 +162,11 @@ public abstract class TileImage
return anim; return anim;
} }
public static TileImage readTileImage(XMLStreamReader in, LoaderContext ctx) /**
* @param in an XML stream reader with the parent tag of the tag to be read
* still selected
*/
public static TileImage readTileImageM(XMLStreamReader in, LoaderContext ctx)
throws XMLStreamException throws XMLStreamException
{ {
TileImage img = null; TileImage img = null;

View file

@ -100,7 +100,7 @@ public class TileImages
} }
String tileName = in.getAttributeValue(null, "name"); String tileName = in.getAttributeValue(null, "name");
TileImage img = readTileImage(in, ctx); TileImage img = readTileImageM(in, ctx);
assert tileName != null; assert tileName != null;
assert img != null; assert img != null;