From f09ba76a23039a4f16c8c79feea452cbc4dd95bc Mon Sep 17 00:00:00 2001 From: "jason@long.name" Date: Sun, 1 Sep 2013 00:27:14 +0000 Subject: [PATCH] tiles: use new residential-zone/commercial-zone annotations git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@818 d9718cc8-9f43-0410-858b-315f434eb58c --- src/micropolisj/engine/TileConstants.java | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/micropolisj/engine/TileConstants.java b/src/micropolisj/engine/TileConstants.java index 8afcd76..664d0d5 100644 --- a/src/micropolisj/engine/TileConstants.java +++ b/src/micropolisj/engine/TileConstants.java @@ -652,8 +652,15 @@ public class TileConstants public static boolean isCommercialZone(int tile) { - return (tile & LOMASK) >= COMBASE && - (tile & LOMASK) < INDBASE; + int tmp = tile & LOMASK; + TileSpec ts = Tiles.get(tmp); + if (ts != null) { + if (ts.owner != null) { + ts = ts.owner; + } + return ts.getBooleanAttribute("commercial-zone"); + } + return false; } public static boolean isHospitalOrChurch(int tile) @@ -698,7 +705,14 @@ public class TileConstants public static boolean isResidentialZoneAny(int tile) { int tmp = tile & LOMASK; - return (tile >= RESBASE && tile < COMBASE); + TileSpec ts = Tiles.get(tmp); + if (ts != null) { + if (ts.owner != null) { + ts = ts.owner; + } + return ts.getBooleanAttribute("residential-zone"); + } + return false; } public static boolean isSpecialZone(int tile)