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
This commit is contained in:
Michael Bayne
2003-02-04 03:33:09 +00:00
parent 543705b935
commit 5198206dfd
3 changed files with 32 additions and 11 deletions
@@ -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; package com.threerings.miso.client;
@@ -539,7 +539,7 @@ public class DirtyItemList
DisplayObjectInfo soa = (DisplayObjectInfo)da.obj; DisplayObjectInfo soa = (DisplayObjectInfo)da.obj;
DisplayObjectInfo sob = (DisplayObjectInfo)db.obj; DisplayObjectInfo sob = (DisplayObjectInfo)db.obj;
if (IsoUtil.objectFootprintsOverlap(soa, sob)) { if (IsoUtil.objectFootprintsOverlap(soa, sob)) {
return (soa.priority - sob.priority); return (soa.getPriority() - sob.getPriority());
} }
} }
@@ -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; package com.threerings.miso.client;
@@ -44,13 +44,25 @@ public class DisplayObjectInfo extends ObjectInfo
public void setObjectTile (ObjectTile tile) public void setObjectTile (ObjectTile tile)
{ {
this.tile = 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) * Returns the render priority of this object tile.
if (priority == 0 && tile != null) { */
priority = (byte)Math.max( public int getPriority ()
Byte.MIN_VALUE, Math.min(Byte.MAX_VALUE, tile.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));
} }
/** /**
@@ -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; package com.threerings.miso.data;
@@ -17,7 +17,8 @@ public class ObjectInfo extends SimpleStreamableObject
/** The x and y tile coordinates of the object. */ /** The x and y tile coordinates of the object. */
public int x, y; 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; public byte priority = 0;
/** The action associated with this object or null if it has no /** 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. * Returns the primary colorization assignment.
*/ */