package controller;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import boundary.PlayerApplication;
import model.Move;
import model.PlayerModel;
import model.PlayerState;
import model.Point;
import model.Variation;

/**
 * @author Nick Chaput
 */
public class PlayerRemoveCtrl implements ActionListener{
  PlayerApplication app;
  PlayerModel model;

  public PlayerRemoveCtrl(PlayerApplication app, PlayerModel model) {
    this.app = app;
    this.model = model;
  }

  public void startRemove(Point point) {
    // TODO: generic implementation
    PlayerVariationCtrl pVar = model.variation.createCtrl(app, model);
    if (model.variation != Variation.RELEASE &&
        model.level.currentBoard.grid[point.x][point.y].tile.number != 6) {
      // GO INTO PLAYERMODEL AND REPLACE PLAYERVARIATIONCTRL WITH VARIATION
      // TODO: This is suboptimal, decide whether to change PlayerVariationCtrl.
      // specialMove() to individual methods for each special move
      // TODO: resolve the move
      Move reMove = new Move();
      reMove.expand(model.level.currentBoard, point);
    }
    pVar.remove();
  }

  @Override
  public void actionPerformed(ActionEvent arg0) {
	model.playerState = PlayerState.REMOVE;
  }
}

@@ -123,16 +123,49 @@
 cation;%0A
+import boundary.PlayerLevelView;%0A
 import m
@@ -1150,16 +1150,18 @@
   %7D%0A    
+//
 pVar.rem
@@ -1167,16 +1167,30 @@
 move();%0A
+    remove();%0A
   %7D%0A%0A  @
@@ -1248,16 +1248,16 @@
 arg0) %7B%0A
-
 %09model.p
@@ -1293,10 +1293,536 @@
 VE;%0A  %7D%0A
+  %0A  public void remove() %7B%0A%09  if (model.playerState != PlayerState.REMOVE %0A%09  %09%09%7C%7C model.move.points.size() != 1)%7B%0A%09%09  System.out.println(%22Remove called when not valid%22);%0A%09%09  model.move = new Move();%0A%09  %7D%0A%09  else %7B%0A%09%09  for (Point p : model.move.points) %7B%0A%09%09%09  model.level.currentBoard.grid%5Bp.x%5D%5Bp.y%5D.tile = null;%0A%09%09  %7D%0A%09      PlayerUpdateBoardCtrl updateBoardCtrl = new PlayerUpdateBoardCtrl(app, model);%0A%09      updateBoardCtrl.processBoardSmooth();%0A%09  %7D%0A%09  model.counter--;%0A%09  ((PlayerLevelView)app.getView()).update();%0A  %7D%0A
 %7D%0A

Add remove functionality