From 5252770d1093351b78a2bbd538fadb9d7f86cc94 Mon Sep 17 00:00:00 2001 From: "jason@long.name" Date: Sat, 28 Sep 2013 16:34:37 +0000 Subject: [PATCH] city-eval: use public getTrafficDensity() instead of direct access of trfDensity[] array git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@865 d9718cc8-9f43-0410-858b-315f434eb58c --- src/micropolisj/engine/CityEval.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/micropolisj/engine/CityEval.java b/src/micropolisj/engine/CityEval.java index fb6a4c7..d85d545 100644 --- a/src/micropolisj/engine/CityEval.java +++ b/src/micropolisj/engine/CityEval.java @@ -178,10 +178,11 @@ public class CityEval int count = 1; int total = 0; - for (int hy = 0; hy < engine.trfDensity.length; hy++) { - for (int hx = 0; hx < engine.trfDensity[hy].length; hx++) { - if (engine.landValueMem[hy][hx] != 0) { - total += engine.trfDensity[hy][hx]; + for (int y = 0; y < engine.getHeight(); y++) { + for (int x = 0; x < engine.getWidth(); x++) { + // only consider tiles that have nonzero landvalue + if (engine.getLandValue(x, y) != 0) { + total += engine.getTrafficDensity(x, y); count++; } }