diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-15 11:54:32 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-12-15 11:54:32 +0100 |
commit | 6bfd74e4a5dd02c2c66da1c9bbf0b76daab9d21b (patch) | |
tree | a01280659885d3b1688e686d56590f852babb517 /core/src/ch/asynk/rustanddust | |
parent | 449f45bb28524af653d7bd646eb98522793837c7 (diff) | |
download | RustAndDust-6bfd74e4a5dd02c2c66da1c9bbf0b76daab9d21b.zip RustAndDust-6bfd74e4a5dd02c2c66da1c9bbf0b76daab9d21b.tar.gz |
BattleCommon: swallow setUnit(...) from BattleTest
Diffstat (limited to 'core/src/ch/asynk/rustanddust')
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java | 27 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/battles/BattleTest.java | 14 |
2 files changed, 21 insertions, 20 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java index c103ca8..b3ffef8 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java +++ b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java @@ -13,6 +13,7 @@ import ch.asynk.rustanddust.game.Hex; import ch.asynk.rustanddust.game.Unit; import ch.asynk.rustanddust.game.Unit.UnitId; import ch.asynk.rustanddust.game.State.StateType; +import ch.asynk.rustanddust.engine.Orientation; public abstract class BattleCommon implements Battle { @@ -163,33 +164,33 @@ public abstract class BattleCommon implements Battle return unitExit.get(unit); } - public void addEntryZone(Zone entry) + protected void addEntryZone(Zone entry) { entryZone.add(entry); } - public void addExitZone(Zone exit) + protected void addExitZone(Zone exit) { exitZone.add(exit); exit.enable(Hex.EXIT, true); } - public void addReinforcement(Player player, Zone entryZone, UnitId unitId) + protected void addReinforcement(Player player, Zone entryZone, UnitId unitId) { addReinforcement(player, entryZone, unitId, false, false); } - public void addReinforcement(Player player, Zone entryZone, Zone exitZone, UnitId unitId) + protected void addReinforcement(Player player, Zone entryZone, Zone exitZone, UnitId unitId) { addReinforcement(player, entryZone, exitZone, unitId, false, false); } - public void addReinforcement(Player player, Zone entryZone, UnitId unitId, boolean hq, boolean ace) + protected void addReinforcement(Player player, Zone entryZone, UnitId unitId, boolean hq, boolean ace) { addReinforcement(player, entryZone, null, unitId, hq, ace); } - public void addReinforcement(Player player, Zone entryZone, Zone exitZone, UnitId unitId, boolean hq, boolean ace) + protected void addReinforcement(Player player, Zone entryZone, Zone exitZone, UnitId unitId, boolean hq, boolean ace) { Unit unit = factory.getUnit(unitId, hq, ace); player.addReinforcement(unit); @@ -197,4 +198,18 @@ public abstract class BattleCommon implements Battle if (exitZone != null) unitExit.put(unit, exitZone); } + + protected Unit setUnit(Map map, Player player, UnitId unitId, int col, int row, Orientation orientation, Zone exitZone) + { + return setUnit(map, player, unitId, col, row, orientation, false, false, exitZone); + } + + protected Unit setUnit(Map map, Player player, UnitId unitId, int col, int row, Orientation orientation, boolean hq, boolean ace, Zone exitZone) + { + Unit u = factory.getUnit(unitId, hq, ace); + if (exitZone != null) + unitExit.put(u, exitZone); + map.setOnBoard(u, map.getHex(col, row), orientation); + return u; + } } diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java b/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java index 4772d9d..523398d 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java +++ b/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java @@ -106,18 +106,4 @@ public class BattleTest extends BattleCommon return this.map; } - - private Unit setUnit(Map map, Player player, UnitId unitId, int col, int row, Orientation orientation, Zone exitZone) - { - return setUnit(map, player, unitId, col, row, orientation, false, false, exitZone); - } - - private Unit setUnit(Map map, Player player, UnitId unitId, int col, int row, Orientation orientation, boolean hq, boolean ace, Zone exitZone) - { - Unit u = factory.getUnit(unitId, hq, ace); - if (exitZone != null) - unitExit.put(u, exitZone); - map.setOnBoard(u, map.getHex(col, row), orientation); - return u; - } } |