From 5219c6f1bee17d4f604d347380f6e00625ed86ff Mon Sep 17 00:00:00 2001 From: "jason@long.name" Date: Sun, 24 Feb 2013 01:19:11 +0000 Subject: [PATCH] bugfix: check map boundry in traffic gen git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@574 d9718cc8-9f43-0410-858b-315f434eb58c --- src/micropolisj/engine/TrafficGen.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/micropolisj/engine/TrafficGen.java b/src/micropolisj/engine/TrafficGen.java index edb94d8..d82b890 100644 --- a/src/micropolisj/engine/TrafficGen.java +++ b/src/micropolisj/engine/TrafficGen.java @@ -98,8 +98,7 @@ class TrafficGen int tx = mapX + PerimX[z]; int ty = mapY + PerimY[z]; - if (city.testBounds(tx, ty) - && roadTest(tx, ty)) + if (roadTest(tx, ty)) { mapX = tx; mapY = ty; @@ -111,6 +110,10 @@ class TrafficGen boolean roadTest(int tx, int ty) { + if (!city.testBounds(tx, ty)) { + return false; + } + char c = city.getTile(tx, ty); c &= LOMASK;