From: Erik V. <ev...@us...> - 2008-11-20 21:49:47
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv18962/rails/ui/swing Modified Files: ORPanel.java ORUIManager.java GameStatus.java Log Message: Implemented 1856 capitalisation rules. Implemented temporary procedure for destination reaching (checkboxes in OR) Cleanups Index: ORUIManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORUIManager.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ORUIManager.java 12 Oct 2008 14:36:44 -0000 1.16 --- ORUIManager.java 20 Nov 2008 21:49:38 -0000 1.17 *************** *** 3,6 **** --- 3,7 ---- import java.util.*; + import javax.swing.JComponent; import javax.swing.JOptionPane; *************** *** 10,13 **** --- 11,16 ---- import rails.game.action.*; import rails.game.special.*; + import rails.ui.swing.elements.CheckBoxDialog; + import rails.ui.swing.elements.RadioButtonDialog; import rails.ui.swing.hexmap.GUIHex; import rails.ui.swing.hexmap.HexMap; *************** *** 336,339 **** --- 339,346 ---- orWindow.process(actions.get(0)); + + } else if (actionType == ReachDestinations.class) { + + reachDestinations ((ReachDestinations) actions.get(0)); } *************** *** 404,407 **** --- 411,443 ---- } + + protected void reachDestinations (ReachDestinations action) { + + int index; + List<String> options = new ArrayList<String>(); + List<PublicCompanyI> companies = action.getPossibleCompanies(); + String chosenOption; + + for (PublicCompanyI company : companies) { + options.add(company.getName()); + } + + if (options.size() > 0) { + boolean[] destined = + new CheckBoxDialog(orPanel, + LocalText.getText("DestinationsReached"), + LocalText.getText("DestinationsReachedPrompt"), + options.toArray(new String[0])) + .getSelectedOptions(); + for (index=0; index < options.size(); index++) { + if (destined[index]) { + action.addReachedCompany(companies.get(index)); + } + } + if (orWindow.process(action)) { + updateMessage(); + } + } + } public void hexClicked(GUIHex clickedHex, GUIHex selectedHex) { *************** *** 1087,1090 **** --- 1123,1131 ---- } } + + if (possibleActions.contains(ReachDestinations.class)) { + orPanel.addSpecialAction(possibleActions.getType(ReachDestinations.class).get(0), + LocalText.getText("DestinationsReached")); + } checkForGameSpecificActions(); Index: GameStatus.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/GameStatus.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** GameStatus.java 30 Oct 2008 21:48:20 -0000 1.19 --- GameStatus.java 20 Nov 2008 21:49:38 -0000 1.20 *************** *** 172,176 **** players = gameUIManager.getPlayers().toArray(new Player[0]); np = gameUIManager.getNumberOfPlayers(); - //cm = Game.getCompanyManager(); companies = gameUIManager.getAllPublicCompanies().toArray(new PublicCompanyI[0]); nc = companies.length; --- 172,175 ---- *************** *** 470,474 **** // Bank ! addField(new Caption(LocalText.getText("BANK")), bankCashXOffset - 1, bankCashYOffset - 1, 1, 2, WIDE_TOP + WIDE_LEFT); addField(new Caption(LocalText.getText("CASH")), bankCashXOffset, --- 469,473 ---- // Bank ! addField(new Caption(LocalText.getText("Bank")), bankCashXOffset - 1, bankCashYOffset - 1, 1, 2, WIDE_TOP + WIDE_LEFT); addField(new Caption(LocalText.getText("CASH")), bankCashXOffset, *************** *** 777,784 **** if (buyableCerts != null) { for (BuyCertificate bCert : buyableCerts) { - // tCert = (TradeableCertificate) it.next(); cert = bCert.getCertificate(); index = cert.getCompany().getPublicNumber(); - // holder = cert.getPortfolio(); holder = bCert.getFromPortfolio(); if (holder == ipo) { --- 776,781 ---- Index: ORPanel.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORPanel.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** ORPanel.java 12 Oct 2008 14:36:44 -0000 1.26 --- ORPanel.java 20 Nov 2008 21:49:38 -0000 1.27 *************** *** 172,176 **** public void recreate(OperatingRound or) { ! log.debug("ORPanel.recreate() called"/* , new Exception("TRACE") */); companies = (or).getOperatingCompanies(); --- 172,176 ---- public void recreate(OperatingRound or) { ! log.debug("ORPanel.recreate() called"); companies = (or).getOperatingCompanies(); *************** *** 508,514 **** trainCaption.setHighlight(false); if (privatesCanBeBought) privatesCaption.setHighlight(false); - // if (orCompIndex >= 0) - // president[orCompIndex].setHighlight(false); - // } for (int i = 0; i < president.length; i++) { president[i].setHighlight(false); --- 508,511 ---- |