Allow the BundledComponentRepository to be configured to wipe out its
bundle cache if it fails to locate the data for a character action. Also updated wipeBundle() signature. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3147 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: BundleUtil.java,v 1.9 2004/08/27 02:12:27 mdb Exp $
|
||||
// $Id: BundleUtil.java,v 1.10 2004/10/18 21:39:18 mdb Exp $
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
@@ -99,7 +99,7 @@ public class BundleUtil
|
||||
if (wipeBundleOnFailure) {
|
||||
StreamUtil.close(bin);
|
||||
bin = null;
|
||||
bundle.wipeBundle();
|
||||
bundle.wipeBundle(false);
|
||||
}
|
||||
throw ioe;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: BundledComponentRepository.java,v 1.34 2004/08/27 02:12:27 mdb Exp $
|
||||
// $Id: BundledComponentRepository.java,v 1.35 2004/10/18 21:39:18 mdb Exp $
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
@@ -156,6 +156,18 @@ public class BundledComponentRepository
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the bundled component repository to wipe any bundles
|
||||
* that report certain kinds of failure. In the event that an unpacked
|
||||
* bundle becomes corrupt, this is useful in that it will force the
|
||||
* bundle to be unpacked on the next application invocation,
|
||||
* potentially remedying the problem of a corrupt unpacking.
|
||||
*/
|
||||
public void setWipeOnFailure (boolean wipeOnFailure)
|
||||
{
|
||||
_wipeOnFailure = true;
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public CharacterComponent getComponent (int componentId)
|
||||
throws NoSuchComponentException
|
||||
@@ -332,6 +344,9 @@ public class BundledComponentRepository
|
||||
if (aset == null) {
|
||||
Log.warning("Unable to locate tileset for action '" +
|
||||
action + "' " + component + ".");
|
||||
if (_wipeOnFailure) {
|
||||
_bundle.wipeBundle(false);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -504,4 +519,7 @@ public class BundledComponentRepository
|
||||
|
||||
/** The component table. */
|
||||
protected HashIntMap _components = new HashIntMap();
|
||||
|
||||
/** Whether or not we wipe our bundles on any failure. */
|
||||
protected boolean _wipeOnFailure;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user