From 168b16d006aab12cfd6dfab4fdfd3cba2188efb4 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Sat, 6 Apr 2002 01:56:46 +0000 Subject: [PATCH] Screw the miso tileset repository; we'll just have the miso tile manager load the fringe configuration from a standard place in the classpath. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1194 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../threerings/miso/tile/MisoTileManager.java | 43 ++++++++++++------- .../miso/tile/MisoTileSetRepository.java | 18 -------- 2 files changed, 28 insertions(+), 33 deletions(-) delete mode 100644 src/java/com/threerings/miso/tile/MisoTileSetRepository.java diff --git a/src/java/com/threerings/miso/tile/MisoTileManager.java b/src/java/com/threerings/miso/tile/MisoTileManager.java index a77ad1ec5..c7fb009a4 100644 --- a/src/java/com/threerings/miso/tile/MisoTileManager.java +++ b/src/java/com/threerings/miso/tile/MisoTileManager.java @@ -1,11 +1,19 @@ // -// $Id: MisoTileManager.java,v 1.1 2002/04/06 01:46:56 mdb Exp $ +// $Id: MisoTileManager.java,v 1.2 2002/04/06 01:56:39 mdb Exp $ package com.threerings.miso.tile; +import java.io.IOException; +import java.io.InputStream; + +import com.threerings.resource.ResourceManager; +import com.threerings.util.CompiledConfig; + import com.threerings.media.ImageManager; import com.threerings.media.tile.TileManager; +import com.threerings.miso.Log; + /** * Extends the basic tile manager and provides support for automatically * generating fringes in between different types of base tiles in a scene. @@ -19,24 +27,24 @@ public class MisoTileManager extends TileManager * @param imgr the image manager via which the tile manager will * decode and cache images. */ - public MisoTileManager (ImageManager imgr) + public MisoTileManager (ResourceManager rmgr, ImageManager imgr) { super(imgr); - } - /** - * Sets the tileset repository that will be used by the tile manager - * when tiles are requested by tileset id. The miso tile manager - * requires a miso tileset repository which provides it with - * information about fringe configuration in addition to the tilesets. - */ - public void setMisoTileSetRepository (MisoTileSetRepository setrep) - { - setTileSetRepository(setrep); + // look for a fringe configuration in the appropriate place + try { + InputStream in = rmgr.getResource(FRINGE_CONFIG_PATH); + FringeConfiguration config = (FringeConfiguration) + CompiledConfig.loadConfig(in); - // now that we have a miso tileset repository, we can create our - // auto fringer - _fringer = new AutoFringer(setrep.getFringeConfiguration(), this); + // if we've found it, create our auto fringer with it + _fringer = new AutoFringer(config, this); + + } catch (IOException ioe) { + Log.warning("Unable to load fringe configuration " + + "[path=" + FRINGE_CONFIG_PATH + + ", error=" + ioe + "]."); + } } /** @@ -52,4 +60,9 @@ public class MisoTileManager extends TileManager /** The entity that performs the automatic fringe layer generation. */ protected AutoFringer _fringer; + + /** The path (in the classpath) to the serialized fringe + * configuration. */ + protected static final String FRINGE_CONFIG_PATH = + "config/miso/tile/fringeconf.dat"; } diff --git a/src/java/com/threerings/miso/tile/MisoTileSetRepository.java b/src/java/com/threerings/miso/tile/MisoTileSetRepository.java deleted file mode 100644 index be0a7a62c..000000000 --- a/src/java/com/threerings/miso/tile/MisoTileSetRepository.java +++ /dev/null @@ -1,18 +0,0 @@ -// -// $Id: MisoTileSetRepository.java,v 1.1 2002/04/06 01:46:56 mdb Exp $ - -package com.threerings.miso.tile; - -import com.threerings.media.tile.TileSetRepository; - -/** - * Extends the regular tile set repository and provides access to - * configuration information for the {@link AutoFringer}. - */ -public interface MisoTileSetRepository extends TileSetRepository -{ - /** - * Returns the configuration information for the {@link AutoFringer}. - */ - public FringeConfiguration getFringeConfiguration (); -}