rails.game
Class StartRound

java.lang.Object
  extended by rails.game.Round
      extended by rails.game.StartRound
All Implemented Interfaces:
RoundI
Direct Known Subclasses:
StartRound_1825, StartRound_1830, StartRound_1835, StartRound_1851, StartRound_1880, StartRound_18EU

public abstract class StartRound
extends Round


Field Summary
protected  State auctionItemState
           
(package private)  PublicCompanyI companyNeedingPrice
          A company in need for a par price.
protected  Player currentPlayer
           
protected  boolean hasBasePrices
          Should the UI show base prices? Not useful if the items are all equal, as in 1841 and 18EU.
protected  boolean hasBidding
          Should the UI present bidding into and facilities? This value MUST be set in the actual StartRound constructor.
protected  int[] itemIndex
           
protected  java.util.List<StartItem> itemsToSell
           
protected  IntegerState numPasses
           
protected  int numPlayers
           
protected  StartPacket startPacket
           
protected  Player startPlayer
           
protected  java.lang.String variant
           
 
Fields inherited from class rails.game.Round
autopasses, bank, canRequestTurn, companyManager, gameManager, guiHints, hasRequestedTurn, ipo, log, mapManager, moveStack, playerManager, pool, possibleActions, scrapHeap, stockMarket, unavailable, wasInterrupted
 
Constructor Summary
StartRound(GameManagerI gameManager)
          Will be created dynamically.
 
Method Summary
protected  void assignItem(Player player, StartItem item, int price, int sharePrice)
          This method executes the start item buy action.
protected abstract  boolean bid(java.lang.String playerName, BidStartItem startItem)
          The current player bids on a given start item.
protected  boolean buy(java.lang.String playerName, BuyStartItem boughtItem)
          Buy a start item against the base price.
protected  void checksOnBuying(Certificate cert, int sharePrice)
           
protected  void finishRound()
           
 ModelObject getBidModel(int privateIndex, int playerIndex)
           
 ModelObject getBlockedCashModel(int playerIndex)
           
 int getCurrentPlayerIndex()
          Get the currentPlayer index in the player list (starting at 0).
 ModelObject getFreeCashModel(int playerIndex)
           
 ModelObject getMinimumBidModel(int privateIndex)
           
 java.util.List<StartItem> getStartItems()
          Get the current list of start items.
 StartPacket getStartPacket()
          Get a list of items that the current player may bid upon.
 boolean hasBasePrices()
           
 boolean hasBidding()
           
protected abstract  boolean pass(java.lang.String playerName)
          Process a player's pass.
 boolean process(PossibleAction action)
           
protected  void setNextPlayer()
           
protected  void setPlayer(Player player)
           
protected  void setPriorityPlayer()
           
 void start()
          Start the start round.
protected  void startPacketChecks()
          Stub to allow start packet cleanups in subclasses
 
Methods inherited from class rails.game.Round
canCompanyOperateThisRound, canRequestTurn, certCountsAsSold, checkFlotation, exchangeTokens, floatCompany, getAutopasses, getCurrentPhase, getCurrentPlayer, getGameManager, getGameOption, getGameParameter, getGameParameterAsBoolean, getGameParameterAsInt, getHelp, getNumberOfActivePlayers, getNumberOfPlayers, getPlayers, getRoundName, getRoundTypeForUI, getSoldPercentage, getSpecialProperties, hasAutopassed, pay, pay, requestTurn, resume, setAutopass, setCanRequestTurn, setCurrentPlayer, setCurrentPlayerIndex, setOperatingCompanies, setOperatingCompanies, setPossibleActions, toString, transferCertificate, transferCertificates, wasInterrupted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

startPacket

protected StartPacket startPacket

itemIndex

protected int[] itemIndex

itemsToSell

protected java.util.List<StartItem> itemsToSell

auctionItemState

protected State auctionItemState

numPasses

protected IntegerState numPasses

numPlayers

protected int numPlayers

variant

protected java.lang.String variant

currentPlayer

protected Player currentPlayer

startPlayer

protected Player startPlayer

hasBidding

protected boolean hasBidding
Should the UI present bidding into and facilities? This value MUST be set in the actual StartRound constructor.


hasBasePrices

protected boolean hasBasePrices
Should the UI show base prices? Not useful if the items are all equal, as in 1841 and 18EU.


companyNeedingPrice

PublicCompanyI companyNeedingPrice
A company in need for a par price.

Constructor Detail

StartRound

public StartRound(GameManagerI gameManager)
Will be created dynamically.

Method Detail

start

public void start()
Start the start round.

Parameters:
startPacket - The startpacket to be sold in this start round.

process

public boolean process(PossibleAction action)
Specified by:
process in interface RoundI
Overrides:
process in class Round

startPacketChecks

protected void startPacketChecks()
Stub to allow start packet cleanups in subclasses


bid

protected abstract boolean bid(java.lang.String playerName,
                               BidStartItem startItem)
The current player bids on a given start item.

Parameters:
playerName - The name of the current player (for checking purposes).
itemName - The name of the start item on which the bid is placed.
amount - The bid amount.

buy

protected boolean buy(java.lang.String playerName,
                      BuyStartItem boughtItem)
Buy a start item against the base price.

Parameters:
playerName - Name of the buying player.
itemName - Name of the bought start item.
sharePrice - If nonzero: share price if item contains a President's share
Returns:
False in case of any errors.

assignItem

protected void assignItem(Player player,
                          StartItem item,
                          int price,
                          int sharePrice)
This method executes the start item buy action.

Parameters:
player - Buying player.
item - Start item being bought.
price - Buy price.

checksOnBuying

protected void checksOnBuying(Certificate cert,
                              int sharePrice)

pass

protected abstract boolean pass(java.lang.String playerName)
Process a player's pass.

Parameters:
playerName - The name of the current player (for checking purposes).

finishRound

protected void finishRound()
Overrides:
finishRound in class Round

getCurrentPlayerIndex

public int getCurrentPlayerIndex()
Get the currentPlayer index in the player list (starting at 0).

Overrides:
getCurrentPlayerIndex in class Round
Returns:
The index of the current Player.
See Also:
GameManager.getCurrentPlayerIndex().

setPriorityPlayer

protected void setPriorityPlayer()

setPlayer

protected void setPlayer(Player player)

setNextPlayer

protected void setNextPlayer()

getStartItems

public java.util.List<StartItem> getStartItems()
Get the current list of start items.

Returns:
An array of start items, possibly empry.

getStartPacket

public StartPacket getStartPacket()
Get a list of items that the current player may bid upon.

Returns:
An array of start items, possibly empty.

hasBidding

public boolean hasBidding()

hasBasePrices

public boolean hasBasePrices()

getBidModel

public ModelObject getBidModel(int privateIndex,
                               int playerIndex)

getMinimumBidModel

public ModelObject getMinimumBidModel(int privateIndex)

getFreeCashModel

public ModelObject getFreeCashModel(int playerIndex)

getBlockedCashModel

public ModelObject getBlockedCashModel(int playerIndex)