From 599ea026f35176debdcd9df1222cc8dd043eef3d Mon Sep 17 00:00:00 2001 From: "jason@long.name" Date: Tue, 28 May 2013 01:55:17 +0000 Subject: [PATCH] cleanup: move neutralizeRoad() to TileConstants git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@683 d9718cc8-9f43-0410-858b-315f434eb58c --- src/micropolisj/engine/TileConstants.java | 13 +++++++++++++ src/micropolisj/engine/ToolStroke.java | 10 ---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/micropolisj/engine/TileConstants.java b/src/micropolisj/engine/TileConstants.java index 38c33bc..bbf37a4 100644 --- a/src/micropolisj/engine/TileConstants.java +++ b/src/micropolisj/engine/TileConstants.java @@ -429,4 +429,17 @@ public class TileConstants { return tile >= 0 && (tile & ZONEBIT) != 0; } + + /** + * Converts a road tile value with traffic to the equivalent + * road tile without traffic. + */ + public static char neutralizeRoad(int tile) + { + tile &= LOMASK; + if (tile >= ROADBASE && tile <= LASTROAD) { + tile = ((tile - ROADBASE) & 0xf) + ROADBASE; + } + return (char)tile; + } } diff --git a/src/micropolisj/engine/ToolStroke.java b/src/micropolisj/engine/ToolStroke.java index 6db34da..79e9b61 100644 --- a/src/micropolisj/engine/ToolStroke.java +++ b/src/micropolisj/engine/ToolStroke.java @@ -253,16 +253,6 @@ public class ToolStroke return true; } - // checks whether the tile value represents road with traffic - // and if so converts it to the equivalent road without traffic. - static char neutralizeRoad(int tile) - { - tile &= LOMASK; - if (tile >= 64 && tile <= 207) - tile = (char)( (tile & 0xf) + 64 ); - return (char)tile; - } - protected void fixZone(int xpos, int ypos) { ToolEffect eff = new ToolEffect(city, xpos, ypos);