Need to incorporate render priority in every comparison; rather than

assuming equality for display object vs. non-display object comparison.
Instead assume non-display objects have render priority of zero.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2252 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2003-02-11 05:47:28 +00:00
parent 1a3699b39c
commit 340124d567
@@ -1,5 +1,5 @@
// //
// $Id: DirtyItemList.java,v 1.20 2003/02/07 22:06:28 mdb Exp $ // $Id: DirtyItemList.java,v 1.21 2003/02/11 05:47:28 mdb Exp $
package com.threerings.miso.client; package com.threerings.miso.client;
@@ -284,18 +284,12 @@ public class DirtyItemList
// sprites are equivalent if they're the same sprite // sprites are equivalent if they're the same sprite
DirtyItem b = (DirtyItem)other; DirtyItem b = (DirtyItem)other;
return obj.equals(b.obj); return obj.equals(b.obj);
// if ((obj instanceof Sprite) && (b.obj instanceof Sprite)) { }
// return (obj == b.obj);
// }
// // objects are equivalent if they are the same object // documentation inherited
// if ((obj instanceof DisplayObjectInfo) && (b.obj instanceof DisplayObjectInfo)) { public int hashCode ()
// return (obj == b.obj); {
// } return obj.hashCode();
// // object-to-sprite are distinguished simply by origin tile
// // coordinate since they can never occupy the same tile
// return (ox == b.ox && oy == b.oy);
} }
/** /**
@@ -348,14 +342,18 @@ public class DirtyItemList
} }
} }
// if they do overlap, incorporate render priority // if they do overlap, incorporate render priority; assume
if (da.obj instanceof DisplayObjectInfo && // non-display objects have a render priority of zero
db.obj instanceof DisplayObjectInfo) { int aprio = 0;
return (((DisplayObjectInfo)da.obj).getPriority() - if (da.obj instanceof DisplayObjectInfo) {
((DisplayObjectInfo)db.obj).getPriority()); aprio = ((DisplayObjectInfo)da.obj).getPriority();
} else {
return 0;
} }
int bprio = 0;
if (db.obj instanceof DisplayObjectInfo) {
bprio = ((DisplayObjectInfo)db.obj).getPriority();
}
return aprio - bprio;
} }
/** The axis this comparator sorts on. */ /** The axis this comparator sorts on. */