diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-26 23:52:10 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-26 23:52:10 +0100 |
commit | fe37e65deffa67e9f0dd738726ed553301634f20 (patch) | |
tree | 9e0e6b612a4afc892f5eb92bb44d1c6983282fec /core/src/ch/asynk/rustanddust | |
parent | dca8d22acbdd6b3ffd38050e08f969384d302555 (diff) | |
download | RustAndDust-fe37e65deffa67e9f0dd738726ed553301634f20.zip RustAndDust-fe37e65deffa67e9f0dd738726ed553301634f20.tar.gz |
game:HexSet -> engine:TileSet
Diffstat (limited to 'core/src/ch/asynk/rustanddust')
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/TileSet.java | 20 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/HexSet.java | 30 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/Zone.java | 3 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/map/Map2Moves.java | 8 |
4 files changed, 26 insertions, 35 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/TileSet.java b/core/src/ch/asynk/rustanddust/engine/TileSet.java new file mode 100644 index 0000000..76fa3a1 --- /dev/null +++ b/core/src/ch/asynk/rustanddust/engine/TileSet.java @@ -0,0 +1,20 @@ +package ch.asynk.rustanddust.engine; + +import java.util.LinkedHashSet; + +public class TileSet extends LinkedHashSet<Tile> +{ + private final Board board; + + public TileSet(Board board, int n) + { + super(n); + this.board = board; + } + + public void enable(int i, boolean enable) + { + for (Tile tile : this) + board.enableOverlayOn(tile, i, enable); + } +} diff --git a/core/src/ch/asynk/rustanddust/game/HexSet.java b/core/src/ch/asynk/rustanddust/game/HexSet.java deleted file mode 100644 index 091ebbe..0000000 --- a/core/src/ch/asynk/rustanddust/game/HexSet.java +++ /dev/null @@ -1,30 +0,0 @@ -package ch.asynk.rustanddust.game; - -import java.util.Collection; -import java.util.LinkedHashSet; - -import ch.asynk.rustanddust.engine.Tile; -import ch.asynk.rustanddust.engine.Board; - -public class HexSet extends LinkedHashSet<Hex> -{ - private final Board board; - - public HexSet(Board board, int n) - { - super(n); - this.board = board; - } - - public void enable(int i, boolean enable) - { - for (Hex hex : this) - board.enableOverlayOn(hex, i, enable); - } - - @SuppressWarnings("unchecked") - public Collection<Tile> asTiles() - { - return (Collection) this; - } -} diff --git a/core/src/ch/asynk/rustanddust/game/Zone.java b/core/src/ch/asynk/rustanddust/game/Zone.java index ff15299..1fcc4f6 100644 --- a/core/src/ch/asynk/rustanddust/game/Zone.java +++ b/core/src/ch/asynk/rustanddust/game/Zone.java @@ -1,8 +1,9 @@ package ch.asynk.rustanddust.game; import ch.asynk.rustanddust.engine.Orientation; +import ch.asynk.rustanddust.engine.TileSet; -public class Zone extends HexSet +public class Zone extends TileSet { public int allowedMoves; public Orientation orientation; diff --git a/core/src/ch/asynk/rustanddust/game/map/Map2Moves.java b/core/src/ch/asynk/rustanddust/game/map/Map2Moves.java index c991d7e..3a29e95 100644 --- a/core/src/ch/asynk/rustanddust/game/map/Map2Moves.java +++ b/core/src/ch/asynk/rustanddust/game/map/Map2Moves.java @@ -3,24 +3,24 @@ package ch.asynk.rustanddust.game.map; import com.badlogic.gdx.graphics.Texture; import ch.asynk.rustanddust.RustAndDust; +import ch.asynk.rustanddust.engine.TileSet; import ch.asynk.rustanddust.engine.SelectedTile; import ch.asynk.rustanddust.engine.Orientation; import ch.asynk.rustanddust.engine.PathBuilder; import ch.asynk.rustanddust.game.Map; import ch.asynk.rustanddust.game.Unit; import ch.asynk.rustanddust.game.Hex; -import ch.asynk.rustanddust.game.HexSet; public abstract class Map2Moves extends Map1Units { - protected final HexSet moves; + protected final TileSet moves; protected final PathBuilder paths; public Map2Moves(final RustAndDust game, Texture map, SelectedTile hex) { super(game, map, hex); - moves = new HexSet(this, 40); + moves = new TileSet(this, 40); paths = new PathBuilder(this, 10, 20, 5, 10); } @@ -46,7 +46,7 @@ public abstract class Map2Moves extends Map1Units public int movesCollect(Unit unit) { if (unit.canMove()) - return collectPossibleMoves(unit, moves.asTiles()); + return collectPossibleMoves(unit, moves); moves.clear(); return 0; |