From 9470ab69bd02f2870f92b5434bb72b5acf9cc774 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Mon, 30 Aug 2004 22:07:33 +0000 Subject: [PATCH] Color classes can have a default color. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3109 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../com/threerings/media/image/ColorPository.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/java/com/threerings/media/image/ColorPository.java b/src/java/com/threerings/media/image/ColorPository.java index 68d980457..021d0e9b0 100644 --- a/src/java/com/threerings/media/image/ColorPository.java +++ b/src/java/com/threerings/media/image/ColorPository.java @@ -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 // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved @@ -67,6 +67,10 @@ public class ColorPository implements Serializable * {@link ColorRecord#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. */ public HashIntMap colors = new HashIntMap(); @@ -112,6 +116,15 @@ public class ColorPository implements Serializable 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. */