From 76c96640c1fe44e6a627642733e1f70c65e3bc37 Mon Sep 17 00:00:00 2001 From: "jason@long.name" Date: Thu, 16 May 2013 23:42:06 +0000 Subject: [PATCH] ToolPreview: a helper class for translating the effect of a tool git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@630 d9718cc8-9f43-0410-858b-315f434eb58c --- .../engine/TranslatedToolEffect.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/micropolisj/engine/TranslatedToolEffect.java diff --git a/src/micropolisj/engine/TranslatedToolEffect.java b/src/micropolisj/engine/TranslatedToolEffect.java new file mode 100644 index 0000000..ca0039f --- /dev/null +++ b/src/micropolisj/engine/TranslatedToolEffect.java @@ -0,0 +1,33 @@ +package micropolisj.engine; + +class TranslatedToolEffect implements ToolEffectIfc +{ + final ToolEffectIfc base; + final int dx; + final int dy; + + TranslatedToolEffect(ToolEffectIfc base, int dx, int dy) + { + this.base = base; + this.dx = dx; + this.dy = dy; + } + + //implements ToolEffectIfc + public int getTile(int x, int y) + { + return base.getTile(x+dx, y+dy); + } + + //implements ToolEffectIfc + public void setTile(int x, int y, int tileValue) + { + base.setTile(x+dx, y+dy, tileValue); + } + + //implements ToolEffectIfc + public void spend(int amount) + { + base.spend(amount); + } +}