// split into undo turn and step because this is how gameLogic calls them public void undo() { if (currentTurnSteps.atTurnStart() && pastTurns.size() != 0) { undoMove(pastTurns.pop()); } else if (!currentTurnSteps.atTurnStart()) { undoMove(currentTurnSteps.undoStep()); } }
protected void undoMove(Vector<GameObjectMove<?>> goMoves) { // Log.i("MapData") for (GameObjectMove<?> goMove : goMoves) { GameObjectMap<? extends GameObject> goMap = goMove.gameObjectMap; goMap.undoMove(goMove.getStartCords(), goMove.endCords, currentTurnSteps.atTurnStart()); } }
public <T extends GameObject> void killSubStep(GameObjectMap<T> goMap, Cords startCords) { currentTurnSteps.makeSubStep(goMap, goMap.get(startCords), startCords, null); goMap.kill(startCords); }
public void endStep() { currentTurnSteps.endStep(); }
public void beginStep() { currentTurnSteps.beginStep(); }
public void newTurn() { pastTurns.add(currentTurnSteps.toTurn()); // this is poor, try do some loop shit enemyMap.newTurn(); shipMap.newTurn(); }
public <T extends GameObject> void placeGameObjectSubStep( GameObjectMap<T> goMap, T gameObject, Cords endCords) { goMap.place(endCords, gameObject); currentTurnSteps.makeSubStep(goMap, gameObject, null, endCords); }
public <T extends GameObject> void makeSubStepMove( GameObjectMap<T> goMap, Cords startCords, Cords endCords) { currentTurnSteps.makeSubStep(goMap, goMap.get(startCords), startCords, endCords); goMap.makeMove(startCords, endCords); }