Skip to content
Snippets Groups Projects

Fix NetworkPlayer usage

Merged Hans-Georg Sommer requested to merge network into master
7 files
+ 36
46
Compare changes
  • Side-by-side
  • Inline
Files
7
@@ -5,13 +5,11 @@ import flowerwarspp.boardmechanics.FGWBoard;
import flowerwarspp.boardmechanics.FGWType;
import flowerwarspp.gui.BoardDisplay;
import flowerwarspp.preset.Move;
import flowerwarspp.preset.Player;
import flowerwarspp.preset.PlayerColor;
import flowerwarspp.preset.PlayerType;
import flowerwarspp.preset.Status;
import flowerwarspp.preset.Viewer;
import java.io.Serializable;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
/**
* This is the implementation of a player class. It is implemented as an abstract class, such that
@@ -20,9 +18,7 @@ import java.rmi.server.UnicastRemoteObject;
* @author Felix Strnad
*
*/
public abstract class BasicPlayer extends UnicastRemoteObject implements flowerwarspp.preset.Player, Serializable {
public BasicPlayer() throws RemoteException {}
public abstract class BasicPlayer implements Player {
/**
* type of the player
*/
@@ -153,7 +149,7 @@ public abstract class BasicPlayer extends UnicastRemoteObject implements flowerw
* @throws RemoteException
*/
@Override
public void confirm(final Status boardStatus) throws Exception, RemoteException {
public void confirm(final Status boardStatus) throws Exception {
if (status != PlayerStatus.REQUEST) { //check the correct order. Red player starts with request()
System.out.println("Wrong order of execution!" + color);
throw new Exception("call request() before confirm()");
@@ -174,7 +170,7 @@ public abstract class BasicPlayer extends UnicastRemoteObject implements flowerw
* @throws RemoteException
*/
@Override
public void update(final Move opponentMove, final Status boardStatus) throws Exception, RemoteException {
public void update(final Move opponentMove, final Status boardStatus) throws Exception {
if (status == PlayerStatus.NOTEXISTING) {
throw new Exception("Call init() before using request()" + color);
} else if (status == PlayerStatus.REQUEST) {
@@ -193,4 +189,4 @@ public abstract class BasicPlayer extends UnicastRemoteObject implements flowerw
display.update(move, status);
}
}
}
\ No newline at end of file
}
Loading