From 2eee88e529dce2cc7c8d55b97aab1692cfd776ba Mon Sep 17 00:00:00 2001 From: "jason@long.name" Date: Sun, 11 Aug 2013 22:43:04 +0000 Subject: [PATCH] getPollutionValue: move to TileConstants git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@785 d9718cc8-9f43-0410-858b-315f434eb58c --- src/micropolisj/engine/Micropolis.java | 30 --------------------- src/micropolisj/engine/TileConstants.java | 32 +++++++++++++++++++++++ 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/src/micropolisj/engine/Micropolis.java b/src/micropolisj/engine/Micropolis.java index 1eb3ded..f10e839 100644 --- a/src/micropolisj/engine/Micropolis.java +++ b/src/micropolisj/engine/Micropolis.java @@ -1028,36 +1028,6 @@ public class Micropolis } } - static int getPollutionValue(int tile) - { - if (tile < POWERBASE) - { - if (tile >= HTRFBASE) - return 75; //heavy traffic - if (tile >= LTRFBASE) - return 50; //light traffic - - if (isFire(tile)) - return 90; //active fire - - if (isRadioactive(tile)) - return 255; //radioactivity - - return 0; - } - - if (tile <= LASTIND) - return 0; - - if (tile < PORTBASE) - return 50; - - if (tile <= LASTPOWERPLANT) - return 100; - - return 0; - } - public int getTrafficDensity(int xpos, int ypos) { if (testBounds(xpos, ypos)) { diff --git a/src/micropolisj/engine/TileConstants.java b/src/micropolisj/engine/TileConstants.java index 728aa5c..7023b01 100644 --- a/src/micropolisj/engine/TileConstants.java +++ b/src/micropolisj/engine/TileConstants.java @@ -276,6 +276,38 @@ public class TileConstants } } + public static int getPollutionValue(int tile) + { + tile &= LOMASK; + + if (tile < POWERBASE) + { + if (tile >= HTRFBASE) + return 75; //heavy traffic + if (tile >= LTRFBASE) + return 50; //light traffic + + if (isFire(tile)) + return 90; //active fire + + if (isRadioactive(tile)) + return 255; //radioactivity + + return 0; + } + + if (tile <= LASTIND) + return 0; + + if (tile < PORTBASE) + return 50; + + if (tile <= LASTPOWERPLANT) + return 100; + + return 0; + } + public static boolean isAnimated(int tile) { TileSpec spec = Tiles.get(tile & LOMASK);