From: Erik V. <ev...@us...> - 2010-01-18 18:50:09
|
Update of /cvsroot/rails/18xx/rails/game/action In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv21858/rails/game/action Modified Files: NullAction.java Added Files: RequestTurn.java Log Message: Initial implementation of Autopass and RequestTurn --- NEW FILE: RequestTurn.java --- package rails.game.action; import java.io.IOException; import java.io.ObjectInputStream; import rails.game.Player; public class RequestTurn extends PossibleAction { public static final long serialVersionUID = 1L; private String requestingPlayerName; public RequestTurn (Player player) { super(); // Override player set by superclass if (player != null) { requestingPlayerName = player.getName(); } } public String getRequestingPlayerName() { return requestingPlayerName; } @Override public boolean equals(PossibleAction pa) { return pa != null && pa instanceof RequestTurn && requestingPlayerName.equals(((RequestTurn)pa).requestingPlayerName); } private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); } @Override public String toString() { return requestingPlayerName+" requests turn"; } } Index: NullAction.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/action/NullAction.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** NullAction.java 4 Jun 2008 19:00:30 -0000 1.7 --- NullAction.java 18 Jan 2010 18:49:12 -0000 1.8 *************** *** 7,13 **** public static final int PASS = 1; public static final int SKIP = 2; ! public static final int MAX_MODE = 2; ! private String[] name = new String[] { "Done", "Pass", "Skip" }; protected int mode = -1; --- 7,14 ---- public static final int PASS = 1; public static final int SKIP = 2; ! public static final int AUTOPASS = 3; ! public static final int MAX_MODE = 3; ! private static String[] name = new String[] { "Done", "Pass", "Skip", "Autopass" }; protected int mode = -1; *************** *** 25,29 **** } ! public boolean equals(PossibleAction action) { if (!(action instanceof NullAction)) return false; NullAction a = (NullAction) action; --- 26,31 ---- } ! @Override ! public boolean equals(PossibleAction action) { if (!(action instanceof NullAction)) return false; NullAction a = (NullAction) action; *************** *** 31,35 **** } ! public String toString() { return name[mode]; } --- 33,38 ---- } ! @Override ! public String toString() { return name[mode]; } |