From e205be0b8215515d0dd2bb88c94ab69f3078be53 Mon Sep 17 00:00:00 2001 From: Jérémy Zurcher Date: Tue, 8 Dec 2015 10:54:45 +0100 Subject: Map,MapRules: move init(), turnDone(), actionDone() from the former to the second --- core/src/ch/asynk/rustanddust/game/Map.java | 27 ++++------------------ .../asynk/rustanddust/game/battles/MapRules.java | 24 +++++++++++++++++++ 2 files changed, 29 insertions(+), 22 deletions(-) (limited to 'core/src/ch/asynk') diff --git a/core/src/ch/asynk/rustanddust/game/Map.java b/core/src/ch/asynk/rustanddust/game/Map.java index 9eb3e656..4d680100 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 34267013..89af8bd0 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/MapRules.java +++ b/core/src/ch/asynk/rustanddust/game/battles/MapRules.java @@ -13,6 +13,30 @@ abstract public class MapRules extends Map super(game, map, hex); } + @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) { -- cgit v1.2.3