Color classes can have a default color.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3109 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2004-08-30 22:07:33 +00:00
parent 97086356fc
commit 9470ab69bd
@@ -1,5 +1,5 @@
// //
// $Id: ColorPository.java,v 1.6 2004/08/27 02:12:38 mdb Exp $ // $Id: ColorPository.java,v 1.7 2004/08/30 22:07:33 ray Exp $
// //
// Narya library - tools for developing networked games // Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
@@ -67,6 +67,10 @@ public class ColorPository implements Serializable
* {@link ColorRecord#starter}. */ * {@link ColorRecord#starter}. */
public boolean starter; public boolean starter;
/** The default colorId to use for recoloration in this class, or
* 0 if there is no default defined. */
public int defaultId;
/** A table of target colors included in this class. */ /** A table of target colors included in this class. */
public HashIntMap colors = new HashIntMap(); public HashIntMap colors = new HashIntMap();
@@ -112,6 +116,15 @@ public class ColorPository implements Serializable
return _starters[RandomUtil.getInt(_starters.length)]; return _starters[RandomUtil.getInt(_starters.length)];
} }
/**
* Get the default ColorRecord defined for this color class, or
* null if none.
*/
public ColorRecord getDefault ()
{
return (ColorRecord) colors.get(defaultId);
}
/** /**
* Returns a string representation of this instance. * Returns a string representation of this instance.
*/ */