summaryrefslogtreecommitdiff
path: root/src/town_cmd.cpp
diff options
context:
space:
mode:
authorskidd13 <skidd13@openttd.org>2008-03-31 15:10:24 +0000
committerskidd13 <skidd13@openttd.org>2008-03-31 15:10:24 +0000
commit4cc6140619a9988c1e16ff82bf7edb601ce0ed0c (patch)
tree9b6dd6eaf1527135253d7c87a4ce51747f45b477 /src/town_cmd.cpp
parenta0895d57fa4cc30e49bef6a689b1a73cf4c3d02a (diff)
downloadopenttd-4cc6140619a9988c1e16ff82bf7edb601ce0ed0c.tar.xz
(svn r12513) -Codechange: rename OriginalTileRandomiser something more descriptive
Diffstat (limited to 'src/town_cmd.cpp')
-rw-r--r--src/town_cmd.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index fdf03b970..6d4c1bec3 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -129,15 +129,21 @@ static TownDrawTileProc * const _town_draw_tile_procs[1] = {
TownDrawHouseLift
};
-uint OriginalTileRandomiser(uint x, uint y)
+/**
+ * Calculate a hash value from a tile position
+ *
+ * @param x The X coordinate
+ * @param y The Y coordinate
+ * @return The hash of the tile
+ */
+uint TileHash2Bit(uint x, uint y)
{
- uint variant;
- variant = x >> 4;
- variant ^= x >> 6;
- variant ^= y >> 4;
- variant -= y >> 6;
- variant &= 3;
- return variant;
+ uint hash = x >> 4;
+ hash ^= x >> 6;
+ hash ^= y >> 4;
+ hash -= y >> 6;
+ hash &= 3;
+ return hash;
}
/**
@@ -175,7 +181,7 @@ static void DrawTile_Town(TileInfo *ti)
}
/* Retrieve pointer to the draw town tile struct */
- dcts = &_town_draw_tile_data[house_id << 4 | OriginalTileRandomiser(ti->x, ti->y) << 2 | GetHouseBuildingStage(ti->tile)];
+ dcts = &_town_draw_tile_data[house_id << 4 | TileHash2Bit(ti->x, ti->y) << 2 | GetHouseBuildingStage(ti->tile)];
if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED);