Update of /cvsroot/rails/18xx/rails/ui/swing
In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv30729/rails/ui/swing
Modified Files:
ORUIManager.java
Log Message:
Fixed holes that allowed not specifying the exchanged train in a train exchange action.
Index: ORUIManager.java
===================================================================
RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORUIManager.java,v
retrieving revision 1.71
retrieving revision 1.72
diff -C2 -d -r1.71 -r1.72
*** ORUIManager.java 2 May 2010 17:32:04 -0000 1.71
--- ORUIManager.java 13 May 2010 09:51:32 -0000 1.72
***************
*** 1089,1093 ****
List<String> oldTrainOptions =
new ArrayList<String>(oldTrains.size());
! String[] options = new String[oldTrains.size() + 1];
int jj = 0;
for (int j = 0; j < oldTrains.size(); j++) {
--- 1089,1093 ----
List<String> oldTrainOptions =
new ArrayList<String>(oldTrains.size());
! String[] options = new String[oldTrains.size()];
int jj = 0;
for (int j = 0; j < oldTrains.size(); j++) {
***************
*** 1103,1109 ****
JOptionPane.QUESTION_MESSAGE, null, options,
options[0]);
! int index = oldTrainOptions.indexOf(exchangedTrainName);
! if (index >= 0) {
! exchangedTrain = oldTrains.get(index);
}
}
--- 1103,1115 ----
JOptionPane.QUESTION_MESSAGE, null, options,
options[0]);
! if (exchangedTrainName != null) {
! int index = oldTrainOptions.indexOf(exchangedTrainName);
! if (index >= 0) {
! exchangedTrain = oldTrains.get(index);
! }
! }
! if (exchangedTrain == null) {
! // No valid train selected - cancel the buy action
! train = null;
}
}
|