Use the compose() method which properly handles negative y values.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2448 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: SceneBlock.java,v 1.7 2003/04/23 00:37:46 mdb Exp $
|
// $Id: SceneBlock.java,v 1.8 2003/04/23 00:45:24 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.miso.client;
|
package com.threerings.miso.client;
|
||||||
|
|
||||||
@@ -301,15 +301,17 @@ public class SceneBlock
|
|||||||
/** Computes the key of our neighbor. */
|
/** Computes the key of our neighbor. */
|
||||||
protected final int neighborKey (int dx, int dy)
|
protected final int neighborKey (int dx, int dy)
|
||||||
{
|
{
|
||||||
return ((short)(MathUtil.floorDiv(_bounds.x, _bounds.width)+dx) << 16 |
|
int nx = MathUtil.floorDiv(_bounds.x, _bounds.width)+dx;
|
||||||
(short)(MathUtil.floorDiv(_bounds.y, _bounds.height)+dy));
|
int ny = MathUtil.floorDiv(_bounds.y, _bounds.height)+dy;
|
||||||
|
return MisoScenePanel.compose(nx, ny);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Computes the key for the block that holds the specified tile. */
|
/** Computes the key for the block that holds the specified tile. */
|
||||||
protected final int blockKey (int tx, int ty)
|
protected final int blockKey (int tx, int ty)
|
||||||
{
|
{
|
||||||
return ((short)MathUtil.floorDiv(tx, _bounds.width) << 16 |
|
int bx = MathUtil.floorDiv(tx, _bounds.width);
|
||||||
(short)MathUtil.floorDiv(ty, _bounds.height));
|
int by = MathUtil.floorDiv(ty, _bounds.height);
|
||||||
|
return MisoScenePanel.compose(bx, by);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user