summaryrefslogtreecommitdiffstats
path: root/core/src/ch
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-01-09 18:55:44 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2016-01-09 18:55:44 +0100
commit39bcc7375c7d9c17922ec76be6f7834ae8211b82 (patch)
tree3d1da847a9da887cb9130b03869765af0a598df6 /core/src/ch
parent9154d76c30f106e4811a99b34f35c8923967195f (diff)
downloadRustAndDust-39bcc7375c7d9c17922ec76be6f7834ae8211b82.zip
RustAndDust-39bcc7375c7d9c17922ec76be6f7834ae8211b82.tar.gz
Tile: add constructor param int capacity (of the stack)
Diffstat (limited to 'core/src/ch')
-rw-r--r--core/src/ch/asynk/rustanddust/engine/Tile.java8
-rw-r--r--core/src/ch/asynk/rustanddust/game/Factory.java4
-rw-r--r--core/src/ch/asynk/rustanddust/game/Hex.java4
3 files changed, 9 insertions, 7 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/Tile.java b/core/src/ch/asynk/rustanddust/engine/Tile.java
index 3c931cd..7bb2fe7 100644
--- a/core/src/ch/asynk/rustanddust/engine/Tile.java
+++ b/core/src/ch/asynk/rustanddust/engine/Tile.java
@@ -47,19 +47,19 @@ public abstract class Tile implements Drawable, Disposable, Iterable<Pawn>
public abstract boolean atLeastOneMove(Pawn pawn);
public abstract boolean blockLineOfSight(Tile from, Tile to);
- protected Tile(int col, int row, Faction defaultFaction)
+ protected Tile(int col, int row, int capacity, Faction defaultFaction)
{
this.col = col;
this.row = row;
- this.stack = new ArrayListIt<Pawn>();
+ this.stack = new ArrayListIt<Pawn>(capacity);
this.curFaction = defaultFaction;
this.prevFaction = defaultFaction;
this.objective = Objective.NONE;
}
- public Tile(float x, float y, int col, int row, TextureAtlas atlas, Faction defaultFaction)
+ public Tile(float x, float y, int col, int row, int capacity, Faction defaultFaction, TextureAtlas atlas)
{
- this(col, row, defaultFaction);
+ this(col, row, capacity, defaultFaction);
this.x = x;
this.y = y;
this.overlays = new StackedImages(atlas);
diff --git a/core/src/ch/asynk/rustanddust/game/Factory.java b/core/src/ch/asynk/rustanddust/game/Factory.java
index a16fb49..4d67eb5 100644
--- a/core/src/ch/asynk/rustanddust/game/Factory.java
+++ b/core/src/ch/asynk/rustanddust/game/Factory.java
@@ -29,6 +29,8 @@ public class Factory implements Board.TileBuilder, Disposable
public static final String ENABLED = "enabled";
public static final String REINFORCEMENT = "reinforcement";
+ public static final int HEX_CAPACITY = 1;
+
public enum MapType
{
MAP_00,
@@ -213,7 +215,7 @@ public class Factory implements Board.TileBuilder, Disposable
public Hex getNewTile(float x, float y, int col, int row, boolean offmap)
{
- Hex hex = new Hex(x, y, col, row, hexOverlaysAtlas, Army.NONE);
+ Hex hex = new Hex(x, y, col, row, HEX_CAPACITY, Army.NONE, hexOverlaysAtlas);
if (offmap) hex.terrain = Hex.Terrain.OFFMAP;
return hex;
}
diff --git a/core/src/ch/asynk/rustanddust/game/Hex.java b/core/src/ch/asynk/rustanddust/game/Hex.java
index f5a990e..7b37dee 100644
--- a/core/src/ch/asynk/rustanddust/game/Hex.java
+++ b/core/src/ch/asynk/rustanddust/game/Hex.java
@@ -43,9 +43,9 @@ public class Hex extends Tile
return String.format("(%d;%d)", col, row);
}
- public Hex(float x, float y, int col, int row, TextureAtlas atlas, Army defaultArmy)
+ public Hex(float x, float y, int col, int row, int capacity, Army defaultArmy, TextureAtlas atlas)
{
- super(x, y, col, row, atlas, defaultArmy);
+ super(x, y, col, row, capacity, defaultArmy, atlas);
this.terrain = Terrain.CLEAR;
this.roads = 0;
}