Implemented enumerateTileSetIds(); also added sanity check when scanning
the resource bundles at construct time. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@656 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: BundledTileSetRepository.java,v 1.2 2001/11/21 02:42:15 mdb Exp $
|
// $Id: BundledTileSetRepository.java,v 1.3 2001/11/29 00:12:42 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.media.tile.bundle;
|
package com.threerings.media.tile.bundle;
|
||||||
|
|
||||||
@@ -50,6 +50,15 @@ public class BundledTileSetRepository
|
|||||||
// tileset bundles
|
// tileset bundles
|
||||||
ResourceBundle[] rbundles = rmgr.getResourceSet(name);
|
ResourceBundle[] rbundles = rmgr.getResourceSet(name);
|
||||||
|
|
||||||
|
// sanity check
|
||||||
|
if (rbundles == null) {
|
||||||
|
Log.warning("Unable to fetch tileset resource set " +
|
||||||
|
"[name=" + name + "]. Perhaps it's not defined " +
|
||||||
|
"in the resource manager config?");
|
||||||
|
_bundles = new TileSetBundle[0];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// iterate over the resource bundles in the set, loading up the
|
// iterate over the resource bundles in the set, loading up the
|
||||||
// tileset bundles in each resource bundle
|
// tileset bundles in each resource bundle
|
||||||
ArrayList tbundles = new ArrayList();;
|
ArrayList tbundles = new ArrayList();;
|
||||||
@@ -68,6 +77,7 @@ public class BundledTileSetRepository
|
|||||||
Log.warning("Unable to load tileset bundles from resource " +
|
Log.warning("Unable to load tileset bundles from resource " +
|
||||||
"bundle [rbundle=" + rbundles[i] +
|
"bundle [rbundle=" + rbundles[i] +
|
||||||
", error=" + e + "].");
|
", error=" + e + "].");
|
||||||
|
Log.logStackTrace(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,6 +86,22 @@ public class BundledTileSetRepository
|
|||||||
tbundles.toArray(_bundles);
|
tbundles.toArray(_bundles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// documentation inherited
|
||||||
|
public Iterator enumerateTileSetIds ()
|
||||||
|
throws PersistenceException
|
||||||
|
{
|
||||||
|
return new CompoundIterator(new IteratorProvider() {
|
||||||
|
public Iterator nextIterator () {
|
||||||
|
if (_bidx < _bundles.length) {
|
||||||
|
return _bundles[_bidx++].enumerateTileSetIds();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected int _bidx = 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
public Iterator enumerateTileSets ()
|
public Iterator enumerateTileSets ()
|
||||||
throws PersistenceException
|
throws PersistenceException
|
||||||
|
|||||||
Reference in New Issue
Block a user