summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-18 16:31:36 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-18 16:31:36 +0100
commit809320b21a770a91489152f25670d90e9562349a (patch)
treedccbdfee137a3c8499dd029220ccd22ebd3322bb /core
parent516e7dad19131e40508d2d2369e4d52714596ce7 (diff)
downloadRustAndDust-809320b21a770a91489152f25670d90e9562349a.zip
RustAndDust-809320b21a770a91489152f25670d90e9562349a.tar.gz
Battle,BattleCommon: add Zone getExitZone(Unit unit) and add param Zone exitZone to addReinforcement(...)
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/tankontank/game/Battle.java2
-rw-r--r--core/src/ch/asynk/tankontank/game/battles/BattleCommon.java19
2 files changed, 21 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Battle.java b/core/src/ch/asynk/tankontank/game/Battle.java
index 99b51a0..c2030a0 100644
--- a/core/src/ch/asynk/tankontank/game/Battle.java
+++ b/core/src/ch/asynk/tankontank/game/Battle.java
@@ -21,6 +21,8 @@ public interface Battle
public Zone getEntryZone(Unit unit);
+ public Zone getExitZone(Unit unit);
+
public Position getHudPosition(Player player);
public State.StateType getState(Player player);
diff --git a/core/src/ch/asynk/tankontank/game/battles/BattleCommon.java b/core/src/ch/asynk/tankontank/game/battles/BattleCommon.java
index f8d7555..9f97eda 100644
--- a/core/src/ch/asynk/tankontank/game/battles/BattleCommon.java
+++ b/core/src/ch/asynk/tankontank/game/battles/BattleCommon.java
@@ -24,6 +24,7 @@ public abstract class BattleCommon implements Battle
protected ArrayList<Zone> entryZone = new ArrayList<Zone>();
protected ArrayList<Zone> exitZone = new ArrayList<Zone>();
protected HashMap<Unit, Zone> unitEntry = new HashMap<Unit, Zone>();
+ protected HashMap<Unit, Zone> unitExit = new HashMap<Unit, Zone>();
protected TileSet objectives;
public BattleCommon(Factory factory)
@@ -57,6 +58,12 @@ public abstract class BattleCommon implements Battle
return unitEntry.get(unit);
}
+ @Override
+ public Zone getExitZone(Unit unit)
+ {
+ return unitExit.get(unit);
+ }
+
public void addEntryZone(Zone entry)
{
entryZone.add(entry);
@@ -72,11 +79,23 @@ public abstract class BattleCommon implements Battle
addReinforcement(player, entryZone, unitId, false);
}
+ public void addReinforcement(Player player, Zone entryZone, Zone exitZone, UnitId unitId)
+ {
+ addReinforcement(player, entryZone, exitZone, unitId, false);
+ }
+
public void addReinforcement(Player player, Zone entryZone, UnitId unitId, boolean ace)
{
+ addReinforcement(player, entryZone, null, unitId, ace);
+ }
+
+ public void addReinforcement(Player player, Zone entryZone, Zone exitZone, UnitId unitId, boolean ace)
+ {
Unit unit = factory.getUnit(unitId);
unit.setAce(ace);
player.addReinforcement(unit);
unitEntry.put(unit, entryZone);
+ if (exitZone != null)
+ unitExit.put(unit, exitZone);
}
}