From 4158265409c161fb20424e0bee011f53df12db7d Mon Sep 17 00:00:00 2001 From: "jason@long.name" Date: Sat, 23 Feb 2013 12:53:44 +0000 Subject: [PATCH] cleanup: make macros isRoad and isRail to test for those tile types git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@569 d9718cc8-9f43-0410-858b-315f434eb58c --- src/micropolisj/engine/MapScanner.java | 4 ++-- src/micropolisj/engine/TileConstants.java | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/micropolisj/engine/MapScanner.java b/src/micropolisj/engine/MapScanner.java index 619f56f..f921271 100644 --- a/src/micropolisj/engine/MapScanner.java +++ b/src/micropolisj/engine/MapScanner.java @@ -72,7 +72,7 @@ class MapScanner setZonePower(); } - if (cchr9 >= ROADBASE && cchr9 < POWERBASE) + if (isRoad(cchr)) { doRoad(); return; @@ -84,7 +84,7 @@ class MapScanner return; } - if (cchr9 >= RAILBASE && cchr9 < RESBASE) + if (isRail(cchr)) { doRail(); return; diff --git a/src/micropolisj/engine/TileConstants.java b/src/micropolisj/engine/TileConstants.java index 3c04873..7da0da3 100644 --- a/src/micropolisj/engine/TileConstants.java +++ b/src/micropolisj/engine/TileConstants.java @@ -324,4 +324,16 @@ public class TileConstants { return (tile == DIRT || ((tile & BULLBIT) != 0 && (tile & BURNBIT) != 0)); } + + public static boolean isRoad(int tile) + { + int tmp = tile & LOMASK; + return (tmp >= ROADBASE && tmp < POWERBASE); + } + + public static boolean isRail(int tile) + { + int tmp = tile & LOMASK; + return (tmp >= RAILBASE && tmp < RESBASE); + } }