You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(3) |
Nov
(46) |
Dec
(57) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(51) |
Feb
(10) |
Mar
|
Apr
|
May
(14) |
Jun
|
Jul
(13) |
Aug
(30) |
Sep
(83) |
Oct
(56) |
Nov
(148) |
Dec
(107) |
2010 |
Jan
(260) |
Feb
(164) |
Mar
(183) |
Apr
(99) |
May
(160) |
Jun
(40) |
Jul
(33) |
Aug
(48) |
Sep
(22) |
Oct
(24) |
Nov
(1) |
Dec
(12) |
2011 |
Jan
(6) |
Feb
(15) |
Mar
(13) |
Apr
(37) |
May
(27) |
Jun
(29) |
Jul
(33) |
Aug
(20) |
Sep
(17) |
Oct
(20) |
Nov
(33) |
Dec
(17) |
2012 |
Jan
(39) |
Feb
(38) |
Mar
(20) |
Apr
(21) |
May
(17) |
Jun
(22) |
Jul
(16) |
Aug
(3) |
Sep
(9) |
Oct
(10) |
Nov
|
Dec
|
From: Erik V. <ev...@us...> - 2009-01-11 17:24:52
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv6543/rails/ui/swing Modified Files: ORUIManager.java ORPanel.java GameStatus.java Log Message: Basic loans taking and specific rules for 1856. Index: ORUIManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORUIManager.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** ORUIManager.java 30 Nov 2008 21:49:08 -0000 1.22 --- ORUIManager.java 11 Jan 2009 17:24:46 -0000 1.23 *************** *** 25,29 **** private MessagePanel messagePanel; private RemainingTilesWindow remainingTiles; ! public GameUIManager gameUIManager; --- 25,29 ---- private MessagePanel messagePanel; private RemainingTilesWindow remainingTiles; ! public GameUIManager gameUIManager; *************** *** 93,98 **** } ! ! public void initOR(OperatingRound or) { --- 93,98 ---- } ! ! public void initOR(OperatingRound or) { *************** *** 313,317 **** /** * Processes button presses and menu selection actions ! * * @param command * @param actions --- 313,317 ---- /** * Processes button presses and menu selection actions ! * * @param command * @param actions *************** *** 337,344 **** orWindow.process(actions.get(0)); ! } else if (actionType == ReachDestinations.class) { ! reachDestinations ((ReachDestinations) actions.get(0)); } --- 337,348 ---- orWindow.process(actions.get(0)); ! } else if (actionType == ReachDestinations.class) { ! reachDestinations ((ReachDestinations) actions.get(0)); + + } else if (actionType == TakeLoans.class) { + + takeLoans ((TakeLoans)actions.get(0)); } *************** *** 354,357 **** --- 358,362 ---- displayRemainingTiles(); + } *************** *** 409,415 **** } ! protected void reachDestinations (ReachDestinations action) { ! int index; List<String> options = new ArrayList<String>(); --- 414,420 ---- } ! protected void reachDestinations (ReachDestinations action) { ! int index; List<String> options = new ArrayList<String>(); *************** *** 421,425 **** if (options.size() > 0) { ! boolean[] destined = new CheckBoxDialog(orPanel, LocalText.getText("DestinationsReached"), --- 426,430 ---- if (options.size() > 0) { ! boolean[] destined = new CheckBoxDialog(orPanel, LocalText.getText("DestinationsReached"), *************** *** 559,563 **** allowance.setOrientation(selectedHex.getProvisionalTileRotation()); allowance.setLaidTile(selectedHex.getProvisionalTile()); ! relayBaseTokens (allowance); --- 564,568 ---- allowance.setOrientation(selectedHex.getProvisionalTileRotation()); allowance.setLaidTile(selectedHex.getProvisionalTile()); ! relayBaseTokens (allowance); *************** *** 642,649 **** } } ! ! /** * Manually relay the tokens. ! * This is only needed in special cases, * such as the 1830 Erie home token. * If applicable, the TileSet entry for the <i>old</i> tile --- 647,654 ---- } } ! ! /** * Manually relay the tokens. ! * This is only needed in special cases, * such as the 1830 Erie home token. * If applicable, the TileSet entry for the <i>old</i> tile *************** *** 653,661 **** */ protected void relayBaseTokens (LayTile action) { ! MapHex hex = action.getChosenHex(); TileI newTile = action.getLaidTile(); TileI oldTile = hex.getCurrentTile(); ! if (!action.isRelayBaseTokens() && !oldTile.relayBaseTokensOnUpgrade()) return; for (City oldCity : hex.getCities()) { --- 658,666 ---- */ protected void relayBaseTokens (LayTile action) { ! MapHex hex = action.getChosenHex(); TileI newTile = action.getLaidTile(); TileI oldTile = hex.getCurrentTile(); ! if (!action.isRelayBaseTokens() && !oldTile.relayBaseTokensOnUpgrade()) return; for (City oldCity : hex.getCities()) { *************** *** 663,667 **** // Assume only 1 token (no exceptions known) PublicCompanyI company = ((BaseToken)oldCity.getTokens().get(0)).getCompany(); ! List<String> prompts = new ArrayList<String>(); Map<String, Integer> promptToCityMap = new HashMap<String, Integer>(); --- 668,672 ---- // Assume only 1 token (no exceptions known) PublicCompanyI company = ((BaseToken)oldCity.getTokens().get(0)).getCompany(); ! List<String> prompts = new ArrayList<String>(); Map<String, Integer> promptToCityMap = new HashMap<String, Integer>(); *************** *** 703,707 **** /** * Lay Token finished. ! * * @param action The LayBonusToken action object of the laid token. */ --- 708,712 ---- /** * Lay Token finished. ! * * @param action The LayBonusToken action object of the laid token. */ *************** *** 1027,1030 **** --- 1032,1064 ---- } + /** Default implementation. + * The <Loans> attributes number and value <b>must</b> + * have been configured in CompanyManager.xml */ + protected void takeLoans(TakeLoans action) { + + if (action.getMaxNumber() == 1) { + + String message = LocalText.getText("PleaseConfirm"); + String prompt = LocalText.getText("TakeLoanPrompt", + action.getCompanyName(), + Bank.format(action.getPrice())); + if (JOptionPane.showConfirmDialog(orWindow, prompt, + message, JOptionPane.OK_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE) + == JOptionPane.OK_OPTION) { + action.setNumberTaken(1); + orWindow.process(action); + } + + } else { + // For now we disregard the case of multiple loans + } + + } + + protected void repayLoans () { + + } + public void updateStatus() { *************** *** 1037,1041 **** mapRelatedActions.clear(); ! orPanel.setHighlightsOff(); if (actionToComplete != null) { --- 1071,1075 ---- mapRelatedActions.clear(); ! orPanel.resetActions(); if (actionToComplete != null) { *************** *** 1124,1127 **** --- 1158,1165 ---- // discardTrain(); + + } else if (possibleActions.contains(TakeLoans.class)) { + + orPanel.enableLoanTaking (possibleActions.getType(TakeLoans.class).get(0)); } else if (orStep == OperatingRound.STEP_FINAL) { *************** *** 1130,1133 **** --- 1168,1175 ---- } + if (possibleActions.contains(TakeLoans.class)) { + orPanel.enableLoanTaking (possibleActions.getType(TakeLoans.class).get(0)); + } + setMapRelatedActions(mapRelatedActions); *************** *** 1184,1188 **** } } ! if (possibleActions.contains(ReachDestinations.class)) { orPanel.addSpecialAction(possibleActions.getType(ReachDestinations.class).get(0), --- 1226,1230 ---- } } ! if (possibleActions.contains(ReachDestinations.class)) { orPanel.addSpecialAction(possibleActions.getType(ReachDestinations.class).get(0), Index: GameStatus.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/GameStatus.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** GameStatus.java 28 Nov 2008 19:41:58 -0000 1.21 --- GameStatus.java 11 Jan 2009 17:24:46 -0000 1.22 *************** *** 1,41 **** package rails.ui.swing; ! import java.awt.Color; ! import java.awt.GridBagConstraints; ! import java.awt.GridBagLayout; ! import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; ! import java.util.ArrayList; ! import java.util.Arrays; ! import java.util.HashMap; import java.util.List; - import java.util.Map; ! import javax.swing.BorderFactory; ! import javax.swing.ButtonGroup; ! import javax.swing.JComponent; ! import javax.swing.JOptionPane; ! import javax.swing.JPanel; ! import javax.swing.UIManager; import org.apache.log4j.Logger; import rails.common.Defs; ! import rails.game.Bank; ! import rails.game.Player; ! import rails.game.Portfolio; ! import rails.game.PublicCertificateI; ! import rails.game.PublicCompanyI; ! import rails.game.action.BuyCertificate; ! import rails.game.action.NullAction; ! import rails.game.action.PossibleAction; ! import rails.game.action.PossibleActions; ! import rails.game.action.SellShares; ! import rails.game.action.StartCompany; ! import rails.ui.swing.elements.Caption; ! import rails.ui.swing.elements.ClickField; ! import rails.ui.swing.elements.Field; ! import rails.ui.swing.elements.RadioButtonDialog; import rails.util.LocalText; --- 1,18 ---- package rails.ui.swing; ! import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; ! import java.util.*; import java.util.List; ! import javax.swing.*; import org.apache.log4j.Logger; import rails.common.Defs; ! import rails.game.*; ! import rails.game.action.*; ! import rails.ui.swing.elements.*; import rails.util.LocalText; *************** *** 91,94 **** --- 68,73 ---- protected Field compPrivates[]; protected int compPrivatesXOffset, compPrivatesYOffset; + protected Field compLoans[]; + protected int compLoansXOffset, compLoansYOffset; protected Field playerCash[]; protected int playerCashXOffset, playerCashYOffset; *************** *** 122,126 **** //protected CompanyManagerI cm; protected Portfolio ipo, pool; ! protected GameUIManager gameUIManager; --- 101,105 ---- //protected CompanyManagerI cm; protected Portfolio ipo, pool; ! protected GameUIManager gameUIManager; *************** *** 131,134 **** --- 110,114 ---- protected boolean compCanHoldOwnShares = false; protected boolean compCanHoldForeignShares = false; // NOT YET USED + protected boolean hasCompanyLoans = false; private PublicCompanyI c; *************** *** 178,181 **** --- 158,162 ---- compCanBuyPrivates = gameUIManager.getCommonParameterAsBoolean(Defs.Parm.CAN_ANY_COMPANY_BUY_PRIVATES); compCanHoldOwnShares = gameUIManager.getCommonParameterAsBoolean(Defs.Parm.CAN_ANY_COMPANY_HOLD_OWN_SHARES); + hasCompanyLoans = gameUIManager.getCommonParameterAsBoolean(Defs.Parm.HAS_ANY_COMPANY_LOANS); ipo = Bank.getIpo(); *************** *** 199,202 **** --- 180,185 ---- compTokens = new Field[nc]; compPrivates = new Field[nc]; + compLoans = new Field[nc]; + playerCash = new Field[np]; playerPrivates = new Field[np]; *************** *** 236,239 **** --- 219,226 ---- compPrivatesYOffset = lastY; } + if (hasCompanyLoans) { + compLoansXOffset = ++lastX; + compLoansYOffset = lastY; + } rightCompCaptionXOffset = ++lastX; *************** *** 293,297 **** } addField(new Caption(LocalText.getText("COMPANY_DETAILS")), ! compCashXOffset, 0, this.compCanBuyPrivates ? 5 : 4, 1, 0); addField(new Caption(LocalText.getText("CASH")), compCashXOffset, 1, 1, 1, WIDE_BOTTOM); --- 280,285 ---- } addField(new Caption(LocalText.getText("COMPANY_DETAILS")), ! compCashXOffset, 0, 4 + (compCanBuyPrivates ? 1 : 0) ! + (hasCompanyLoans ? 1 : 0), 1, 0); addField(new Caption(LocalText.getText("CASH")), compCashXOffset, 1, 1, 1, WIDE_BOTTOM); *************** *** 306,309 **** --- 294,302 ---- compPrivatesXOffset, 1, 1, 1, WIDE_BOTTOM); } + if (hasCompanyLoans) { + addField (new Caption (LocalText.getText("LOANS")), + compLoansXOffset, 1, 1, 1, WIDE_BOTTOM); + } + addField(new Caption(LocalText.getText("COMPANY")), rightCompCaptionXOffset, 0, 1, 2, WIDE_LEFT + WIDE_BOTTOM); *************** *** 409,412 **** --- 402,409 ---- 0); } + if (hasCompanyLoans) { + f = compLoans[i] = new Field (c.getLoanValueModel()); + addField (f, compLoansXOffset, compLoansYOffset+i, 1, 1, 0); + } f = new Caption(c.getName()); *************** *** 640,644 **** buyAmounts.add(startPrices[0]); } ! } else { --- 637,641 ---- buyAmounts.add(startPrices[0]); } ! } else { *************** *** 719,723 **** if (chosenAction != null) ! ((StatusWindow) parent).process(chosenAction); repaint(); --- 716,720 ---- if (chosenAction != null) ! (parent).process(chosenAction); repaint(); *************** *** 810,814 **** if (nullActions != null) { for (NullAction na : nullActions) { ! ((StatusWindow) parent).setPassButton(na); } } --- 807,811 ---- if (nullActions != null) { for (NullAction na : nullActions) { ! (parent).setPassButton(na); } } Index: ORPanel.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORPanel.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** ORPanel.java 20 Nov 2008 21:49:38 -0000 1.27 --- ORPanel.java 11 Jan 2009 17:24:46 -0000 1.28 *************** *** 38,41 **** --- 38,43 ---- private static final String REDO_CMD = "Redo"; public static final String REM_TILES_CMD = "RemainingTiles"; + public static final String TAKE_LOANS_CMD = "TakeLoans"; + public static final String REPAY_LOANS_CMD = "RepayLoans"; ORWindow orWindow; *************** *** 49,52 **** --- 51,57 ---- private JMenuItem remainingTilesMenuItem; private JMenu specialMenu; + private JMenu loansMenu; + private ActionMenuItem takeLoans; + private ActionMenuItem repayLoans; private GridBagLayout gb; *************** *** 67,70 **** --- 72,77 ---- private int privatesXOffset, privatesYOffset; private Field newPrivatesCost[]; + private Field[] compLoans; + private int loansXOffset, loansYOffset; private Field tiles[]; private int tilesXOffset, tilesYOffset; *************** *** 85,91 **** private boolean privatesCanBeBought = false; private boolean bonusTokensExist = false; private Caption tileCaption, tokenCaption, revenueCaption, trainCaption, ! privatesCaption; private ActionButton button1; --- 92,99 ---- private boolean privatesCanBeBought = false; private boolean bonusTokensExist = false; + private boolean hasCompanyLoans = false; private Caption tileCaption, tokenCaption, revenueCaption, trainCaption, ! privatesCaption, loansCaption; private ActionButton button1; *************** *** 110,113 **** --- 118,123 ---- private PublicCompanyI orComp = null; + + private List<JMenuItem> menuItemsToReset = new ArrayList<JMenuItem>(); protected static Logger log = *************** *** 130,133 **** --- 140,144 ---- privatesCanBeBought = gameUIManager.getCommonParameterAsBoolean(Defs.Parm.CAN_ANY_COMPANY_BUY_PRIVATES); bonusTokensExist = gameUIManager.getCommonParameterAsBoolean(Defs.Parm.DO_BONUS_TOKENS_EXIST); + hasCompanyLoans = gameUIManager.getCommonParameterAsBoolean(Defs.Parm.HAS_ANY_COMPANY_LOANS); initButtonPanel(); *************** *** 159,167 **** specialMenu = new JMenu(LocalText.getText("SPECIAL")); ! specialMenu.setBackground(Color.YELLOW); // Normally not seen ! // because menu is not ! // opaque specialMenu.setEnabled(false); menuBar.add(specialMenu); add(menuBar, BorderLayout.NORTH); --- 170,197 ---- specialMenu = new JMenu(LocalText.getText("SPECIAL")); ! specialMenu.setBackground(Color.YELLOW); ! // Normally not seen because menu is not opaque specialMenu.setEnabled(false); menuBar.add(specialMenu); + + if (hasCompanyLoans) { + loansMenu = new JMenu (LocalText.getText("LOANS")); + specialMenu.setEnabled(true); + + takeLoans = new ActionMenuItem (LocalText.getText("TakeLoans")); + takeLoans.addActionListener(this); + takeLoans.setEnabled(false); + loansMenu.add(takeLoans); + menuItemsToReset.add(takeLoans); + + repayLoans = new ActionMenuItem (LocalText.getText("RepayLoans")); + repayLoans.addActionListener(this); + repayLoans.setEnabled(false); + loansMenu.add(repayLoans); + menuItemsToReset.add(repayLoans); + + menuBar.add(loansMenu); + } + add(menuBar, BorderLayout.NORTH); *************** *** 259,262 **** --- 289,293 ---- tokensLeft = new Field[nc]; if (bonusTokensExist) tokenBonus = new Field[nc]; + if (hasCompanyLoans) compLoans = new Field[nc]; revenue = new Field[nc]; revenueSelect = new Spinner[nc]; *************** *** 300,303 **** --- 331,341 ---- } + if (hasCompanyLoans) { + loansXOffset = currentXOffset += lastXWidth; + loansYOffset = leftCompNameYOffset; + addField (loansCaption = new Caption(LocalText.getText("LOANS")), + loansXOffset, 0, lastXWidth = 1, 2, WIDE_RIGHT); + } + tilesXOffset = currentXOffset += lastXWidth; tilesYOffset = leftCompNameYOffset; *************** *** 379,382 **** --- 417,425 ---- } + if (hasCompanyLoans) { + f = compLoans[i] = new Field (c.getLoanValueModel()); + addField (f, loansXOffset, loansYOffset + i, 1, 1, WIDE_RIGHT); + } + f = tiles[i] = new Field(c.getTilesLaidThisTurnModel()); addField(f, tilesXOffset, tilesYOffset + i, 1, 1, 0); *************** *** 502,506 **** } ! public void setHighlightsOff() { tileCaption.setHighlight(false); tokenCaption.setHighlight(false); --- 545,549 ---- } ! public void resetActions() { tileCaption.setHighlight(false); tokenCaption.setHighlight(false); *************** *** 511,514 **** --- 554,564 ---- president[i].setHighlight(false); } + + for (JMenuItem item : menuItemsToReset) { + item.setEnabled(false); + if (item instanceof ActionMenuItem) { + ((ActionMenuItem)item).clearPossibleActions(); + } + } } *************** *** 669,672 **** --- 719,727 ---- if (action != null) redoButton.setPossibleAction(action); } + + public void enableLoanTaking (TakeLoans action) { + if (action != null) takeLoans.addPossibleAction(action); + takeLoans.setEnabled(action != null); + } public void finishORCompanyTurn(int orCompIndex) { |
From: Erik V. <ev...@us...> - 2009-01-11 17:24:51
|
Update of /cvsroot/rails/18xx/rails/common In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv6543/rails/common Modified Files: Defs.java Log Message: Basic loans taking and specific rules for 1856. Index: Defs.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/common/Defs.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Defs.java 30 Jun 2008 20:36:02 -0000 1.1 --- Defs.java 11 Jan 2009 17:24:46 -0000 1.2 *************** *** 11,41 **** GAME_STATUS } ! private static EnumMap<Defs.ClassName, String> defaultClasses = new EnumMap<Defs.ClassName, String> (Defs.ClassName.class); ! static { ! defaultClasses.put (ClassName.OR_UI_MANAGER, "rails.ui.swing.ORUIManager"); ! defaultClasses.put (ClassName.STATUS_WINDOW, "rails.ui.swing.StatusWindow"); ! defaultClasses.put (ClassName.GAME_STATUS, "rails.ui.swing.GameStatus"); } ! public static String getDefaultClassName (ClassName key) { return defaultClasses.get(key); } ! /* Definitions for key/value pairs in the communication * between GameManager and GameUIManager. */ ! public enum Parm { ! HAS_ANY_PAR_PRICE, CAN_ANY_COMPANY_HOLD_OWN_SHARES, CAN_ANY_COMPANY_BUY_PRIVATES, ! DO_BONUS_TOKENS_EXIST } } --- 11,42 ---- GAME_STATUS } ! private static EnumMap<Defs.ClassName, String> defaultClasses = new EnumMap<Defs.ClassName, String> (Defs.ClassName.class); ! static { ! defaultClasses.put (ClassName.OR_UI_MANAGER, "rails.ui.swing.ORUIManager"); ! defaultClasses.put (ClassName.STATUS_WINDOW, "rails.ui.swing.StatusWindow"); ! defaultClasses.put (ClassName.GAME_STATUS, "rails.ui.swing.GameStatus"); } ! public static String getDefaultClassName (ClassName key) { return defaultClasses.get(key); } ! /* Definitions for key/value pairs in the communication * between GameManager and GameUIManager. */ ! public enum Parm { ! HAS_ANY_PAR_PRICE, CAN_ANY_COMPANY_HOLD_OWN_SHARES, CAN_ANY_COMPANY_BUY_PRIVATES, ! DO_BONUS_TOKENS_EXIST, ! HAS_ANY_COMPANY_LOANS } } |
From: Erik V. <ev...@us...> - 2009-01-11 17:23:34
|
Update of /cvsroot/rails/18xx/rails/util In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv6476/rails/util Modified Files: LocalText.java Log Message: Changed multi-parameter constructor to use varargs Index: LocalText.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/util/LocalText.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** LocalText.java 4 Jun 2008 19:00:39 -0000 1.5 --- LocalText.java 11 Jan 2009 17:23:21 -0000 1.6 *************** *** 26,30 **** public static String getText(String key) { ! return getText(key, null); } --- 26,30 ---- public static String getText(String key) { ! return getText(key, (Object[]) null); } *************** *** 32,37 **** return getText(key, new Object[] { parameter }); } ! ! public static String getText(String key, Object[] parameters) { String result = ""; --- 32,38 ---- return getText(key, new Object[] { parameter }); } ! ! //public static String getText(String key, Object[] parameters) { ! public static String getText(String key, Object... parameters) { String result = ""; |
From: Erik V. <ev...@us...> - 2009-01-08 19:59:51
|
Update of /cvsroot/rails/18xx/rails/game/action In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv15164/rails/game/action Modified Files: BuyOrBidStartItem.java Log Message: Start item status tooltips & colours Index: BuyOrBidStartItem.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/action/BuyOrBidStartItem.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** BuyOrBidStartItem.java 4 Jun 2008 19:00:29 -0000 1.10 --- BuyOrBidStartItem.java 8 Jan 2009 19:59:39 -0000 1.11 *************** *** 1,4 **** /* $Header$ ! * * Created on 17-Sep-2006 * Change Log: --- 1,4 ---- /* $Header$ ! * * Created on 17-Sep-2006 * Change Log: *************** *** 22,30 **** private boolean sharePriceToSet = false; private String companyNeedingSharePrice = null; ! /** ! * Selectable means that a player can select but not buy it. In this case ! * "Pass" means "Select but no buy". ! */ ! private boolean selectable = false; private int type; --- 22,26 ---- private boolean sharePriceToSet = false; private String companyNeedingSharePrice = null; ! /** Unused but retained to keep old saved files loadable */ private int type; *************** *** 50,61 **** public static final int SET_SHARE_PRICE = 6; - public static final String[] typeNames = - new String[] { "", "BuyImmediate", "SelectAndBuy", "BidImmediate", - "SelectAndBid", "SelectAndBidOrPass", "SetSharePrice" }; - public static final long serialVersionUID = 2L; /** ! * */ public BuyOrBidStartItem(StartItem startItem, int priceOrMinimumBid, --- 46,53 ---- public static final int SET_SHARE_PRICE = 6; public static final long serialVersionUID = 2L; /** ! * */ public BuyOrBidStartItem(StartItem startItem, int priceOrMinimumBid, *************** *** 68,73 **** this.priceOrMinimumBid = priceOrMinimumBid; - setType(type); - PublicCompanyI company; if ((company = startItem.needsPriceSetting()) != null) { --- 60,63 ---- *************** *** 88,102 **** } - /** @deprecated */ - /* ???? */ - public BuyOrBidStartItem setSelectable(boolean value) { - selectable = value; - return this; - } - - public boolean isSelectable() { - return selectable; - } - public int getBidIncrement() { return bidIncrement; --- 78,81 ---- *************** *** 135,152 **** } ! /** @deprecated */ ! public int getStatus() { ! // if (startItem == null) return 0;//BAD ! return startItem.getStatus(); ! } ! ! public int getType() { ! return type; ! } ! ! public void setType(int type) { ! this.type = type; ! } ! public boolean equals(PossibleAction action) { if (!(action instanceof BuyOrBidStartItem)) return false; --- 114,118 ---- } ! @Override public boolean equals(PossibleAction action) { if (!(action instanceof BuyOrBidStartItem)) return false; *************** *** 156,167 **** } public String toString() { StringBuffer b = new StringBuffer(); ! b.append("BuyOrBidStartItem ").append(startItemName).append(" type=").append( ! typeNames[type]).append(" status="); ! if (selectable) b.append("Selectable/"); b.append(startItem.getStatusName()); ! switch (getStatus()) { case StartItem.BIDDABLE: b.append(" minbid=").append(priceOrMinimumBid).append(" bid=").append( --- 122,132 ---- } + @Override public String toString() { StringBuffer b = new StringBuffer(); ! b.append("BuyOrBidStartItem ").append(startItemName).append(" status="); b.append(startItem.getStatusName()); ! switch (startItem.getStatus()) { case StartItem.BIDDABLE: b.append(" minbid=").append(priceOrMinimumBid).append(" bid=").append( |
From: Erik V. <ev...@us...> - 2009-01-08 19:59:51
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv15164/rails/ui/swing Modified Files: StartRoundWindow.java Log Message: Start item status tooltips & colours Index: StartRoundWindow.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/StartRoundWindow.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** StartRoundWindow.java 7 Jan 2009 21:03:24 -0000 1.28 --- StartRoundWindow.java 8 Jan 2009 19:59:39 -0000 1.29 *************** *** 33,36 **** --- 33,40 ---- private static final int WIDE_BOTTOM = 8; + private static final Color buyableColour = new Color (0, 128, 0); + private static final Color soldColour = new Color (128, 128, 128); + private static final Color defaultColour = Color.BLACK; + private final JPanel statusPanel; private final JPanel buttonPanel; *************** *** 55,58 **** --- 59,63 ---- private Field info[]; private int infoXOffset, infoYOffset; + private Field itemStatus[]; // Remains invisible, only used for status tooltip private Caption[] upperPlayerCaption; *************** *** 80,83 **** --- 85,94 ---- private JComponent f; + /** @see StartItem.statusName */ + public static final String[] itemStatusTextKeys = + new String[] { "Status_Unavailable", "Status_Biddable", "Status_Buyable", + "Status_Selectable", "Status_Auctioned", + "Status_NeedingSharePrice", "Status_Sold" }; + // Current state private int playerIndex = -1; *************** *** 190,193 **** --- 201,205 ---- bidPerPlayer = new Field[ni][np]; info = new Field[ni]; + itemStatus = new Field[ni]; upperPlayerCaption = new Caption[np]; lowerPlayerCaption = new Caption[np]; *************** *** 267,272 **** f = info[i] = new Field (infoIcon); ! f.setToolTipText(getStartItemDescription(items[i])); addField (f, infoXOffset, infoYOffset + i, 1, 1, WIDE_LEFT); } --- 279,287 ---- f = info[i] = new Field (infoIcon); ! f.setToolTipText(getStartItemDescription(si)); addField (f, infoXOffset, infoYOffset + i, 1, 1, WIDE_LEFT); + + // Invisible field, only used to hold current item status. + f = itemStatus[i] = new Field (si.getStatusModel()); } *************** *** 381,385 **** buyButton.setPossibleAction(action); } else { ! itemNameButton[i].setToolTipText(LocalText.getText("ClickToSelectForBuying")); itemNameButton[i].setPossibleAction(action); } --- 396,400 ---- buyButton.setPossibleAction(action); } else { ! //itemNameButton[i].setToolTipText(LocalText.getText("ClickToSelectForBuying")); itemNameButton[i].setPossibleAction(action); } *************** *** 423,427 **** spinnerModel.setValue(mb); } else { ! itemNameButton[i].setToolTipText(LocalText.getText("ClickToSelectForBidding")); itemNameButton[i].setPossibleAction(action); } --- 438,442 ---- spinnerModel.setValue(mb); } else { ! //itemNameButton[i].setToolTipText(LocalText.getText("ClickToSelectForBidding")); itemNameButton[i].setPossibleAction(action); } *************** *** 627,635 **** private void setItemNameButton(int i, boolean clickable) { itemName[i].setVisible(!clickable); itemNameButton[i].setVisible(clickable); } ! private String getStartItemDescription (StartItem item) { StringBuffer b = new StringBuffer("<html>"); b.append (item.getPrimary().toString()); --- 642,662 ---- private void setItemNameButton(int i, boolean clickable) { + itemName[i].setVisible(!clickable); itemNameButton[i].setVisible(clickable); + + int status = Integer.parseInt(itemStatus[i].getText()); + String tooltip = LocalText.getText(itemStatusTextKeys[status]); + + itemName[i].setToolTipText(clickable ? "" : tooltip); + itemNameButton[i].setToolTipText(clickable ? tooltip : ""); + + itemName[i].setForeground ( + status == StartItem.SOLD ? soldColour : defaultColour); + itemNameButton[i].setForeground ( + status == StartItem.BUYABLE ? buyableColour : defaultColour); } ! private String getStartItemDescription (StartItem item) { StringBuffer b = new StringBuffer("<html>"); b.append (item.getPrimary().toString()); |
From: Erik V. <ev...@us...> - 2009-01-08 19:59:50
|
Update of /cvsroot/rails/18xx In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv15164 Modified Files: LocalisedText.properties Log Message: Start item status tooltips & colours Index: LocalisedText.properties =================================================================== RCS file: /cvsroot/rails/18xx/LocalisedText.properties,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** LocalisedText.properties 3 Jan 2009 22:51:44 -0000 1.63 --- LocalisedText.properties 8 Jan 2009 19:59:39 -0000 1.64 *************** *** 74,79 **** ClassCannotBeInstantiated=Class {0} cannot be instantiated ClickForSell=Click to select for selling - ClickToBuy=Click to buy - ClickToSelectForBidding=Click to select for bidding ClickToSelectForBuying=Click to select for buying CompanyAlreadyStarted={0} has already been started. --- 74,77 ---- *************** *** 319,323 **** StartOfPhase=Start of phase {0}. StartPacketHasNoClass=Start packet {0} has no class defined. ! StartStockRound=Start of Stock Round StockSpaceHasNoPrice=Stock space {0} has no price defined. StockSpaceIsConfiguredTwice=Stock space {0} is configured twice. --- 317,328 ---- StartOfPhase=Start of phase {0}. StartPacketHasNoClass=Start packet {0} has no class defined. ! StartStockRound=Start of Stock Round ! Status_Unavailable=Currently unavailable ! Status_Biddable=Click to bid on this item ! Status_Buyable=Click to buy this item ! Status_Selectable=Click to select for auctioning ! Status_Auctioned=Being auctioned ! Status_NeedingSharePrice=Needs a share price to be set ! Status_Sold=Already sold StockSpaceHasNoPrice=Stock space {0} has no price defined. StockSpaceIsConfiguredTwice=Stock space {0} is configured twice. |
From: Erik V. <ev...@us...> - 2009-01-08 19:59:45
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv15164/rails/game Modified Files: StartRound_1830.java StartItem.java StartRound_1835.java StartRound.java Log Message: Start item status tooltips & colours Index: StartRound_1830.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StartRound_1830.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** StartRound_1830.java 23 Dec 2008 19:58:36 -0000 1.16 --- StartRound_1830.java 8 Jan 2009 19:59:39 -0000 1.17 *************** *** 2,7 **** package rails.game; - import java.util.List; - import rails.game.action.*; import rails.game.move.MoveSet; --- 2,5 ---- *************** *** 156,168 **** } - /** - * Return the start items, marked as appropriate for an 1830-style auction. - */ - @Override - public List<StartItem> getStartItems() { - - return itemsToSell; - } - /*----- MoveSet methods -----*/ /** --- 154,157 ---- Index: StartItem.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StartItem.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** StartItem.java 7 Jan 2009 21:03:24 -0000 1.15 --- StartItem.java 8 Jan 2009 19:59:39 -0000 1.16 *************** *** 47,60 **** public static final int BIDDABLE = 1; public static final int BUYABLE = 2; ! public static final int AUCTIONED = 3; ! public static final int NEEDS_SHARE_PRICE = 4; // TODO No longer used (may // not be true after // bidding), needs code // cleanup ! public static final int SOLD = 5; public static final String[] statusName = ! new String[] { "Unavailable", "Biddable", "Buyable", "Auctioned", ! "NeedingSharePrice", "Sold" }; // For initialisation purposes only --- 47,61 ---- public static final int BIDDABLE = 1; public static final int BUYABLE = 2; ! public static final int SELECTABLE = 3; ! public static final int AUCTIONED = 4; ! public static final int NEEDS_SHARE_PRICE = 5; // TODO No longer used (may // not be true after // bidding), needs code // cleanup ! public static final int SOLD = 6; public static final String[] statusName = ! new String[] { "Unavailable", "Biddable", "Buyable", "Selectable", ! "Auctioned", "NeedingSharePrice", "Sold" }; // For initialisation purposes only *************** *** 466,469 **** --- 467,474 ---- } + public ModelObject getStatusModel () { + return status; + } + public String getStatusName() { return statusName[status.intValue()]; *************** *** 506,508 **** --- 511,517 ---- } + public String getText () { + return toString(); + } + } Index: StartRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StartRound.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** StartRound.java 23 Dec 2008 19:59:06 -0000 1.22 --- StartRound.java 8 Jan 2009 19:59:39 -0000 1.23 *************** *** 328,337 **** /** ! * Get a list of items that may be bought immediately. * * @return An array of start items, possibly empry. */ ! public abstract List<StartItem> getStartItems(); /** --- 328,340 ---- /** ! * Get the current list of start items. * * @return An array of start items, possibly empry. */ ! public List<StartItem> getStartItems() { ! ! return itemsToSell; ! } /** Index: StartRound_1835.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StartRound_1835.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** StartRound_1835.java 4 Jan 2009 13:09:27 -0000 1.17 --- StartRound_1835.java 8 Jan 2009 19:59:39 -0000 1.18 *************** *** 146,186 **** } - @Override - public List<StartItem> getStartItems() { - Player currentPlayer = getCurrentPlayer(); - int cashToSpend = currentPlayer.getCash(); - // List<StartItem> startItems = startPacket.getItems(); - int row; - int minRow = 0; - int items = 0; - - // for (StartItem item : startItems) - for (StartItem item : itemsToSell) { - if (item.isSold()) { - item.setStatus(StartItem.SOLD); - } else if (item.getBasePrice() > cashToSpend) { - item.setStatus(StartItem.UNAVAILABLE); - } else if (variant.equalsIgnoreCase(CLEMENS_VARIANT)) { - item.setStatus(StartItem.BUYABLE); - } else { - row = item.getRow(); - if (minRow == 0) minRow = row; - if (row == minRow) { - // Allow all items in the top row. - item.setStatus(StartItem.BUYABLE); - items++; - } else if (row == minRow + 1 && items == 1) { - // Allow the first item in the next row if the - // top row has only one item. - item.setStatus(StartItem.BUYABLE); - } else { - item.setStatus(StartItem.UNAVAILABLE); - } - } - } - - return itemsToSell; - } - /*----- MoveSet methods -----*/ --- 146,149 ---- |
From: Erik V. <ev...@us...> - 2009-01-08 19:59:45
|
Update of /cvsroot/rails/18xx/rails/game/specific/_18EU In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv15164/rails/game/specific/_18EU Modified Files: StartRound_18EU.java Log Message: Start item status tooltips & colours Index: StartRound_18EU.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_18EU/StartRound_18EU.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** StartRound_18EU.java 23 Dec 2008 19:59:06 -0000 1.5 --- StartRound_18EU.java 8 Jan 2009 19:59:39 -0000 1.6 *************** *** 2,7 **** package rails.game.specific._18EU; - import java.util.List; - import rails.game.*; import rails.game.action.*; --- 2,5 ---- *************** *** 56,66 **** } - /** - * Get a list of items that may be bought immediately. <p> In an 1835-style - * auction this method will usually return several items. - * - * @return An array of start items that can be bought. - */ - // public StartItem[] getBuyableItems() {return null;} @Override public boolean setPossibleActions() { --- 54,57 ---- *************** *** 74,78 **** switch (getStep()) { case SELECT_STEP: ! // In the selection step, all not yet sold items are buyable. // The current player MUST select an item, // and may then bid for it or pass. --- 65,69 ---- switch (getStep()) { case SELECT_STEP: ! // In the selection step, all not yet sold items are selectable. // The current player MUST select an item, // and may then bid for it or pass. *************** *** 83,87 **** for (StartItem item : itemsToSell) { if (!item.isSold()) { ! item.setStatus(StartItem.BIDDABLE); item.setMinimumBid(item.getBasePrice()); BidStartItem possibleAction = --- 74,78 ---- for (StartItem item : itemsToSell) { if (!item.isSold()) { ! item.setStatus(StartItem.SELECTABLE); item.setMinimumBid(item.getBasePrice()); BidStartItem possibleAction = *************** *** 89,93 **** startPacket.getModulus(), false, true); possibleActions.add(possibleAction); - // /item.setStatus (StartItem.BIDDABLE); } } --- 80,83 ---- *************** *** 122,130 **** @Override - public List<StartItem> getStartItems() { - return startPacket.getItems(); - } - - @Override protected boolean buy(String playerName, BuyStartItem boughtItem) { StartItem item = boughtItem.getStartItem(); --- 112,115 ---- *************** *** 137,141 **** // Is the item buyable? ! if (status == StartItem.BUYABLE) { price = currentBuyPrice.intValue(); } else { --- 122,126 ---- // Is the item buyable? ! if (status == StartItem.AUCTIONED && currentStep.intValue() == BUY_STEP) { price = currentBuyPrice.intValue(); } else { *************** *** 144,148 **** } ! if (status == StartItem.BUYABLE && player.getFreeCash() < price) { errMsg = LocalText.getText("NoMoney"); break; --- 129,133 ---- } ! if (player.getFreeCash() < price) { errMsg = LocalText.getText("NoMoney"); break; *************** *** 247,250 **** --- 232,240 ---- currentAuctionItem.set(item); item.setStatus(StartItem.AUCTIONED); + for (StartItem item2 : itemsToSell) { + if (item2 != item && !item2.isSold()) { + item2.setStatus(StartItem.UNAVAILABLE); + } + } if (bidAmount == -1) { setStep(OPEN_STEP); *************** *** 314,320 **** Bank.format(currentBuyPrice.intValue()) })); setStep(BUY_STEP); ! if (auctionedItem.getStatus() != StartItem.BUYABLE) { ! auctionedItem.setStatus(StartItem.BUYABLE); ! } if (currentBuyPrice.intValue() == 0) { // Forced buy --- 304,310 ---- Bank.format(currentBuyPrice.intValue()) })); setStep(BUY_STEP); ! //if (auctionedItem.getStatus() != StartItem.BUYABLE) { ! // auctionedItem.setStatus(StartItem.BUYABLE); ! //} if (currentBuyPrice.intValue() == 0) { // Forced buy |
From: Erik V. <ev...@us...> - 2009-01-07 21:03:36
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20068/rails/game Modified Files: StartItem.java Log Message: Added start packet item info to the StartRoundWindow. Index: StartItem.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StartItem.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** StartItem.java 23 Dec 2008 19:57:47 -0000 1.14 --- StartItem.java 7 Jan 2009 21:03:24 -0000 1.15 *************** *** 2,8 **** package rails.game; ! import java.util.HashMap; ! import java.util.List; ! import java.util.Map; import org.apache.log4j.Logger; --- 2,6 ---- package rails.game; ! import java.util.*; import org.apache.log4j.Logger; *************** *** 10,14 **** import rails.game.model.ModelObject; import rails.game.model.MoneyModel; ! import rails.game.state.*; /** --- 8,12 ---- import rails.game.model.ModelObject; import rails.game.model.MoneyModel; ! import rails.game.state.IntegerState; /** *************** *** 82,86 **** * certificate. The parameters are only stored, real initialisation is done * by the init() method. ! * * @param name The Company name of the primary certificate. This name will * also become the name of the start item itself. --- 80,84 ---- * certificate. The parameters are only stored, real initialisation is done * by the init() method. ! * * @param name The Company name of the primary certificate. This name will * also become the name of the start item itself. *************** *** 109,113 **** /** * Add a secondary certificate, that "comes with" the primary certificate. ! * * @param name2 The Company name of the secondary certificate. * @param type2 The CompanyType name of the secondary certificate. --- 107,111 ---- /** * Add a secondary certificate, that "comes with" the primary certificate. ! * * @param name2 The Company name of the secondary certificate. * @param type2 The CompanyType name of the secondary certificate. *************** *** 184,188 **** * Set the start packet row. <p> Applies to games like 1835 where start * items are organised and become available in rows. ! * * @param row */ --- 182,186 ---- * Set the start packet row. <p> Applies to games like 1835 where start * items are organised and become available in rows. ! * * @param row */ *************** *** 194,198 **** * Set the start packet row. <p> Applies to games like 1837 where start * items are organised and become available in columns. ! * * @param row */ --- 192,196 ---- * Set the start packet row. <p> Applies to games like 1837 where start * items are organised and become available in columns. ! * * @param row */ *************** *** 203,207 **** /** * Get the row number. ! * * @see setRow() * @return The row number. Default 0. --- 201,205 ---- /** * Get the row number. ! * * @see setRow() * @return The row number. Default 0. *************** *** 213,217 **** /** * Get the column number. ! * * @see setColumn() * @return The column number. Default 0. --- 211,215 ---- /** * Get the column number. ! * * @see setColumn() * @return The column number. Default 0. *************** *** 223,227 **** /** * Get the primary (or only) certificate. ! * * @return The primary certificate object. */ --- 221,225 ---- /** * Get the primary (or only) certificate. ! * * @return The primary certificate object. */ *************** *** 232,236 **** /** * Check if there is a secondary certificate. ! * * @return True if there is a secondary certificate. */ --- 230,234 ---- /** * Check if there is a secondary certificate. ! * * @return True if there is a secondary certificate. */ *************** *** 241,245 **** /** * Get the secondary certificate. ! * * @return The secondary certificate object, or null if it does not exist. */ --- 239,243 ---- /** * Get the secondary certificate. ! * * @return The secondary certificate object, or null if it does not exist. */ *************** *** 250,254 **** /** * Get the start item base price. ! * * @return The base price. */ --- 248,252 ---- /** * Get the start item base price. ! * * @return The base price. */ *************** *** 264,268 **** * Get the start item name (which is the company name of the primary * certificate). ! * * @return The start item name. */ --- 262,266 ---- * Get the start item name (which is the company name of the primary * certificate). ! * * @return The start item name. */ *************** *** 274,278 **** * Register a bid. <p> This method does <b>not</b> check off the amount of * money that a player has available for bidding. ! * * @param amount The bid amount. * @param bidder The bidding player. --- 272,276 ---- * Register a bid. <p> This method does <b>not</b> check off the amount of * money that a player has available for bidding. ! * * @param amount The bid amount. * @param bidder The bidding player. *************** *** 298,302 **** /** * Get the currently highest bid amount. ! * * @return The bid amount (0 if there have been no bids yet). */ --- 296,300 ---- /** * Get the currently highest bid amount. ! * * @return The bid amount (0 if there have been no bids yet). */ *************** *** 312,316 **** /** * Get the highest bid done so far by a particular player. ! * * @param player The name of the player. * @return The bid amount for this player (default 0). --- 310,314 ---- /** * Get the highest bid done so far by a particular player. ! * * @param player The name of the player. * @return The bid amount for this player (default 0). *************** *** 324,328 **** * Return the total number of players that has done bids so far on this * item. ! * * @return The number of bidders. */ --- 322,326 ---- * Return the total number of players that has done bids so far on this * item. ! * * @return The number of bidders. */ *************** *** 337,341 **** /** * Get the highest bidder so far. ! * * @return The player object that did the highest bid. */ --- 335,339 ---- /** * Get the highest bidder so far. ! * * @return The player object that did the highest bid. */ *************** *** 351,355 **** /** * Get the minimum allowed next bid. TODO 5 should be configurable. ! * * @return Minimum bid */ --- 349,353 ---- /** * Get the minimum allowed next bid. TODO 5 should be configurable. ! * * @return Minimum bid */ *************** *** 364,368 **** /** * Check if a player has done any bids on this start item. ! * * @param playerName The name of the player. * @return True if this player has done any bids. --- 362,366 ---- /** * Check if a player has done any bids on this start item. ! * * @param playerName The name of the player. * @return True if this player has done any bids. *************** *** 376,380 **** /** * Get the last Bid done by a given player. ! * * @param playerName The name of the player. * @return His latest Bid object. --- 374,378 ---- /** * Get the last Bid done by a given player. ! * * @param playerName The name of the player. * @return His latest Bid object. *************** *** 388,392 **** /** * Check if the start item has been sold. ! * * @return True if this item has been sold. */ --- 386,390 ---- /** * Check if the start item has been sold. ! * * @return True if this item has been sold. */ *************** *** 397,401 **** /** * Set the start item sold status. ! * * @param sold The new sold status (usually true). */ --- 395,399 ---- /** * Set the start item sold status. ! * * @param sold The new sold status (usually true). */ *************** *** 423,427 **** * price immediately, so bypassing the extra "price asking" intermediate * step. ! * * @return A public company for which a price must be set. */ --- 421,425 ---- * price immediately, so bypassing the extra "price asking" intermediate * step. ! * * @return A public company for which a price must be set. */ *************** *** 442,446 **** * If a start item component a President's certificate that needs price * setting, return the name of thecompany for which the price must be set. ! * * @param certificate * @return Name of public company, or null --- 440,444 ---- * If a start item component a President's certificate that needs price * setting, return the name of thecompany for which the price must be set. ! * * @param certificate * @return Name of public company, or null *************** *** 477,489 **** public ModelObject getBasePriceModel() { ! return (ModelObject) basePrice; } public ModelObject getBidForPlayerModel(int index) { ! return (ModelObject) bids[index]; } public ModelObject getMinimumBidModel() { ! return (ModelObject) minimumBid; } --- 475,487 ---- public ModelObject getBasePriceModel() { ! return basePrice; } public ModelObject getBidForPlayerModel(int index) { ! return bids[index]; } public ModelObject getMinimumBidModel() { ! return minimumBid; } *************** *** 502,506 **** && this.type.equals(item.getType()); } ! public String toString() { return ("StartItem "+name+" status="+statusName[status.intValue()]); --- 500,505 ---- && this.type.equals(item.getType()); } ! ! @Override public String toString() { return ("StartItem "+name+" status="+statusName[status.intValue()]); |
From: Erik V. <ev...@us...> - 2009-01-07 21:03:35
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20068/rails/ui/swing Modified Files: StartRoundWindow.java Log Message: Added start packet item info to the StartRoundWindow. Index: StartRoundWindow.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/StartRoundWindow.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** StartRoundWindow.java 11 Dec 2008 20:12:30 -0000 1.27 --- StartRoundWindow.java 7 Jan 2009 21:03:24 -0000 1.28 *************** *** 13,16 **** --- 13,17 ---- import rails.game.*; import rails.game.action.*; + import rails.game.special.SpecialPropertyI; import rails.ui.swing.elements.*; import rails.util.LocalText; *************** *** 52,55 **** --- 53,58 ---- private Field playerFree[]; private int playerFreeCashXOffset, playerFreeCashYOffset; + private Field info[]; + private int infoXOffset, infoYOffset; private Caption[] upperPlayerCaption; *************** *** 62,65 **** --- 65,70 ---- private final ActionButton passButton; + private ImageIcon infoIcon = null; + private final int np; // Number of players private final int ni; // Number of start items *************** *** 157,160 **** --- 162,167 ---- actionableItems = new StartItemAction[ni]; + infoIcon = createInfoIcon(); + init(); *************** *** 182,185 **** --- 189,193 ---- minBid = new Field[ni]; bidPerPlayer = new Field[ni][np]; + info = new Field[ni]; upperPlayerCaption = new Caption[np]; lowerPlayerCaption = new Caption[np]; *************** *** 200,203 **** --- 208,214 ---- bidPerPlayerYOffset = lastY; + infoXOffset = bidPerPlayerXOffset + np; + infoYOffset = lastY; + // Bottom rows lastY += (ni - 1); *************** *** 254,257 **** --- 265,272 ---- 1, 1, 0); } + + f = info[i] = new Field (infoIcon); + f.setToolTipText(getStartItemDescription(items[i])); + addField (f, infoXOffset, infoYOffset + i, 1, 1, WIDE_LEFT); } *************** *** 616,619 **** --- 631,676 ---- } + private String getStartItemDescription (StartItem item) { + StringBuffer b = new StringBuffer("<html>"); + b.append (item.getPrimary().toString()); + if (item.getPrimary() instanceof PrivateCompany) { + PrivateCompany priv = (PrivateCompany) item.getPrimary(); + b.append ("<br>Revenue: ").append(Bank.format(priv.getRevenue())); + List<MapHex> blockedHexes = priv.getBlockedHexes(); + if (blockedHexes == null) { + } else if (blockedHexes.size() == 1) { + b.append("<br>Blocked hex: ").append(blockedHexes.get(0).getName()); + } else if (blockedHexes.size() > 1) { + b.append("<br>Blocked hexes:"); + for (MapHex hex : blockedHexes) { + b.append(" ").append(hex.getName()); + } + } + if (priv.hasSpecialProperties()) { + b.append("<br><b>Special properties:</b>"); + for (SpecialPropertyI sp : priv.getSpecialProperties()) { + b.append("<br>").append(sp.toString()); + } + } + } + if (item.getSecondary() != null) { + b.append("<br><b>Also contains:</b><br>"); + b.append(item.getSecondary().toString()); + } + return b.toString(); + } + + private ImageIcon createInfoIcon() { + + String path = "/rails/ui/images/Inform.gif"; + java.net.URL imgURL = getClass().getResource(path); + if (imgURL != null) { + return new ImageIcon(imgURL, "Info"); + } else { + System.err.println("Couldn't find file: " + path); + return null; + } + } + public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_F1) { |
From: Erik V. <ev...@us...> - 2009-01-07 21:03:35
|
Update of /cvsroot/rails/18xx/rails/ui/images In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20068/rails/ui/images Added Files: Inform.gif Log Message: Added start packet item info to the StartRoundWindow. --- NEW FILE: Inform.gif --- (This appears to be a binary file; contents omitted.) |
From: Erik V. <ev...@us...> - 2009-01-07 21:03:34
|
Update of /cvsroot/rails/18xx/rails/ui/swing/elements In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20068/rails/ui/swing/elements Modified Files: Field.java Log Message: Added start packet item info to the StartRoundWindow. Index: Field.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/elements/Field.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Field.java 4 Jun 2008 19:00:39 -0000 1.7 --- Field.java 7 Jan 2009 21:03:24 -0000 1.8 *************** *** 6,13 **** import java.util.Observable; ! import javax.swing.BorderFactory; ! import javax.swing.ImageIcon; ! import javax.swing.JLabel; ! import javax.swing.SwingConstants; import javax.swing.border.Border; --- 6,10 ---- import java.util.Observable; ! import javax.swing.*; import javax.swing.border.Border; *************** *** 37,40 **** --- 34,45 ---- } + public Field(ImageIcon info) { + super(info); + this.setBackground(NORMAL_BG_COLOUR); + this.setHorizontalAlignment(SwingConstants.CENTER); + this.setBorder(labelBorder); + this.setOpaque(true); + } + public Field(ModelObject modelObject) { this(modelObject.getText()); *************** *** 73,79 **** /** This method is mainly needed when NOT using the Observer pattern. */ public void paintComponent(Graphics g) { if (modelObject != null && (pull || !StatusWindow.useObserver)) { ! setText((String) modelObject.getText()); } super.paintComponent(g); --- 78,85 ---- /** This method is mainly needed when NOT using the Observer pattern. */ + @Override public void paintComponent(Graphics g) { if (modelObject != null && (pull || !StatusWindow.useObserver)) { ! setText(modelObject.getText()); } super.paintComponent(g); |
From: Erik V. <ev...@us...> - 2009-01-07 21:03:30
|
Update of /cvsroot/rails/18xx/rails/ui/images In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20059/rails/ui/images Log Message: Directory /cvsroot/rails/18xx/rails/ui/images added to the repository |
From: Erik V. <ev...@us...> - 2009-01-04 13:09:32
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv26093/rails/game Modified Files: StartRound_1835.java Log Message: Fix the previous fix (first item on next row was also set to buyable when the previous row had more than one item left). Index: StartRound_1835.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StartRound_1835.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** StartRound_1835.java 3 Jan 2009 22:49:59 -0000 1.16 --- StartRound_1835.java 4 Jan 2009 13:09:27 -0000 1.17 *************** *** 71,75 **** int items = 0; int minRow = 0; - int prevRow = 0; /* --- 71,74 ---- *************** *** 87,95 **** } else { row = item.getRow(); - if (row > prevRow) { - items = 0; - prevRow = row; - } - items++; if (minRow == 0) minRow = row; if (row == minRow) { --- 86,89 ---- *************** *** 103,106 **** --- 97,101 ---- } if (buyable) { + items++; item.setStatus(StartItem.BUYABLE); buyableItems.add(item); |
From: Mark J S. <kr...@us...> - 2009-01-03 22:51:49
|
Update of /cvsroot/rails/18xx In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv12504/18xx Modified Files: LocalisedText.properties Log Message: Update OR Window Title to show 'Operating Round #.# of #, where the last # is the total number of Operating Rounds to be performed before going back to the Stock Round. Index: LocalisedText.properties =================================================================== RCS file: /cvsroot/rails/18xx/LocalisedText.properties,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** LocalisedText.properties 11 Dec 2008 20:10:25 -0000 1.62 --- LocalisedText.properties 3 Jan 2009 22:51:44 -0000 1.63 *************** *** 184,188 **** MAP=Map MapWindowTitle=Rails: Map ! MapWindowORTitle=Rails: Map, Operating Round {0} MARKET=Stock Market MayNotBuyAndSell={0} may not both buy and sell shares --- 184,188 ---- MAP=Map MapWindowTitle=Rails: Map ! MapWindowORTitle=Rails: Map, Operating Round {0} or {1} MARKET=Stock Market MayNotBuyAndSell={0} may not both buy and sell shares |
From: Mark J S. <kr...@us...> - 2009-01-03 22:51:43
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv12477/18xx/rails/game Modified Files: GameManager.java Log Message: Update OR Window Title to show 'Operating Round #.# of #, where the last # is the total number of Operating Rounds to be performed before going back to the Stock Round. Index: GameManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/GameManager.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** GameManager.java 23 Dec 2008 19:54:14 -0000 1.37 --- GameManager.java 3 Jan 2009 22:51:35 -0000 1.38 *************** *** 476,483 **** */ public String getCompositeORNumber() { ! return srNumber.intValue() + "." ! + relativeORNumber.intValue(); } /* (non-Javadoc) * @see rails.game.GameManagerI#getSRNumber() --- 476,486 ---- */ public String getCompositeORNumber() { ! return srNumber.intValue() + "." + relativeORNumber.intValue(); } + public String getNumOfORs () { + return new Integer(numOfORs).toString(); + } + /* (non-Javadoc) * @see rails.game.GameManagerI#getSRNumber() |
From: Mark J S. <kr...@us...> - 2009-01-03 22:51:28
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv12432/18xx/rails/ui/swing Modified Files: ORWindow.java Log Message: Update OR Window Title to show 'Operating Round #.# of #, where the last # is the total number of Operating Rounds to be performed before going back to the Stock Round. Index: ORWindow.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORWindow.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** ORWindow.java 11 Dec 2008 20:10:25 -0000 1.20 --- ORWindow.java 3 Jan 2009 22:51:16 -0000 1.21 *************** *** 16,19 **** --- 16,20 ---- import rails.common.Defs; import rails.game.DisplayBuffer; + import rails.game.GameManager; import rails.game.OperatingRound; import rails.game.action.*; *************** *** 155,161 **** public void activate(OperatingRound or) { orPanel.recreate(or); setTitle(LocalText.getText("MapWindowORTitle", ! gameUIManager.getGameManager().getCompositeORNumber())); pack(); if (lastBounds != null) { --- 156,168 ---- public void activate(OperatingRound or) { + GameManager gameManager = (GameManager) gameUIManager.getGameManager(); + String compositeORNumber = gameManager.getCompositeORNumber (); + String numORs = gameManager.getNumOfORs (); + orPanel.recreate(or); setTitle(LocalText.getText("MapWindowORTitle", ! new String [] {compositeORNumber, numORs} )); ! // gameManager.getCompositeORNumber(), ! // gameManager.getNumOfORs ()})); pack(); if (lastBounds != null) { |
From: Mark J S. <kr...@us...> - 2009-01-03 22:50:12
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv12300/18xx/rails/game Modified Files: StartRound_1835.java Log Message: Improve Start Packet Handling so that only the left most item from the second available row is for sale, rather than the entire second row. Index: StartRound_1835.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StartRound_1835.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** StartRound_1835.java 23 Dec 2008 19:59:06 -0000 1.15 --- StartRound_1835.java 3 Jan 2009 22:49:59 -0000 1.16 *************** *** 71,74 **** --- 71,75 ---- int items = 0; int minRow = 0; + int prevRow = 0; /* *************** *** 86,98 **** } else { row = item.getRow(); if (minRow == 0) minRow = row; if (row == minRow) { // Allow all items in the top row. buyable = true; - items++; } else if (row == minRow + 1 && items == 1) { ! // Allow the first item in the next row if the ! // top row has only one item. ! buyable = true; } } --- 87,103 ---- } else { row = item.getRow(); + if (row > prevRow) { + items = 0; + prevRow = row; + } + items++; if (minRow == 0) minRow = row; if (row == minRow) { // Allow all items in the top row. buyable = true; } else if (row == minRow + 1 && items == 1) { ! // Allow the first item in the next row if the ! // top row has only one item. ! buyable = true; } } |
From: Erik V. <ev...@us...> - 2009-01-03 18:25:03
|
Update of /cvsroot/rails/18xx/rails/game/specific/_18EU In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv9873/rails/game/specific/_18EU Modified Files: StartCompany_18EU.java Log Message: Fixed bug that disabled buying more than 1 "infinite quantity" train. Also fixed missing code in StartCompany_18EU deserialization. Index: StartCompany_18EU.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_18EU/StartCompany_18EU.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** StartCompany_18EU.java 4 Jun 2008 19:00:36 -0000 1.4 --- StartCompany_18EU.java 3 Jan 2009 18:24:53 -0000 1.5 *************** *** 121,124 **** --- 121,151 ---- chosenMinor = cmgr.getPublicCompany(chosenMinorName); } + + MapManager mmgr = MapManager.getInstance(); + if (availableHomeStationNames != null) { + availableHomeStations = new ArrayList<City>(); + for (String cityName : availableHomeStationNames.split(",")) { + String[] parts = parseStationName (cityName); + MapHex hex = mmgr.getHex(parts[0]); + availableHomeStations.add (hex.getCity(Integer.parseInt(parts[1]))); + } + } + if (selectedHomeStationName != null) { + String[] parts = parseStationName (selectedHomeStationName); + MapHex hex = mmgr.getHex(parts[0]); + selectedHomeStation = hex.getCity(Integer.parseInt(parts[1])); + } + } + + private String[] parseStationName (String name) { + + if (name.contains(" on ")) { + // Old style + String[] parts = name.split(" "); + return new String[] {parts[4], parts[1]}; + } else { + // New style + return name.split("/"); + } } |
From: Erik V. <ev...@us...> - 2009-01-03 18:25:03
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv9873/rails/game Modified Files: Train.java OperatingRound.java TrainTypeI.java City.java TrainType.java Log Message: Fixed bug that disabled buying more than 1 "infinite quantity" train. Also fixed missing code in StartCompany_18EU deserialization. Index: TrainTypeI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/TrainTypeI.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TrainTypeI.java 4 Jun 2008 19:00:30 -0000 1.6 --- TrainTypeI.java 3 Jan 2009 18:24:53 -0000 1.7 *************** *** 98,101 **** --- 98,103 ---- public void setRustedTrainType(TrainTypeI rustedTrainType); + + public TrainI cloneTrain(); } Index: OperatingRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/OperatingRound.java,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** OperatingRound.java 23 Dec 2008 19:56:40 -0000 1.48 --- OperatingRound.java 3 Jan 2009 18:24:53 -0000 1.49 *************** *** 1120,1124 **** int actualPresidentCash = 0; Player currentPlayer = operatingCompany.getPresident(); - ; // Dummy loop to enable a quick jump out. --- 1120,1123 ---- *************** *** 1243,1247 **** operatingCompany.buyTrain(train, price); ! if (oldHolder == Bank.getIpo()) train.getType().addToBoughtFromIPO(); if (oldHolder.getOwner() instanceof Bank) { trainsBoughtThisTurn.add(train.getType()); --- 1242,1253 ---- operatingCompany.buyTrain(train, price); ! if (oldHolder == Bank.getIpo()) { ! train.getType().addToBoughtFromIPO(); ! // Clone the train if infinitely available ! if (train.getType().hasInfiniteAmount()) { ! Bank.getIpo().addTrain(train.getType().cloneTrain()); ! } ! ! } if (oldHolder.getOwner() instanceof Bank) { trainsBoughtThisTurn.add(train.getType()); Index: TrainType.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/TrainType.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** TrainType.java 4 Jun 2008 19:00:31 -0000 1.19 --- TrainType.java 3 Jan 2009 18:24:53 -0000 1.20 *************** *** 60,63 **** --- 60,65 ---- protected ArrayList<TrainI> trains = null; + + protected int lastIndex = 0; protected BooleanState available; *************** *** 197,225 **** * of this type is bought. */ ! try { ! train = trainClass.newInstance(); ! } catch (InstantiationException e) { ! throw new ConfigurationException( ! "Cannot instantiate class " + trainClassName, e); ! } catch (IllegalAccessException e) { ! throw new ConfigurationException("Cannot access class " ! + trainClassName ! + "constructor", e); ! } ! train.init(this, 0); trains.add(train); } else { for (int i = 0; i < amount; i++) { ! try { ! train = trainClass.newInstance(); ! } catch (InstantiationException e) { ! throw new ConfigurationException( ! "Cannot instantiate class " + trainClassName, e); ! } catch (IllegalAccessException e) { ! throw new ConfigurationException("Cannot access class " ! + trainClassName ! + "constructor", e); ! } ! train.init(this, i); trains.add(train); } --- 199,207 ---- * of this type is bought. */ ! train = createTrain(); trains.add(train); } else { for (int i = 0; i < amount; i++) { ! train = createTrain (); trains.add(train); } *************** *** 232,235 **** --- 214,249 ---- rusted = new BooleanState(name + "-trains_Rusted", false); } + + protected TrainI createTrain () throws ConfigurationException { + + TrainI train; + try { + train = trainClass.newInstance(); + } catch (InstantiationException e) { + throw new ConfigurationException( + "Cannot instantiate class " + trainClassName, e); + } catch (IllegalAccessException e) { + throw new ConfigurationException("Cannot access class " + + trainClassName + + "constructor", e); + } + train.init(this, lastIndex++); + return train; + } + + /** Create train without throwing exceptions. + * To be used <b>after</b> completing initialization, + * i.e. in cloning infinitely available trains. + */ + + public TrainI cloneTrain () { + TrainI train = null; + try { + train = createTrain(); + } catch (ConfigurationException e) { + log.warn("Unexpected exception", e); + } + return train; + } /** Index: City.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/City.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** City.java 29 Nov 2008 21:50:58 -0000 1.6 --- City.java 3 Jan 2009 18:24:53 -0000 1.7 *************** *** 50,54 **** public String getName() { ! return "City " + number + " on Hex " + mapHex.getName(); } --- 50,55 ---- public String getName() { ! return mapHex.getName() + "/" + number; ! } Index: Train.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Train.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Train.java 4 Jun 2008 19:00:32 -0000 1.11 --- Train.java 3 Jan 2009 18:24:53 -0000 1.12 *************** *** 137,140 **** --- 137,141 ---- new ObjectMove(this, holder, to); + } |
From: Erik V. <ev...@us...> - 2008-12-24 22:02:25
|
Update of /cvsroot/rails/18xx/rails/game/action In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv19740/rails/game/action Modified Files: MergeCompanies.java Log Message: Cases like 18EU brown Paris are now also covered: a check is added that token replacement is only allowed if there is not yet a token in the same station. Index: MergeCompanies.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/action/MergeCompanies.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MergeCompanies.java 24 Dec 2008 14:55:11 -0000 1.4 --- MergeCompanies.java 24 Dec 2008 22:02:20 -0000 1.5 *************** *** 49,60 **** } else { b.append(target.getName()); canReplaceToken.add(target.getNumberOfFreeBaseTokens() > 0 ! && (!mergingCompany.getHomeHex().hasTokenOfCompany(target) ! || mergingCompany.getHomeHex().getCurrentTile().allowsMultipleBasesOfOneCompany())); ! /* The above does not yet take care of cases where a tile where two ! * bases of the same company are allowed has different multi-slot ! * stations (e.g. the 18EU brown Paris tile #583). ! * Duplicate tokens in one station are not yet prevented here. ! */ } } --- 49,58 ---- } else { b.append(target.getName()); + MapHex hex = mergingCompany.getHomeHex(); canReplaceToken.add(target.getNumberOfFreeBaseTokens() > 0 ! && (!hex.hasTokenOfCompany(target) ! || hex.getCurrentTile().allowsMultipleBasesOfOneCompany() ! && hex.getCityOfBaseToken(mergingCompany) ! != hex.getCityOfBaseToken(target))); } } |
From: Erik V. <ev...@us...> - 2008-12-24 14:55:20
|
Update of /cvsroot/rails/18xx/rails/game/action In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv2811/rails/game/action Modified Files: MergeCompanies.java Log Message: On merging, only ask the "replace token" question if a token can actually legitimately be laid. (The exceptional case of tile #583 (18EU brown Paris) is not yet covered: two bases of one company in one station is not yet excluded). Index: MergeCompanies.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/action/MergeCompanies.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MergeCompanies.java 4 Jun 2008 19:00:29 -0000 1.3 --- MergeCompanies.java 24 Dec 2008 14:55:11 -0000 1.4 *************** *** 23,26 **** --- 23,27 ---- transient protected List<PublicCompanyI> targetCompanies; protected String targetCompanyNames; + protected List<Boolean> canReplaceToken; // Client-side settings *************** *** 40,49 **** --- 41,60 ---- this.targetCompanies = targetCompanies; StringBuffer b = new StringBuffer(); + canReplaceToken = new ArrayList<Boolean>(targetCompanies.size()); for (PublicCompanyI target : targetCompanies) { if (b.length() > 0) b.append(","); if (target == null) { b.append("null"); + canReplaceToken.add(false); } else { b.append(target.getName()); + canReplaceToken.add(target.getNumberOfFreeBaseTokens() > 0 + && (!mergingCompany.getHomeHex().hasTokenOfCompany(target) + || mergingCompany.getHomeHex().getCurrentTile().allowsMultipleBasesOfOneCompany())); + /* The above does not yet take care of cases where a tile where two + * bases of the same company are allowed has different multi-slot + * stations (e.g. the 18EU brown Paris tile #583). + * Duplicate tokens in one station are not yet prevented here. + */ } } *************** *** 62,65 **** --- 73,80 ---- } + public boolean canReplaceToken(int index) { + return canReplaceToken.get(index); + } + public PublicCompanyI getSelectedTargetCompany() { return selectedTargetCompany; *************** *** 100,107 **** } private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { ! in.defaultReadObject(); CompanyManagerI cmgr = Game.getCompanyManager(); --- 115,130 ---- } + @SuppressWarnings("unchecked") private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { ! //in.defaultReadObject(); ! // Custom reading for backwards compatibility ! ObjectInputStream.GetField fields = in.readFields(); ! mergingCompanyName = (String) fields.get("mergingCompanyName", mergingCompanyName); ! targetCompanyNames = (String) fields.get("targetCompanyNames", targetCompanyNames); ! canReplaceToken = (List<Boolean>) fields.get("canReplaceToken", canReplaceToken); ! selectedTargetCompanyName = (String) fields.get("selectedTargetCompanyName", selectedTargetCompanyName); ! replaceToken = fields.get("replaceToken", replaceToken); CompanyManagerI cmgr = Game.getCompanyManager(); |
From: Erik V. <ev...@us...> - 2008-12-24 14:55:15
|
Update of /cvsroot/rails/18xx/rails/ui/swing/gamespecific/_18EU In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv2811/rails/ui/swing/gamespecific/_18EU Modified Files: GameStatus_18EU.java Log Message: On merging, only ask the "replace token" question if a token can actually legitimately be laid. (The exceptional case of tile #583 (18EU brown Paris) is not yet covered: two bases of one company in one station is not yet excluded). Index: GameStatus_18EU.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/gamespecific/_18EU/GameStatus_18EU.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** GameStatus_18EU.java 4 Jun 2008 19:00:38 -0000 1.5 --- GameStatus_18EU.java 24 Dec 2008 14:55:11 -0000 1.6 *************** *** 81,85 **** action.setSelectedTargetCompany(major); ! if (major != null) { boolean replaceToken = JOptionPane.showConfirmDialog(this, LocalText.getText( --- 81,86 ---- action.setSelectedTargetCompany(major); ! if (major != null ! && action.canReplaceToken(choice)) { boolean replaceToken = JOptionPane.showConfirmDialog(this, LocalText.getText( |
From: Erik V. <ev...@us...> - 2008-12-24 14:52:59
|
Update of /cvsroot/rails/18xx/data/18EU In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv2737/data/18EU Modified Files: TileSet.xml Log Message: New <AllowsMultipleBasesOfOneCompany> property to deal with 18EU Paris/Berlin/Vienna allowances. Index: TileSet.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/18EU/TileSet.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TileSet.xml 14 Feb 2008 20:20:17 -0000 1.3 --- TileSet.xml 24 Dec 2008 14:52:47 -0000 1.4 *************** *** 18,24 **** --- 18,26 ---- <Tile id="-3005"><!--Berlin/Vienna--> <Upgrade id="581"/> + <AllowsMultipleBasesOfOneCompany/> </Tile> <Tile id="-3006"><!--Paris--> <Upgrade id="580"/> + <AllowsMultipleBasesOfOneCompany/> </Tile> *************** *** 97,103 **** --- 99,107 ---- <Tile id="580" quantity="1"> <Upgrade id="583" /> + <AllowsMultipleBasesOfOneCompany/> </Tile> <Tile id="581" quantity="2"> <Upgrade id="584" /> + <AllowsMultipleBasesOfOneCompany/> </Tile> *************** *** 110,114 **** <Tile id="546" quantity="3" /> <Tile id="582" quantity="9" /> ! <Tile id="583" quantity="1" /> <Tile id="584" quantity="2" /> <Tile id="611" quantity="8"> --- 114,120 ---- <Tile id="546" quantity="3" /> <Tile id="582" quantity="9" /> ! <Tile id="583" quantity="1"> ! <AllowsMultipleBasesOfOneCompany/> ! </Tile> <Tile id="584" quantity="2" /> <Tile id="611" quantity="8"> |
From: Erik V. <ev...@us...> - 2008-12-24 14:52:54
|
Update of /cvsroot/rails/18xx/rails/game In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv2737/rails/game Modified Files: TileI.java Tile.java Log Message: New <AllowsMultipleBasesOfOneCompany> property to deal with 18EU Paris/Berlin/Vienna allowances. Index: TileI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/TileI.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** TileI.java 29 Nov 2008 20:01:33 -0000 1.14 --- TileI.java 24 Dec 2008 14:52:47 -0000 1.15 *************** *** 38,41 **** --- 38,43 ---- public boolean isUpgradeable(); + + public boolean allowsMultipleBasesOfOneCompany(); public List<TileI> getUpgrades(MapHex hex, PhaseI phase); Index: Tile.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Tile.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Tile.java 11 Dec 2008 20:12:07 -0000 1.25 --- Tile.java 24 Dec 2008 14:52:47 -0000 1.26 *************** *** 42,45 **** --- 42,47 ---- private int quantity; private boolean unlimited = false; + private boolean allowsMultipleBasesOfOneCompany = false; + public static final int UNLIMITED_TILES = -1; *************** *** 198,201 **** --- 200,206 ---- unlimited = (quantity == 99 || quantity == UNLIMITED_TILES); if (unlimited) quantity = UNLIMITED_TILES; + /* Multiple base tokens of one company allowed */ + allowsMultipleBasesOfOneCompany = setTag.hasChild( + "AllowsMultipleBasesOfOneCompany"); /* Upgrades */ *************** *** 336,339 **** --- 341,348 ---- } + public boolean allowsMultipleBasesOfOneCompany() { + return allowsMultipleBasesOfOneCompany; + } + /** * Get the valid upgrades if this tile on a certain hex (restrictions per |