From 5c85cd0a64a1387ae4bc5a37600119c1d05bdae6 Mon Sep 17 00:00:00 2001 From: "jason@long.name" Date: Thu, 16 May 2013 23:44:03 +0000 Subject: [PATCH] toolstroke: continue refactoring for ToolEffect git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@636 d9718cc8-9f43-0410-858b-315f434eb58c --- src/micropolisj/engine/ToolStroke.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/micropolisj/engine/ToolStroke.java b/src/micropolisj/engine/ToolStroke.java index 6e5f0d9..d53db1f 100644 --- a/src/micropolisj/engine/ToolStroke.java +++ b/src/micropolisj/engine/ToolStroke.java @@ -397,16 +397,20 @@ public class ToolStroke void fixBorder(int left, int top, int right, int bottom) { + ToolEffect eff = new ToolEffect(city, left, top); + for (int x = left; x <= right; x++) { - fixZone(x, top); - fixZone(x, bottom); + fixZone(new TranslatedToolEffect(eff, x-left, 0)); + fixZone(new TranslatedToolEffect(eff, x-left, bottom-top)); } for (int y = top + 1; y <= bottom - 1; y++) { - fixZone(left, y); - fixZone(right, y); + fixZone(new TranslatedToolEffect(eff, 0, y-top)); + fixZone(new TranslatedToolEffect(eff, right-left, y-top)); } + + eff.apply(); } ToolResult applyParkTool(int xpos, int ypos) @@ -459,7 +463,12 @@ public class ToolStroke protected void fixZone(int xpos, int ypos) { ToolEffect eff = new ToolEffect(city, xpos, ypos); + fixZone(eff); + eff.apply(); + } + protected void fixZone(ToolEffectIfc eff) + { fixSingle(eff); // "fix" the cells to the north, west, east, and south @@ -467,8 +476,6 @@ public class ToolStroke 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)