From 141901b2af4f3bd0807526978c7da888a822d822 Mon Sep 17 00:00:00 2001 From: Mike Thomas Date: Fri, 9 Jul 2010 00:29:56 +0000 Subject: [PATCH] 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 --- src/as/com/threerings/media/tile/TileUtil.as | 2 +- src/java/com/threerings/media/tile/TileUtil.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/as/com/threerings/media/tile/TileUtil.as b/src/as/com/threerings/media/tile/TileUtil.as index 7b3aac24..1dd2f864 100644 --- a/src/as/com/threerings/media/tile/TileUtil.as +++ b/src/as/com/threerings/media/tile/TileUtil.as @@ -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; } diff --git a/src/java/com/threerings/media/tile/TileUtil.java b/src/java/com/threerings/media/tile/TileUtil.java index 8b423e0a..f7fa4a06 100644 --- a/src/java/com/threerings/media/tile/TileUtil.java +++ b/src/java/com/threerings/media/tile/TileUtil.java @@ -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); }