summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-02-03 00:35:56 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2016-02-03 00:35:56 +0100
commit4dcfa7ba19ac5b9f0522f92ee10f43ade20b57de (patch)
tree07d650f8fc1d1bdf335c27c75e6d9d965547cabb /core/src
parent08596cf6cb7ee5871932eecdbb5a2e4251cf92a3 (diff)
downloadRustAndDust-4dcfa7ba19ac5b9f0522f92ee10f43ade20b57de.zip
RustAndDust-4dcfa7ba19ac5b9f0522f92ee10f43ade20b57de.tar.gz
BattleCommon: replace Player a, b with Player[2] players
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/rustanddust/game/battles/Battle00.java4
-rw-r--r--core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java15
-rw-r--r--core/src/ch/asynk/rustanddust/game/battles/BattleTest.java4
3 files changed, 13 insertions, 10 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/battles/Battle00.java b/core/src/ch/asynk/rustanddust/game/battles/Battle00.java
index 4381303..4dcf702 100644
--- a/core/src/ch/asynk/rustanddust/game/battles/Battle00.java
+++ b/core/src/ch/asynk/rustanddust/game/battles/Battle00.java
@@ -27,8 +27,8 @@ public class Battle00 extends BattleCommon
@Override
protected void setPlayers(int idA, int idB)
{
- a = factory.getPlayer(idA, Army.US);
- b = factory.getPlayer(idB, Army.GE);
+ players[0] = factory.getPlayer(idA, Army.US);
+ players[1] = factory.getPlayer(idB, Army.GE);
}
@Override
diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java
index f34e594..4551d78 100644
--- a/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java
+++ b/core/src/ch/asynk/rustanddust/game/battles/BattleCommon.java
@@ -29,8 +29,7 @@ public abstract class BattleCommon implements Battle
protected String description;
protected Map map;
protected Player currentPlayer;
- protected Player a;
- protected Player b;
+ protected Player[] players;
protected IterableArray<Zone> entryZones = new IterableArray<Zone>(10);
protected IterableArray<Zone> exitZones = new IterableArray<Zone>(10);
protected HashMap<Unit, Zone> unitEntry = new HashMap<Unit, Zone>();
@@ -60,6 +59,7 @@ public abstract class BattleCommon implements Battle
public BattleCommon(Factory factory)
{
this.factory = factory;
+ this.players = new Player[2];
}
@Override
@@ -112,19 +112,19 @@ public abstract class BattleCommon implements Battle
setupMap();
- this.currentPlayer = this.a;
+ this.currentPlayer = players[0];
setupPlayer();
map.actionDone();
map.turnDone();
currentPlayer.turnEnd();
- this.currentPlayer = this.b;
+ this.currentPlayer = players[1];
setupPlayer();
map.actionDone();
map.turnDone();
currentPlayer.turnEnd();
- this.currentPlayer = this.a;
+ this.currentPlayer = players[0];
}
@Override
@@ -163,6 +163,9 @@ public abstract class BattleCommon implements Battle
if (!turnDoneForBoth())
return null;
+ Player a = players[0];
+ Player b = players[1];
+
if (a.unitsLeft() == 0)
return b;
if (b.unitsLeft() == 0)
@@ -191,7 +194,7 @@ public abstract class BattleCommon implements Battle
@Override
public Player getOpponent()
{
- return ((currentPlayer == a) ? b : a);
+ return ((currentPlayer == players[0]) ? players[1] : players[0]);
}
@Override
diff --git a/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java b/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java
index 8f65575..8466841 100644
--- a/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java
+++ b/core/src/ch/asynk/rustanddust/game/battles/BattleTest.java
@@ -24,8 +24,8 @@ public class BattleTest extends BattleCommon
@Override
protected void setPlayers(int idA, int idB)
{
- a = factory.getPlayer(idA, Army.GE);
- b = factory.getPlayer(idB, Army.US);
+ players[0] = factory.getPlayer(idA, Army.GE);
+ players[1] = factory.getPlayer(idB, Army.US);
}
@Override