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:
Mike Thomas
2010-07-09 00:29:56 +00:00
parent 64bbf9f9d8
commit 141901b2af
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ public class TileUtil
*/
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;
return hash >>> 10;
}
@@ -59,7 +59,7 @@ public class TileUtil
*/
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;
return (int) (hash >>> 30);
}