From 5b5e27839353106ac6de8d7bc38aa2ece7e19344 Mon Sep 17 00:00:00 2001 From: "jason@long.name" Date: Thu, 16 May 2013 23:43:46 +0000 Subject: [PATCH] toolstroke: apply ToolEffect-conversion to fixZone() git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@635 d9718cc8-9f43-0410-858b-315f434eb58c --- src/micropolisj/engine/ToolStroke.java | 27 +++++++++++++------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/micropolisj/engine/ToolStroke.java b/src/micropolisj/engine/ToolStroke.java index 3cad8a2..6e5f0d9 100644 --- a/src/micropolisj/engine/ToolStroke.java +++ b/src/micropolisj/engine/ToolStroke.java @@ -457,22 +457,22 @@ public class ToolStroke } protected void fixZone(int xpos, int ypos) - { - fixSingle(xpos, ypos); - if (ypos > 0) - fixSingle(xpos, ypos - 1); - if (xpos > 0) - fixSingle(xpos - 1, ypos); - if (xpos + 1 < city.getWidth()) - fixSingle(xpos + 1, ypos); - if (ypos + 1 < city.getHeight()) - fixSingle(xpos, ypos + 1); - } - - private void fixSingle(int xpos, int ypos) { ToolEffect eff = new ToolEffect(city, xpos, ypos); + fixSingle(eff); + + // "fix" the cells to the north, west, east, and south + fixSingle(new TranslatedToolEffect(eff, 0, -1)); + fixSingle(new TranslatedToolEffect(eff, -1, 0)); + fixSingle(new TranslatedToolEffect(eff, 1, 0)); + fixSingle(new TranslatedToolEffect(eff, 0, 1)); + + eff.apply(); + } + + private void fixSingle(ToolEffectIfc eff) + { int tile = (eff.getTile(0, 0) & LOMASK); tile = neutralizeRoad(tile); @@ -665,7 +665,6 @@ public class ToolStroke eff.setTile(0, 0, (WireTable[adjTile] | BULLBIT | BURNBIT | CONDBIT)); } //end if on a rail tile - eff.apply(); return; }