The TileUtil.getTileHash function's method for computing a seed was resulting in a lot of very non-random looking vertical and horizontal lines of the same tile, especially around the origin. (0^0 == 1^1 == 2^2 etc) So, let's bit-shift x to make it appear more random.
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@942 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -55,7 +55,7 @@ public class TileUtil
|
|||||||
*/
|
*/
|
||||||
public static function getTileHash (x :int, y :int) :int
|
public static function getTileHash (x :int, y :int) :int
|
||||||
{
|
{
|
||||||
var seed :int = ((x ^ y) ^ MULTIPLIER) & MASK;
|
var seed :int = (((x << 2) ^ y) ^ MULTIPLIER) & MASK;
|
||||||
var hash :int = (seed * MULTIPLIER + ADDEND) & MASK;
|
var hash :int = (seed * MULTIPLIER + ADDEND) & MASK;
|
||||||
return hash >>> 10;
|
return hash >>> 10;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class TileUtil
|
|||||||
*/
|
*/
|
||||||
public static int getTileHash (int x, int y)
|
public static int getTileHash (int x, int y)
|
||||||
{
|
{
|
||||||
long seed = ((x ^ y) ^ MULTIPLIER) & MASK;
|
long seed = (((x << 2) ^ y) ^ MULTIPLIER) & MASK;
|
||||||
long hash = (seed * MULTIPLIER + ADDEND) & MASK;
|
long hash = (seed * MULTIPLIER + ADDEND) & MASK;
|
||||||
return (int) (hash >>> 30);
|
return (int) (hash >>> 30);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user