summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/rustanddust/game
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-12-08 10:54:45 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-12-08 10:54:45 +0100
commite205be0b8215515d0dd2bb88c94ab69f3078be53 (patch)
tree1f9a14fcf44007c74cdab1de03f26f8af3459fe2 /core/src/ch/asynk/rustanddust/game
parente13782b015b1960d1e1102ca4ded92d9d64096c9 (diff)
downloadRustAndDust-e205be0b8215515d0dd2bb88c94ab69f3078be53.zip
RustAndDust-e205be0b8215515d0dd2bb88c94ab69f3078be53.tar.gz
Map,MapRules: move init(), turnDone(), actionDone() from the former to the second
Diffstat (limited to 'core/src/ch/asynk/rustanddust/game')
-rw-r--r--core/src/ch/asynk/rustanddust/game/Map.java27
-rw-r--r--core/src/ch/asynk/rustanddust/game/battles/MapRules.java24
2 files changed, 29 insertions, 22 deletions
diff --git a/core/src/ch/asynk/rustanddust/game/Map.java b/core/src/ch/asynk/rustanddust/game/Map.java
index 9eb3e65..4d68010 100644
--- a/core/src/ch/asynk/rustanddust/game/Map.java
+++ b/core/src/ch/asynk/rustanddust/game/Map.java
@@ -57,6 +57,9 @@ public abstract class Map extends Board implements MoveToAnimationCb, ObjectiveS
private OrderList commands;
+ public abstract void init();
+ public abstract void turnDone();
+ public abstract void actionDone();
protected abstract void setup();
protected abstract void resolveEngagement(Engagement e);
protected abstract int engagementCost(Engagement e);
@@ -368,28 +371,8 @@ public abstract class Map extends Board implements MoveToAnimationCb, ObjectiveS
return r;
}
- // Ctrl Methods
-
- public void init()
- {
- actionDone();
- }
-
- public void turnDone()
- {
- RustAndDust.debug("TurnDone", String.format(" Processed Commands : %d", commands.size()));
-
- if (objectives.modifiedCount() > 0)
- throw new RuntimeException("objectives not cleared");
-
- // FIXME do something with these Commands
- commands.dispose();
- }
-
- public void actionDone()
- {
- objectives.forget();
- }
+ protected int commandsSize() { return commands.size(); }
+ protected void commandsClear() { commands.dispose(); }
// STATES ENTRY ->
diff --git a/core/src/ch/asynk/rustanddust/game/battles/MapRules.java b/core/src/ch/asynk/rustanddust/game/battles/MapRules.java
index 3426701..89af8bd 100644
--- a/core/src/ch/asynk/rustanddust/game/battles/MapRules.java
+++ b/core/src/ch/asynk/rustanddust/game/battles/MapRules.java
@@ -14,6 +14,30 @@ abstract public class MapRules extends Map
}
@Override
+ public void init()
+ {
+ actionDone();
+ }
+
+ @Override
+ public void turnDone()
+ {
+ RustAndDust.debug("TurnDone", String.format(" Processed Commands : %d", commandsSize()));
+
+ if (objectives.modifiedCount() > 0)
+ throw new RuntimeException("objectives not cleared");
+
+ // FIXME do something with these Commands
+ commandsClear();
+ }
+
+ @Override
+ public void actionDone()
+ {
+ objectives.forget();
+ }
+
+ @Override
protected int engagementCost(Engagement e)
{
if ((activatedUnits.size() == 1) && e.attacker.isA(Unit.UnitType.AT_GUN) && e.defender.isHardTarget())