From 5198206dfd52b26ebe107c909f1040fc28b73a25 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Tue, 4 Feb 2003 03:33:09 +0000 Subject: [PATCH] Modified render priority handling so that a default priority can be returned without modifying ObjectInfo.priority which would cause the default priority to be written out as an overridden priority. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2235 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../threerings/miso/client/DirtyItemList.java | 4 +-- .../miso/client/DisplayObjectInfo.java | 26 ++++++++++++++----- .../com/threerings/miso/data/ObjectInfo.java | 13 ++++++++-- 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/src/java/com/threerings/miso/client/DirtyItemList.java b/src/java/com/threerings/miso/client/DirtyItemList.java index 2e1d5f029..ad079bcc3 100644 --- a/src/java/com/threerings/miso/client/DirtyItemList.java +++ b/src/java/com/threerings/miso/client/DirtyItemList.java @@ -1,5 +1,5 @@ // -// $Id: DirtyItemList.java,v 1.18 2003/01/31 23:10:45 mdb Exp $ +// $Id: DirtyItemList.java,v 1.19 2003/02/04 03:33:09 mdb Exp $ package com.threerings.miso.client; @@ -539,7 +539,7 @@ public class DirtyItemList DisplayObjectInfo soa = (DisplayObjectInfo)da.obj; DisplayObjectInfo sob = (DisplayObjectInfo)db.obj; if (IsoUtil.objectFootprintsOverlap(soa, sob)) { - return (soa.priority - sob.priority); + return (soa.getPriority() - sob.getPriority()); } } diff --git a/src/java/com/threerings/miso/client/DisplayObjectInfo.java b/src/java/com/threerings/miso/client/DisplayObjectInfo.java index cc40f8e6e..fec8860aa 100644 --- a/src/java/com/threerings/miso/client/DisplayObjectInfo.java +++ b/src/java/com/threerings/miso/client/DisplayObjectInfo.java @@ -1,5 +1,5 @@ // -// $Id: DisplayObjectInfo.java,v 1.6 2003/01/31 23:10:45 mdb Exp $ +// $Id: DisplayObjectInfo.java,v 1.7 2003/02/04 03:33:09 mdb Exp $ package com.threerings.miso.client; @@ -44,13 +44,25 @@ public class DisplayObjectInfo extends ObjectInfo public void setObjectTile (ObjectTile tile) { this.tile = tile; + } - // if we don't already have an overridden render priority; use the - // one from our object tile (assuming we have one) - if (priority == 0 && tile != null) { - priority = (byte)Math.max( - Byte.MIN_VALUE, Math.min(Byte.MAX_VALUE, tile.getPriority())); - } + /** + * Returns the render priority of this object tile. + */ + public int getPriority () + { + // if we have no specified priority return our object tile's + // default priority + return (priority == 0 && tile != null) ? tile.getPriority() : priority; + } + + /** + * Overrides the render priority of this object. + */ + public void setPriority (byte priority) + { + this.priority = (byte)Math.max( + Byte.MIN_VALUE, Math.min(Byte.MAX_VALUE, priority)); } /** diff --git a/src/java/com/threerings/miso/data/ObjectInfo.java b/src/java/com/threerings/miso/data/ObjectInfo.java index de6c9a7d1..9bcb83b10 100644 --- a/src/java/com/threerings/miso/data/ObjectInfo.java +++ b/src/java/com/threerings/miso/data/ObjectInfo.java @@ -1,5 +1,5 @@ // -// $Id: ObjectInfo.java,v 1.1 2003/01/31 23:10:45 mdb Exp $ +// $Id: ObjectInfo.java,v 1.2 2003/02/04 03:33:09 mdb Exp $ package com.threerings.miso.data; @@ -17,7 +17,8 @@ public class ObjectInfo extends SimpleStreamableObject /** The x and y tile coordinates of the object. */ public int x, y; - /** The object's render priority. */ + /** Don't access this directly unless you are serializing this + * instance. Use {@link #getPriority} instead. */ public byte priority = 0; /** The action associated with this object or null if it has no @@ -67,6 +68,14 @@ public class ObjectInfo extends SimpleStreamableObject { } + /** + * Returns the render priority of this object tile. + */ + public int getPriority () + { + return priority; + } + /** * Returns the primary colorization assignment. */