|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object soc.game.SOCBoard soc.game.SOCBoardLarge soc.server.SOCBoardLargeAtServer
public class SOCBoardLargeAtServer
A subclass of SOCBoardLarge
for the server, to isolate
makeNewBoard(Map)
and simplify that parent class.
See SOCBoardLarge for more details.
For the board layout geometry, see that class javadoc's "Coordinate System" section.
Sea board layout: A representation of a larger (up to 127 x 127 hexes) JSettlers board,
with an arbitrary mix of land and water tiles.
Implements SOCBoard.BOARD_ENCODING_LARGE
.
Activated with SOCGameOption
"SBL"
.
A SOCGame
uses this board; the board is not given a reference to the game, to enforce layering
and keep the board logic simple. Game rules should be enforced at the game, not the board.
Calling board methods won't change the game state.
On this large sea board, there can optionally be multiple "land areas"
(groups of islands, or subsets of islands), if SOCBoardLarge.getLandAreasLegalNodes()
!= null.
Land areas are groups of nodes on land; call SOCBoardLarge.getNodeLandArea(int)
to find a node's land area number.
The starting land area is SOCBoardLarge.getStartingLandArea()
, if players must start in a certain area.
During board setup, makeNewBoard(Map)
calls
makeNewBoard_placeHexes(int[], int[], int[], boolean, boolean, int, boolean, int, SOCGameOption, String)
once for each land area. In some game scenarios, players and the robber can be
excluded
from placing in some land areas.
It's also possible for an island to have more than one landarea (as in scenario SC_TTD). In this case you should have a border zone of hexes with no landarea, because the landareas are tracked by their hexes' nodes, not by the hexes, and a node can't be in multiple LAs.
A good example is SC_PIRI "Pirate Islands"; see commits 57073cb, f9623e5, and 112e289, or search this class for the string SC_PIRI.
Parts of the layout:
getBoardSize(Map, int)
Some scenarios may add other "layout parts" related to their scenario board layout.
For example, scenario _SC_PIRI
adds "PP"
for the path followed by the pirate fleet.
See SOCBoardLarge.getAddedLayoutPart(String)
, SOCBoardLarge.setAddedLayoutPart(String, int[])
,
and the list of added parts documented at the SOCBoardLayout2
class javadoc.
Nested Class Summary | |
---|---|
static class |
SOCBoardLargeAtServer.BoardFactoryAtServer
Server-side implementation of SOCBoard.BoardFactory to create SOCBoardLargeAtServer s. |
Nested classes/interfaces inherited from class soc.game.SOCBoard |
---|
SOCBoard.BoardFactory, SOCBoard.DefaultBoardFactory |
Field Summary | |
---|---|
private static int[] |
CLVI_BOARDSIZE
Cloth Villages: Board size: 4 players max row 0x0E, max col 0x10. |
private static int[][] |
CLVI_CLOTH_VILLAGE_AMOUNTS_NODES_DICE
Cloth Villages: Small islands' cloth village node locations and dice numbers. |
private static int[][] |
CLVI_DICENUM_MAIN
Cloth Villages: Dice numbers for hexes on the main island. |
private static int[][] |
CLVI_LANDHEX_COORD_ISL
Cloth Villages: Land hex coordinates for the several small middle islands, west to east. |
private static int[][] |
CLVI_LANDHEX_COORD_MAIN
Cloth Villages: Land hex coordinates for the main islands. |
private static int[][] |
CLVI_LANDHEX_TYPE_ISL
Cloth Villages: Hex land types on the several small middle islands, west to east. |
private static int[][] |
CLVI_LANDHEX_TYPE_MAIN
Cloth Villages: Land hex types for the main island. |
private static int[] |
CLVI_PIRATE_HEX
Cloth Villages: Starting pirate water hex coordinate for 4, 6 players. |
private static int[][] |
CLVI_PORT_EDGE_FACING
Cloth Villages: Port edges and facings. |
private static int[][] |
CLVI_PORT_TYPE
Cloth Villages: Port types; will be shuffled. |
private java.util.Stack<java.lang.Integer> |
drawStack
For game scenarios such as _SC_FTRI ,
dev cards or other items waiting to be claimed by any player. |
private static int |
FOG_ISL_BOARDSIZE_4PL
Fog Island: Board size for 4 players: Max row 0x10, max col 0x11. |
private static int |
FOG_ISL_BOARDSIZE_6PL
Fog Island: Board size for 6 players: Max row 0x10, max col 0x14. |
private static int[] |
FOG_ISL_DICENUM_FOG_3PL
Fog Island: Dice numbers for hexes on the fog island. |
private static int[] |
FOG_ISL_DICENUM_FOG_4PL
Fog Island: Dice numbers for hexes on the fog island. |
private static int[] |
FOG_ISL_DICENUM_FOG_6PL
Fog Island: Dice numbers for hexes on the fog island. |
private static int[] |
FOG_ISL_DICENUM_GC
Fog Island: Dice numbers for hexes on the gold corners (6-player only). |
private static int[] |
FOG_ISL_DICENUM_MAIN_3PL
Fog Island: Dice numbers for hexes on the large southwest and northeast islands. |
private static int[] |
FOG_ISL_DICENUM_MAIN_4PL
Fog Island: Dice numbers for hexes on the large southwest and northeast islands. |
private static int[] |
FOG_ISL_DICENUM_MAIN_6PL
Fog Island: Dice numbers for hexes on the northern main island. |
private static int[] |
FOG_ISL_LANDHEX_COORD_FOG_3PL
Fog Island: Land and water hex coordinates for the fog island. |
private static int[] |
FOG_ISL_LANDHEX_COORD_FOG_4PL
Fog Island: Land and water hex coordinates for the fog island. |
private static int[] |
FOG_ISL_LANDHEX_COORD_FOG_6PL
Fog Island: Land and water hex coordinates for the fog island. |
private static int[] |
FOG_ISL_LANDHEX_COORD_GC
Fog Island: Land hex coordinates for the gold corners (6-player only). |
private static int[] |
FOG_ISL_LANDHEX_COORD_MAIN_3PL
Fog Island: Land hex coordinates for the large southwest and northeast islands. |
private static int[] |
FOG_ISL_LANDHEX_COORD_MAIN_4PL
Fog Island: Land hex coordinates for the large southwest and northeast islands. |
private static int[] |
FOG_ISL_LANDHEX_COORD_MAIN_6PL
Fog Island: Land hex coordinates for the northern main island. |
private static int[] |
FOG_ISL_LANDHEX_TYPE_FOG
Fog Island: Land and water hex types for the fog island. |
private static int[] |
FOG_ISL_LANDHEX_TYPE_FOG_6PL
Fog Island: Land and water hex types for the fog island. |
private static int[] |
FOG_ISL_LANDHEX_TYPE_GC
Fog Island: Land hex types for the gold corners (6-player only). |
private static int[] |
FOG_ISL_LANDHEX_TYPE_MAIN_3PL
Fog Island: Land hex types for the large southwest and northeast islands. |
private static int[] |
FOG_ISL_LANDHEX_TYPE_MAIN_4PL
Fog Island: Land hex types for the large southwest and northeast islands. |
private static int[] |
FOG_ISL_LANDHEX_TYPE_MAIN_6PL
Fog Island: Land hex types for the northern main island. |
private static int[] |
FOG_ISL_PORT_EDGE_FACING_3PL
Fog Island: Port edges and facings on the large southwest and northeast islands. |
private static int[] |
FOG_ISL_PORT_EDGE_FACING_4PL
Fog Island: Port edges and facings on the large southwest and northeast islands. |
private static int[] |
FOG_ISL_PORT_EDGE_FACING_6PL
Fog Island: Port edges and facings on the northern main island. |
private static int[] |
FOG_ISL_PORT_TYPE_3PL
Fog Island: Port types on the large southwest and northeast islands. |
private static int[] |
FOG_ISL_PORT_TYPE_4PL
Fog Island: Port types on the large southwest and northeast islands. |
private static int[] |
FOG_ISL_PORT_TYPE_6PL
Fog Island: Port types on the northern main island. |
private static int[] |
FOR_TRI_BOARDSIZE
Forgotten Tribe: Board size: 4 players max row 0x0E, max col 0x11. |
private static int[][] |
FOR_TRI_DEV_CARD_EDGES
Forgotten Tribe: Dev Card Edges: Edge coordinates where ship placement gives a free development card. |
private static int[][] |
FOR_TRI_DICENUM_MAIN
Forgotten Tribe: Dice numbers for hexes on the main island. |
private static int[][] |
FOR_TRI_LANDHEX_COORD_ISL
Forgotten Tribe: Land hex coordinates for the several small islands. |
private static int[][] |
FOR_TRI_LANDHEX_COORD_MAIN
Forgotten Tribe: Land hex coordinates for the main island. |
private static int[][] |
FOR_TRI_LANDHEX_COORD_MAIN_FAR_COASTAL
Forgotten Tribe: 3 Land hex coordinates on main island (within FOR_TRI_LANDHEX_COORD_MAIN ) on the short eastern side. |
private static int[][] |
FOR_TRI_LANDHEX_TYPE_ISL
Forgotten Tribe: Hex land types on the several small islands. |
private static int[][] |
FOR_TRI_LANDHEX_TYPE_MAIN
Forgotten Tribe: Land hex types for the main island. |
private static int[] |
FOR_TRI_PIRATE_HEX
Forgotten Tribe: Starting pirate water hex coordinate for 4, 6 players. |
private static int[][] |
FOR_TRI_PORT_EDGE_FACING
Forgotten Tribe: Port edges and facings. |
private static int[][] |
FOR_TRI_PORT_TYPE
Forgotten Tribe: Port types; will be shuffled. |
private static int[][] |
FOR_TRI_SVP_EDGES
Forgotten Tribe: Special Victory Point Edges: edge coordinates where ship placement gives an SVP. |
private static int |
FOUR_ISL_BOARDSIZE_4PL
Four Islands: Board size for 4 players: Max row 0x10, max col 0x0e. |
private static int |
FOUR_ISL_BOARDSIZE_6PL
Four Islands: Board size for 6 players: Max row 0x10, max col 0x14. |
private static int[] |
FOUR_ISL_DICENUM_3PL
Four Islands: Dice numbers for all 4 islands. |
private static int[] |
FOUR_ISL_DICENUM_4PL
Four Islands: Dice numbers for hexes on all 4 islands. |
private static int[] |
FOUR_ISL_DICENUM_6PL
Six Islands: Dice numbers for hexes on all 6 islands. |
private static int[] |
FOUR_ISL_LANDHEX_COORD_3PL
Four Islands: Land hex coordinates for all 4 islands. |
private static int[] |
FOUR_ISL_LANDHEX_COORD_4PL
Four Islands: Land hex coordinates for all 4 islands. |
private static int[] |
FOUR_ISL_LANDHEX_COORD_6PL
Six Islands: Land hex coordinates for all 6 islands. |
private static int[] |
FOUR_ISL_LANDHEX_LANDAREA_RANGES_3PL
Four Islands: Island hex counts and land area numbers within FOUR_ISL_LANDHEX_COORD_3PL . |
private static int[] |
FOUR_ISL_LANDHEX_LANDAREA_RANGES_4PL
Four Islands: Island hex counts and land area numbers within FOUR_ISL_LANDHEX_COORD_4PL . |
private static int[] |
FOUR_ISL_LANDHEX_LANDAREA_RANGES_6PL
Six Islands: Island hex counts and land area numbers within FOUR_ISL_LANDHEX_COORD_6PL . |
private static int[] |
FOUR_ISL_LANDHEX_TYPE_3PL
Four Islands: Land hex types for all 4 islands. |
private static int[] |
FOUR_ISL_LANDHEX_TYPE_4PL
Four Islands: Land hex types for all 4 islands. |
private static int[] |
FOUR_ISL_LANDHEX_TYPE_6PL
Six Islands: Land hex types for all 6 islands. |
private static int[] |
FOUR_ISL_PIRATE_HEX
Four Islands: Pirate ship's starting hex coordinate for 3,4,6 players |
private static int[] |
FOUR_ISL_PORT_EDGE_FACING_3PL
Four Islands: Port edges and facings on all 4 islands. |
private static int[] |
FOUR_ISL_PORT_EDGE_FACING_4PL
Four Islands: Port edges and facings on all 4 islands. |
private static int[] |
FOUR_ISL_PORT_EDGE_FACING_6PL
Six Islands: Port edges and facings on all 6 islands. |
private static int[] |
FOUR_ISL_PORT_TYPE_3PL
Four Islands: Port types on all 4 islands. |
private static int[] |
FOUR_ISL_PORT_TYPE_4PL
Four Islands: Port types on all 4 islands. |
private static int[] |
FOUR_ISL_PORT_TYPE_6PL
Six Islands: Port types on all 6 islands. |
private static int[] |
LANDHEX_COORD_ISLANDS_ALL_4PL
Fallback board layout, 4 players: All the outlying islands' land hex coordinates. |
private static int[] |
LANDHEX_COORD_ISLANDS_ALL_6PL
Fallback board layout, 6 players: All the outlying islands' land hex coordinates. |
private static int[][] |
LANDHEX_COORD_ISLANDS_EACH
Fallback board layout for 4 players: Each outlying island's land hex coordinates. |
private static int[] |
LANDHEX_COORD_MAINLAND
Fallback board layout for 4 players: Main island's land hex coordinates, each row west to east. |
private static int[] |
LANDHEX_DICENUM_ISLANDS_4PL
Fallback board layout, 4 players: Dice numbers for the outlying islands. |
private static int[] |
LANDHEX_DICENUM_ISLANDS_6PL
Fallback board layout, 6 players: Dice numbers for the outlying islands. |
private static int[] |
LANDHEX_DICEPATH_MAINLAND_4PL
Fallback board layout for 4 players: Dice-number path (hex coordinates) on the main island, spiraling inward from the shore. |
private static int[] |
LANDHEX_DICEPATH_MAINLAND_6PL
Fallback board layout for 6 players: Dice-number path (hex coordinates) on the main island, spiraling inward from the shore. |
private static int[] |
LANDHEX_LANDAREA_RANGES_ISLANDS_4PL
4-player island hex counts and land area numbers within LANDHEX_COORD_ISLANDS_ALL_4PL . |
private static int[] |
LANDHEX_LANDAREA_RANGES_ISLANDS_6PL
4-player island hex counts and land area numbers within LANDHEX_COORD_ISLANDS_ALL_4PL . |
private static int[] |
LANDHEX_TYPE_ISLANDS_4PL
Fallback board layout, 4 players: Land hex types for the 3 small islands, to be used with (for the main island) SOCBoard.makeNewBoard_landHexTypes_v1 []. |
private static int[] |
LANDHEX_TYPE_ISLANDS_6PL
Fallback board layout, 6 players: Land hex types for the 3 small islands, to be used with (for the main island) SOCBoard.makeNewBoard_landHexTypes_v2 []. |
private static int[] |
NSHO_BOARDSIZE
New Shores: Board size: 3 players max row 0x0E, max col 0x0E. |
private static int[][] |
NSHO_DICENUM_ISL
New Shores: Dice numbers for hexes on the several small islands ( NSHO_LANDHEX_COORD_ISL ). |
private static int[][] |
NSHO_DICENUM_MAIN
New Shores: Dice numbers for hexes on the main island along NSHO_LANDHEX_COORD_MAIN . |
private static int[][] |
NSHO_LANDHEX_COORD_ISL
New Shores: Land hex coordinates for the several small islands. |
private static int[][] |
NSHO_LANDHEX_COORD_MAIN
New Shores: Land hex coordinates for the main island. |
private static int[][] |
NSHO_LANDHEX_LANDAREA_RANGES
New Shores: Island hex counts and land area numbers within NSHO_LANDHEX_COORD_ISL . |
private static int[][] |
NSHO_LANDHEX_TYPE_ISL
New Shores: Land hex types on the several small islands. |
private static int[][] |
NSHO_LANDHEX_TYPE_MAIN
New Shores: Land hex types for the main island. |
private static int[] |
NSHO_PIRATE_HEX
New Shores: Starting pirate water hex coordinate for 3, 4, 6 players. |
private static int[][] |
NSHO_PORT_EDGE_FACING
New Shores: Port edges and facings. |
private static int[][] |
NSHO_PORT_TYPE
New Shores: Port types on main island; will be shuffled. |
private static int[] |
PIR_ISL_BOARDSIZE
Pirate Islands: Board size: 4 players max row 0x10, max col 0x12. |
private static int[][] |
PIR_ISL_DICENUM_MAIN
Pirate Islands: Dice numbers for hexes on the large eastern starting island. |
private static int[][] |
PIR_ISL_DICENUM_PIRI
Pirate Islands: Dice numbers for the first few land hexes along PIR_ISL_LANDHEX_COORD_PIRI |
private static int[][] |
PIR_ISL_INIT_PIECES
Pirate Islands: Initial piece coordinates for each player, in same player order as PIR_ISL_SEA_EDGES
(given out to non-vacant players, not strictly matching player number). |
private static int[][] |
PIR_ISL_LANDHEX_COORD_MAIN
Pirate Islands: Land hex coordinates for the large eastern starting island. |
private static int[][] |
PIR_ISL_LANDHEX_COORD_PIRI
Pirate Islands: Land hex coordinates for the several pirate islands. |
private static int[][] |
PIR_ISL_LANDHEX_TYPE_MAIN
Pirate Islands: Land hex types for the large eastern starting island. |
private static int[][] |
PIR_ISL_LANDHEX_TYPE_PIRI
Pirate Islands: Hex land types on the several pirate islands. |
private static int[] |
PIR_ISL_PIRATE_HEX
Pirate Islands: Starting pirate water hex coordinate for 4, 6 players. |
private static int[][] |
PIR_ISL_PORT_EDGE_FACING
Pirate Islands: Port edges and facings on the large eastern starting island. |
private static int[][] |
PIR_ISL_PORT_TYPE
Pirate Islands: Port types on the large eastern starting island. |
private static int[][] |
PIR_ISL_PPATH
Pirate Islands: The hex-coordinate path for the Pirate Fleet; SOCBoardLarge additional part "PP". |
private static int[][][] |
PIR_ISL_SEA_EDGES
Pirate Islands: Sea edges legal/valid for each player to build ships directly to their Fortress. |
private int |
piratePathIndex
For game scenario option _SC_PIRI ,
the pirate fleet's position on its path (PP). |
private static int[] |
PORT_EDGE_FACING_ISLANDS_4PL
Fallback board layout, 4 players: Outlying islands' ports. |
private static int[] |
PORT_EDGE_FACING_ISLANDS_6PL
Fallback board layout, 6 players: Outlying islands' ports. |
private static int[] |
PORT_EDGE_FACING_MAINLAND_4PL
Fallback board layout for 4 players: Main island's ports, clockwise from its northwest. |
private static int[] |
PORT_EDGE_FACING_MAINLAND_6PL
Fallback board layout for 6 players: Main island's ports, clockwise from its western corner (like dice path). |
private static int[] |
PORT_TYPE_ISLANDS_4PL
Port types for the 4 outlying-island ports on the 4-player fallback board. |
private static int[] |
PORT_TYPE_ISLANDS_6PL
Port types for the 4 outlying-island ports on the 6-player fallback board. |
private static long |
serialVersionUID
|
private static int[] |
TTDESERT_BOARDSIZE
Through The Desert: Board size for 3, 4, 6 players: Each is 0xrrcc (max row, max col). |
private static int[][] |
TTDESERT_DICENUM_MAIN
Through The Desert: Dice numbers for hexes on the main island, including the strip of land past the desert. |
private static int[][] |
TTDESERT_DICENUM_SMALL
Through The Desert: Dice numbers for all the small islands ( TTDESERT_LANDHEX_COORD_SMALL ). |
private static int[][] |
TTDESERT_LANDHEX_COORD_DESERT
Through The Desert: Land hex coordinates for the strip of desert hexes on the main island. |
private static int[][] |
TTDESERT_LANDHEX_COORD_MAIN
Through The Desert: Land Area 1, 2: Land hex coordinates for the main island, excluding its desert strip but including the small fertile area on the desert's far side. |
private static int[][] |
TTDESERT_LANDHEX_COORD_SMALL
Through The Desert: Land Areas 3 to n: Land hex coordinates for all of the small "foreign" islands, one LA per island. |
private static int[][] |
TTDESERT_LANDHEX_RANGES_MAIN
Through The Desert: Land Areas 1, 2: Hex counts and Land area numbers for the main island, excluding its desert, within TTDESERT_LANDHEX_COORD_MAIN . |
private static int[][] |
TTDESERT_LANDHEX_RANGES_SMALL
Through The Desert: Land Areas 3 to n: Hex counts and Land area numbers for each of the small "foreign" islands, one per island, within TTDESERT_LANDHEX_COORD_SMALL . |
private static int[][] |
TTDESERT_LANDHEX_TYPE_MAIN
Through The Desert: Land hex types for the main island (land areas 1, 2). |
private static int[][] |
TTDESERT_LANDHEX_TYPE_SMALL
Through The Desert: Hex land types on the several small islands. |
private static int[] |
TTDESERT_PIRATE_HEX
Through The Desert: Starting pirate water hex coordinate for 3, 4, 6 players. |
private static int[][] |
TTDESERT_PORT_EDGE_FACING
Through The Desert: Port edges and facings on the main island. |
private static int[][] |
TTDESERT_PORT_TYPE
Through The Desert: Port types on the main island. |
private static int[] |
WOND_BOARDSIZE
Wonders: Board size: 4 players max row 0x0E, max col 0x12. |
private static int[][] |
WOND_DICENUM_ISL
Wonders: Dice numbers for hexes on the several small islands, same order as WOND_LANDHEX_COORD_ISL . |
private static int[][] |
WOND_DICENUM_MAIN
Wonders: Dice numbers for hexes on the main island. |
private static int[][] |
WOND_LANDHEX_COORD_DESERT
Wonders: Land hex coordinates for the deserts in the southwest of the main island. |
private static int[][] |
WOND_LANDHEX_COORD_ISL
Wonders: Land hex coordinates for the several small islands, west to east. |
private static int[][] |
WOND_LANDHEX_COORD_MAIN
Wonders: Land hex coordinates for the main island, excluding deserts ( WOND_LANDHEX_COORD_DESERT ). |
private static int[][] |
WOND_LANDHEX_COORD_MAIN_AT_DESERT
Wonders: 2 land hex coordinates on main island (within WOND_LANDHEX_COORD_MAIN )
adjacent to the deserts (WOND_LANDHEX_COORD_DESERT ). |
private static int[][] |
WOND_LANDHEX_TYPE_ISL
Wonders: Hex land types on the several small islands, west to east. |
private static int[][] |
WOND_LANDHEX_TYPE_MAIN
Wonders: Land hex types for the main island, excluding the desert. |
private static int[][] |
WOND_PORT_EDGE_FACING
Wonders: Port edges and facings. |
private static int[][] |
WOND_PORT_TYPE
Wonders: Port types; will be shuffled. |
private static int[][][] |
WOND_SPECIAL_NODES
Wonders: Special Node locations. |
Constructor Summary | |
---|---|
SOCBoardLargeAtServer(java.util.Map<java.lang.String,SOCGameOption> gameOpts,
int maxPlayers,
IntPair boardHeightWidth)
Create a new Settlers of Catan Board, with the v3 encoding. |
Method Summary | |
---|---|
java.lang.Integer |
drawItemFromStack()
If this scenario has dev cards or items waiting to be claimed by any player, draw the next item from that stack. |
private static int |
getBoardSize(java.util.Map<java.lang.String,SOCGameOption> gameOpts,
int maxPlayers)
Get the board size for BoardFactoryAtServer.createBoard :
The default size BOARDHEIGHT_LARGE by
BOARDWIDTH_LARGE ,
unless gameOpts contains a scenario ("SC") whose layout has a custom height/width. |
static int[][] |
getLegalSeaEdges(SOCGame ga,
int forPN)
For scenario game option _SC_PIRI ,
get the list of Legal Sea Edges arranged for the players not vacant. |
private void |
makeNewBoard_checkPortLocationsConsistent(int[] portsLocFacing)
For makeNewBoard(Map) , check port locations and facings, and make sure
no port overlaps with a land hex. |
private void |
makeNewBoard_fillNodesOnLandFromHexes(int[] landHexCoords,
int startIdx,
int pastEndIdx,
int landAreaNumber,
boolean addToExistingLA)
Calculate the board's legal settlement/city nodes, based on land hexes. |
protected void |
makeNewBoard_hideHexesInFog(int[] hexCoords)
For makeNewBoard(Map) , hide these hexes under SOCBoardLarge.FOG_HEX to be revealed later. |
private void |
makeNewBoard_placeHexes_arrangeGolds(int[] hexCoords,
int[] landAreaPathRanges,
java.lang.String scen)
For makeNewBoard(Map) , after placing
land hexes and dice numbers into SOCBoardLarge.hexLayoutLg ,
fine-tune the randomized gold hex placement:
Find and separate adjacent gold hexes. |
private int |
makeNewBoard_placeHexes_arrGolds_addToAdjacList(java.util.HashMap<java.lang.Integer,java.util.List<java.lang.Integer>> goldAdjacGold,
java.lang.Integer hex0,
java.lang.Integer hex1)
Add hex1 to hex0's adjacency list in this map; create that list if needed. |
private void |
makeNewBoard_placeHexes_arrGolds_swapWithRandom(java.lang.Integer goldHex,
java.util.HashSet<java.lang.Integer> nonAdjac,
java.util.HashMap<java.lang.Integer,java.util.List<java.lang.Integer>> goldAdjacGold)
Swap this gold hex with a random non-adjacent hex in hexLayoutLg. |
private void |
makeNewBoard_placeHexes_moveFrequentNumbers_buildArrays(int[] landPath,
java.util.ArrayList<java.lang.Integer> redHexes,
java.util.HashSet<java.lang.Integer> ignoreHexes,
java.util.HashSet<java.lang.Integer> otherCoastalHexes,
java.util.HashSet<java.lang.Integer> otherHexes,
java.lang.String scen,
java.util.HashSet<java.lang.Integer> otherHexesForScen)
Build sets used for makeNewBoard_placeHexes_moveFrequentNumbers(int[], ArrayList, int, String) . |
private java.util.HashSet<java.lang.Integer> |
makeNewBoard_placeHexes_moveFrequentNumbers_checkSpecialHexes(int[] landPath,
java.util.ArrayList<java.lang.Integer> redHexes,
int maxPl,
java.lang.String scen)
Check for any hexes that forbid too-frequent dice numbers (only a few scenarios). |
private IntTriple |
makeNewBoard_placeHexes_moveFrequentNumbers_swapOne(int swaphex,
int swapi,
java.util.ArrayList<java.lang.Integer> redHexes,
java.util.HashSet<java.lang.Integer> ignoreHexes,
java.util.HashSet<java.lang.Integer> otherCoastalHexes,
java.util.HashSet<java.lang.Integer> otherHexes)
The dice-number swapping algorithm for makeNewBoard_placeHexes_moveFrequentNumbers(int[], ArrayList, int, String) . |
private boolean |
makeNewBoard_placeHexes_moveFrequentNumbers(int[] landPath,
java.util.ArrayList<java.lang.Integer> redHexes,
int maxPl,
java.lang.String scen)
For makeNewBoard(Map) , after placing
land hexes and dice numbers into hexLayoutLg
and numberLayoutLg ,
separate adjacent "red numbers" (6s, 8s)
and make sure gold hex dice aren't too frequent. |
private void |
makeNewBoard_placeHexes(int[] landHexType,
int[] landPath,
int[] number,
boolean shuffleDiceNumbers,
boolean shuffleLandHexes,
int[] landAreaPathRanges,
boolean addToExistingLA,
int maxPl,
SOCGameOption optBC,
java.lang.String scen)
For makeNewBoard(Map) , place the land hexes, number, and robber
for multiple land areas, after shuffling their common landHexType[]. |
private void |
makeNewBoard_placeHexes(int[] landHexType,
int[] landPath,
int[] number,
boolean shuffleDiceNumbers,
boolean shuffleLandHexes,
int landAreaNumber,
boolean addToExistingLA,
int maxPl,
SOCGameOption optBC,
java.lang.String scen)
For makeNewBoard(Map) , place the land hexes, number, and robber,
after shuffling landHexType[]. |
private void |
makeNewBoard_removeLegalNodes(int[] nodeCoords,
int landAreaNumber,
int addNodeListNumber,
boolean emptyPartAfterInitPlace)
For makeNewBoard(Map) , remove some nodes from legal/potential initial placement
locations. |
void |
makeNewBoard(java.util.Map<java.lang.String,SOCGameOption> opts)
Shuffle the hex tiles and layout a board. |
int |
movePirateHexAlongPath(int numSteps)
For game scenario option _SC_PIRI ,
move the pirate fleet's position along its path. |
void |
startGame_putInitPieces(SOCGame ga)
For scenario game option _SC_PIRI ,
place each player's initial pieces. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
private java.util.Stack<java.lang.Integer> drawStack
_SC_FTRI
,
dev cards or other items waiting to be claimed by any player.
Otherwise null.
Initialized in startGame_putInitPieces(SOCGame)
based on game options.
Accessed with drawItemFromStack()
.
In _SC_FTRI
, each item is a SOCDevCardConstants
card type.
private int piratePathIndex
_SC_PIRI
,
the pirate fleet's position on its path (PP). Otherwise unused.
movePirateHexAlongPath(int)
private static final int[] PORT_EDGE_FACING_MAINLAND_4PL
FACING_E
, etc.
Port Facing is the direction from the port edge, to the land hex touching it which will have 2 nodes where a port settlement/city can be built.
private static final int[] PORT_EDGE_FACING_ISLANDS_4PL
private static final int[] PORT_TYPE_ISLANDS_4PL
SOCBoard.PORTS_TYPE_V1
.
private static final int[] LANDHEX_DICEPATH_MAINLAND_4PL
SOCBoard.makeNewBoard_diceNums_v1
.
LANDHEX_COORD_MAINLAND
private static final int[] LANDHEX_COORD_MAINLAND
LANDHEX_DICEPATH_MAINLAND_4PL
private static final int[] LANDHEX_COORD_ISLANDS_ALL_4PL
The first outlying island (land area 2) is upper-right on board. Second island (landarea 3) is lower-right. Third island (landarea 4) is lower-left.
LANDHEX_COORD_ISLANDS_EACH
,
LANDHEX_LANDAREA_RANGES_ISLANDS_4PL
private static final int[][] LANDHEX_COORD_ISLANDS_EACH
LANDHEX_COORD_ISLANDS_ALL_4PL
,
LANDHEX_LANDAREA_RANGES_ISLANDS_4PL
private static final int[] LANDHEX_LANDAREA_RANGES_ISLANDS_4PL
LANDHEX_COORD_ISLANDS_ALL_4PL
.
Allows us to shuffle them all together (LANDHEX_TYPE_ISLANDS_4PL
).
LANDHEX_COORD_ISLANDS_EACH
private static final int[] LANDHEX_TYPE_ISLANDS_4PL
SOCBoard.makeNewBoard_landHexTypes_v1
[].
private static final int[] LANDHEX_DICENUM_ISLANDS_4PL
private static final int[] LANDHEX_DICEPATH_MAINLAND_6PL
SOCBoard.makeNewBoard_diceNums_v2
.
private static final int[] PORT_EDGE_FACING_MAINLAND_6PL
FACING_E
, etc.
Port Facing is the direction from the port edge, to the land hex touching it which will have 2 nodes where a port settlement/city can be built.
private static final int[] LANDHEX_COORD_ISLANDS_ALL_6PL
The first outlying island (land area 2) is upper-right on board. Second island (landarea 3) is lower-right. Third island (landarea 4) is lower-left.
LANDHEX_LANDAREA_RANGES_ISLANDS_6PL
private static final int[] LANDHEX_LANDAREA_RANGES_ISLANDS_6PL
LANDHEX_COORD_ISLANDS_ALL_4PL
.
Allows us to shuffle them all together (LANDHEX_TYPE_ISLANDS_6PL
).
LANDHEX_COORD_ISLANDS_EACH
private static final int[] LANDHEX_TYPE_ISLANDS_6PL
SOCBoard.makeNewBoard_landHexTypes_v2
[].
private static final int[] LANDHEX_DICENUM_ISLANDS_6PL
private static final int[] PORT_EDGE_FACING_ISLANDS_6PL
private static final int[] PORT_TYPE_ISLANDS_6PL
SOCBoard.PORTS_TYPE_V2
.
private static final int[] NSHO_BOARDSIZE
private static final int[] NSHO_PIRATE_HEX
private static final int[][] NSHO_LANDHEX_TYPE_MAIN
private static final int[][] NSHO_LANDHEX_COORD_MAIN
NSHO_DICENUM_MAIN
.
Land hex types (shuffled) are NSHO_LANDHEX_TYPE_MAIN
.
NSHO_LANDHEX_COORD_ISL
private static final int[][] NSHO_DICENUM_MAIN
NSHO_LANDHEX_COORD_MAIN
.
Shuffled for 3-player board only.
NSHO_DICENUM_ISL
private static final int[][] NSHO_PORT_EDGE_FACING
Clockwise, starting at northwest corner of board. Each port has 2 elements: Edge coordinate (0xRRCC), Port Facing.
Port Facing is the direction from the port edge, to the land hex touching it which will have 2 nodes where a port settlement/city can be built.
Port types (NSHO_PORT_TYPE
) are shuffled.
private static final int[][] NSHO_PORT_TYPE
private static final int[][] NSHO_LANDHEX_TYPE_ISL
private static final int[][] NSHO_LANDHEX_LANDAREA_RANGES
NSHO_LANDHEX_COORD_ISL
.
Allows them to be defined, shuffled, and placed together.
private static final int[][] NSHO_LANDHEX_COORD_ISL
NSHO_LANDHEX_LANDAREA_RANGES
.
Dice numbers on the islands (shuffled together) are NSHO_DICENUM_ISL
.
NSHO_LANDHEX_COORD_MAIN
private static final int[][] NSHO_DICENUM_ISL
NSHO_LANDHEX_COORD_ISL
). Shuffled.
NSHO_DICENUM_MAIN
private static final int[] FOG_ISL_LANDHEX_TYPE_MAIN_3PL
private static final int[] FOG_ISL_LANDHEX_COORD_MAIN_3PL
private static final int[] FOG_ISL_DICENUM_MAIN_3PL
private static final int[] FOG_ISL_PORT_EDGE_FACING_3PL
Port Facing is the direction from the port edge, to the land hex touching it which will have 2 nodes where a port settlement/city can be built.
Each port's type will be FOG_ISL_PORT_TYPE_3PL
.
private static final int[] FOG_ISL_PORT_TYPE_3PL
FOG_ISL_PORT_EDGE_FACING_3PL
.
private static final int[] FOG_ISL_LANDHEX_TYPE_FOG
private static final int[] FOG_ISL_LANDHEX_COORD_FOG_3PL
FOG_ISL_LANDHEX_TYPE_FOG
.
private static final int[] FOG_ISL_DICENUM_FOG_3PL
private static final int FOG_ISL_BOARDSIZE_4PL
private static final int[] FOG_ISL_LANDHEX_TYPE_MAIN_4PL
private static final int[] FOG_ISL_LANDHEX_COORD_MAIN_4PL
private static final int[] FOG_ISL_DICENUM_MAIN_4PL
private static final int[] FOG_ISL_PORT_EDGE_FACING_4PL
Port Facing is the direction from the port edge, to the land hex touching it which will have 2 nodes where a port settlement/city can be built.
Each port's type will be FOG_ISL_PORT_TYPE_4PL
.
private static final int[] FOG_ISL_PORT_TYPE_4PL
FOG_ISL_PORT_EDGE_FACING_4PL
.
private static final int[] FOG_ISL_LANDHEX_COORD_FOG_4PL
FOG_ISL_LANDHEX_TYPE_FOG
.
private static final int[] FOG_ISL_DICENUM_FOG_4PL
private static final int FOG_ISL_BOARDSIZE_6PL
private static final int[] FOG_ISL_LANDHEX_TYPE_MAIN_6PL
private static final int[] FOG_ISL_LANDHEX_COORD_MAIN_6PL
private static final int[] FOG_ISL_DICENUM_MAIN_6PL
private static final int[] FOG_ISL_PORT_EDGE_FACING_6PL
Port Facing is the direction from the port edge, to the land hex touching it which will have 2 nodes where a port settlement/city can be built.
Each port's type will be from FOG_ISL_PORT_TYPE_6PL
which is shuffled.
private static final int[] FOG_ISL_PORT_TYPE_6PL
FOG_ISL_PORT_EDGE_FACING_6PL
.
private static final int[] FOG_ISL_LANDHEX_TYPE_FOG_6PL
private static final int[] FOG_ISL_LANDHEX_COORD_FOG_6PL
FOG_ISL_LANDHEX_TYPE_FOG_6PL
.
private static final int[] FOG_ISL_DICENUM_FOG_6PL
private static final int[] FOG_ISL_LANDHEX_TYPE_GC
private static final int[] FOG_ISL_LANDHEX_COORD_GC
private static final int[] FOG_ISL_DICENUM_GC
private static final int[] FOUR_ISL_PIRATE_HEX
private static final int[] FOUR_ISL_LANDHEX_TYPE_3PL
private static final int[] FOUR_ISL_LANDHEX_COORD_3PL
FOUR_ISL_LANDHEX_LANDAREA_RANGES_3PL
.
private static final int[] FOUR_ISL_DICENUM_3PL
private static final int[] FOUR_ISL_LANDHEX_LANDAREA_RANGES_3PL
FOUR_ISL_LANDHEX_COORD_3PL
.
Allows them to be defined, shuffled, and placed together.
private static final int[] FOUR_ISL_PORT_EDGE_FACING_3PL
Port Facing is the direction from the port edge, to the land hex touching it which will have 2 nodes where a port settlement/city can be built.
Each port's type will be from FOUR_ISL_PORT_TYPE_3PL
.
private static final int[] FOUR_ISL_PORT_TYPE_3PL
private static final int FOUR_ISL_BOARDSIZE_4PL
private static final int[] FOUR_ISL_LANDHEX_TYPE_4PL
private static final int[] FOUR_ISL_LANDHEX_COORD_4PL
private static final int[] FOUR_ISL_DICENUM_4PL
private static final int[] FOUR_ISL_LANDHEX_LANDAREA_RANGES_4PL
FOUR_ISL_LANDHEX_COORD_4PL
.
Allows them to be defined, shuffled, and placed together.
private static final int[] FOUR_ISL_PORT_EDGE_FACING_4PL
Each port's type will be from FOUR_ISL_PORT_TYPE_4PL
.
private static final int[] FOUR_ISL_PORT_TYPE_4PL
private static final int FOUR_ISL_BOARDSIZE_6PL
private static final int[] FOUR_ISL_LANDHEX_TYPE_6PL
private static final int[] FOUR_ISL_LANDHEX_COORD_6PL
private static final int[] FOUR_ISL_DICENUM_6PL
private static final int[] FOUR_ISL_LANDHEX_LANDAREA_RANGES_6PL
FOUR_ISL_LANDHEX_COORD_6PL
.
Allows them to be defined, shuffled, and placed together.
private static final int[] FOUR_ISL_PORT_EDGE_FACING_6PL
Each port's type will be from FOUR_ISL_PORT_TYPE_6PL
.
private static final int[] FOUR_ISL_PORT_TYPE_6PL
private static final int[] PIR_ISL_BOARDSIZE
private static final int[] PIR_ISL_PIRATE_HEX
private static final int[][] PIR_ISL_LANDHEX_TYPE_MAIN
private static final int[][] PIR_ISL_LANDHEX_COORD_MAIN
PIR_ISL_LANDHEX_TYPE_MAIN
, because they won't be shuffled.
private static final int[][] PIR_ISL_DICENUM_MAIN
PIR_ISL_LANDHEX_COORD_MAIN
.
private static final int[][] PIR_ISL_PORT_EDGE_FACING
Port Facing is the direction from the port edge, to the land hex touching it which will have 2 nodes where a port settlement/city can be built.
Each port's type will be PIR_ISL_PORT_TYPE
[i].
private static final int[][] PIR_ISL_PORT_TYPE
private static final int[][] PIR_ISL_LANDHEX_TYPE_PIRI
private static final int[][] PIR_ISL_LANDHEX_COORD_PIRI
PIR_ISL_LANDHEX_TYPE_PIRI
.
Only the first several have dice numbers (PIR_ISL_DICENUM_PIRI
).
private static final int[][] PIR_ISL_DICENUM_PIRI
PIR_ISL_LANDHEX_COORD_PIRI
private static final int[][] PIR_ISL_PPATH
piratePathIndex
is already 0.
private static final int[][][] PIR_ISL_SEA_EDGES
PIR_ISL_INIT_PIECES
(given out to non-vacant players, not strictly matching player number).
Note SOCPlayer.doesTradeRouteContinuePastNode(SOCBoard, boolean, int, int, int)
assumes there is just 1 legal sea edge, not 2, next to each player's free initial settlement,
so it won't need to check if the ship route would branch in 2 directions there.
See getLegalSeaEdges(SOCGame, int)
for how this is rearranged to be sent to
active player clients as part of a SOCPotentialSettlements
message,
and the format of each player's array.
private static final int[][] PIR_ISL_INIT_PIECES
PIR_ISL_SEA_EDGES
(given out to non-vacant players, not strictly matching player number).
Each player has 4 elements, starting at index 4 * playerNumber:
Initial settlement node, initial ship edge, pirate fortress node,
and the node on the pirate island where they are allowed to build
a settlement on the way to the fortress (layout part "LS").
private static final int[] TTDESERT_BOARDSIZE
private static final int[] TTDESERT_PIRATE_HEX
private static final int[][] TTDESERT_LANDHEX_TYPE_MAIN
The main island has just 1 GOLD_HEX, which will always be placed in landarea 2,
the small strip of land past the desert. This is handled by
makeNewBoard_placeHexes_arrangeGolds(int[], int[], String)
.
TTDESERT_LANDHEX_COORD_MAIN
private static final int[][] TTDESERT_LANDHEX_COORD_MAIN
TTDESERT_LANDHEX_COORD_DESERT
,
TTDESERT_LANDHEX_COORD_SMALL
private static final int[][] TTDESERT_LANDHEX_RANGES_MAIN
TTDESERT_LANDHEX_COORD_MAIN
.
Allows us to shuffle them all together within TTDESERT_LANDHEX_TYPE_MAIN
.
Dice numbers are TTDESERT_DICENUM_MAIN
.
Landarea 1 is most of the island.
Landarea 2 is the small fertile strip on the other side of the desert.
private static final int[][] TTDESERT_LANDHEX_COORD_DESERT
TTDESERT_LANDHEX_COORD_MAIN
private static final int[][] TTDESERT_DICENUM_MAIN
TTDESERT_LANDHEX_COORD_MAIN
.
TTDESERT_DICENUM_SMALL
private static final int[][] TTDESERT_PORT_EDGE_FACING
Port Facing is the direction from the port edge, to the land hex touching it which will have 2 nodes where a port settlement/city can be built.
Each port's type will be TTDESERT_PORT_TYPE
[i][j].
private static final int[][] TTDESERT_PORT_TYPE
TTDESERT_PORT_EDGE_FACING
[i][j].
private static final int[][] TTDESERT_LANDHEX_TYPE_SMALL
TTDESERT_LANDHEX_COORD_SMALL
.
private static final int[][] TTDESERT_LANDHEX_RANGES_SMALL
TTDESERT_LANDHEX_COORD_SMALL
.
Allows us to shuffle them all together within TTDESERT_LANDHEX_TYPE_SMALL
.
Dice numbers are TTDESERT_DICENUM_SMALL
.
Total land area count for this layout varies, will be 2 + (TTDESERT_LANDHEX_RANGES_SMALL[i].length / 2).
private static final int[][] TTDESERT_LANDHEX_COORD_SMALL
TTDESERT_LANDHEX_TYPE_SMALL
.
Dice numbers are TTDESERT_DICENUM_SMALL
.
Land area numbers are split up via TTDESERT_LANDHEX_RANGES_SMALL
.
private static final int[][] TTDESERT_DICENUM_SMALL
TTDESERT_LANDHEX_COORD_SMALL
).
TTDESERT_DICENUM_MAIN
private static final int[] FOR_TRI_BOARDSIZE
private static final int[] FOR_TRI_PIRATE_HEX
private static final int[][] FOR_TRI_LANDHEX_TYPE_MAIN
private static final int[][] FOR_TRI_LANDHEX_COORD_MAIN
FOR_TRI_LANDHEX_COORD_MAIN_FAR_COASTAL
.
private static final int[][] FOR_TRI_LANDHEX_COORD_MAIN_FAR_COASTAL
FOR_TRI_LANDHEX_COORD_MAIN
) on the short eastern side.
These shouldn't be given the favorable "red" dice numbers 6 or 8, nor 5 or 9.
private static final int[][] FOR_TRI_DICENUM_MAIN
private static final int[][] FOR_TRI_PORT_EDGE_FACING
Clockwise, starting at northwest corner of board. Each port has 2 elements: Edge coordinate (0xRRCC), Port Facing.
Port Facing is the direction from the port edge, to the land hex touching it which will have 2 nodes where a port settlement/city can be built.
Port types (FOR_TRI_PORT_TYPE
) are shuffled.
private static final int[][] FOR_TRI_PORT_TYPE
private static final int[][] FOR_TRI_LANDHEX_TYPE_ISL
FOR_TRI_LANDHEX_COORD_ISL
.
private static final int[][] FOR_TRI_LANDHEX_COORD_ISL
FOR_TRI_LANDHEX_TYPE_ISL
.
None have dice numbers.
private static final int[][] FOR_TRI_SVP_EDGES
"VE"
.
private static final int[][] FOR_TRI_DEV_CARD_EDGES
"CE"
.
private static final int[] CLVI_BOARDSIZE
private static final int[] CLVI_PIRATE_HEX
private static final int[][] CLVI_LANDHEX_TYPE_MAIN
private static final int[][] CLVI_LANDHEX_COORD_MAIN
private static final int[][] CLVI_DICENUM_MAIN
private static final int[][] CLVI_PORT_EDGE_FACING
West to east on each island. Each port has 2 elements: Edge coordinate (0xRRCC), Port Facing.
Port Facing is the direction from the port edge, to the land hex touching it which will have 2 nodes where a port settlement/city can be built.
Port types (CLVI_PORT_TYPE
) are shuffled.
private static final int[][] CLVI_PORT_TYPE
CLVI_PORT_EDGE_FACING
.
private static final int[][] CLVI_LANDHEX_TYPE_ISL
CLVI_LANDHEX_COORD_ISL
.
private static final int[][] CLVI_LANDHEX_COORD_ISL
CLVI_LANDHEX_TYPE_ISL
.
None have dice numbers.
Each has two villages, see CLVI_CLOTH_VILLAGE_AMOUNTS_NODES_DICE
.
private static final int[][] CLVI_CLOTH_VILLAGE_AMOUNTS_NODES_DICE
SOCVillage.STARTING_CLOTH
.
Further indexes are the locations and dice,
paired for each village: [i] = node, [i+1] = dice number.
SOCBoardLarge additional part "CV"
.
Each small island has two villages; the islands' coordinates are CLVI_LANDHEX_COORD_ISL
.
SOCGameOption.K_SC_CLVI
,
SOCBoardLarge.setVillageAndClothLayout(int[])
private static final int[] WOND_BOARDSIZE
private static final int[][] WOND_LANDHEX_TYPE_MAIN
private static final int[][] WOND_LANDHEX_COORD_MAIN
WOND_LANDHEX_COORD_DESERT
).
Dice numbers (shuffled) are WOND_DICENUM_MAIN
.
Main part on rows 7 and 9, with outlying parts north and south.
2 hexes included here adjacent to the desert are WOND_LANDHEX_COORD_MAIN_AT_DESERT
.
private static final int[][] WOND_LANDHEX_COORD_MAIN_AT_DESERT
WOND_LANDHEX_COORD_MAIN
)
adjacent to the deserts (WOND_LANDHEX_COORD_DESERT
).
These shouldn't be given the favorable "red" dice numbers 6 or 8.
private static final int[][] WOND_LANDHEX_COORD_DESERT
WOND_LANDHEX_COORD_MAIN
.
Main island hexes adjacent to the desert are WOND_LANDHEX_COORD_MAIN_AT_DESERT
.
private static final int[][] WOND_DICENUM_MAIN
WOND_DICENUM_ISL
.
private static final int[][] WOND_PORT_EDGE_FACING
North to South on main island. Each port has 2 elements: Edge coordinate (0xRRCC), Port Facing.
Port Facing is the direction from the port edge, to the land hex touching it which will have 2 nodes where a port settlement/city can be built.
Port types (WOND_PORT_TYPE
) are shuffled.
private static final int[][] WOND_PORT_TYPE
WOND_PORT_EDGE_FACING
.
private static final int[][] WOND_LANDHEX_TYPE_ISL
WOND_LANDHEX_COORD_ISL
.
Dice numbers are WOND_DICENUM_ISL
.
private static final int[][] WOND_LANDHEX_COORD_ISL
WOND_LANDHEX_TYPE_ISL
.
Dice numbers are WOND_DICENUM_ISL
.
private static final int[][] WOND_DICENUM_ISL
WOND_LANDHEX_COORD_ISL
.
Not shuffled.
private static final int[][][] WOND_SPECIAL_NODES
SOCBoardLarge additional parts "N1", "N2", "N3"
.
Constructor Detail |
---|
public SOCBoardLargeAtServer(java.util.Map<java.lang.String,SOCGameOption> gameOpts, int maxPlayers, IntPair boardHeightWidth) throws java.lang.IllegalArgumentException
SOCBoardLargeAtServer.BoardFactoryAtServer.createBoard(Map, boolean, int)
to get the right board size and layout based on game options and optional SOCScenario
.
The board will be empty (all hexes are water, no dice numbers on any hex).
The layout contents are set up later by calling makeNewBoard(Map)
when the game is about to begin,
see SOCBoardLarge
class javadoc for how the layout is sent to clients.
gameOpts
- Game's options if any, otherwise nullmaxPlayers
- Maximum players; must be 4 or 6boardHeightWidth
- Board's height and width.
The constants for default size are SOCBoardLarge.BOARDHEIGHT_LARGE
, SOCBoardLarge.BOARDWIDTH_LARGE
.
java.lang.IllegalArgumentException
- if maxPlayers is not 4 or 6, or boardHeightWidth is nullMethod Detail |
---|
public java.lang.Integer drawItemFromStack()
SOCBoardLarge
This is called at server, but not at client; client instead receives messages from the server
when the player claims such an item. It's declared here in SOCBoardLarge instead of
SOCBoardLargeAtServer
so that game methods can call it without importing the server-side class.
In _SC_FTRI
, each item is a SOCDevCardConstants
card type.
drawItemFromStack
in class SOCBoardLarge
null
if empty or unusedpublic int movePirateHexAlongPath(int numSteps) throws java.lang.IllegalStateException
_SC_PIRI
,
move the pirate fleet's position along its path.
Calls setPirateHex(newHex, true)
.
If the pirate fleet is already defeated (all fortresses recaptured), returns 0.
movePirateHexAlongPath
in class SOCBoardLarge
numSteps
- Number of steps to move along the path
java.lang.IllegalStateException
- if this board doesn't have layout part "PP" for the Pirate Path.public void makeNewBoard(java.util.Map<java.lang.String,SOCGameOption> opts)
SOCBoardLarge.getLegalAndPotentialSettlements()
).
Sets up any Added Layout Parts such as "PP", "CE", "VE", "N1"
, etc.
This is called at server, but not at client;
client instead calls methods such as SOCBoardLarge.setLandHexLayout(int[])
and SOCBoardLarge.setLegalAndPotentialSettlements(Collection, int, HashSet[])
,
see SOCBoardLarge
class javadoc.
makeNewBoard
in class SOCBoardLarge
opts
- Game options
, which may affect
tile placement on board, or null. opts must be
the same as passed to constructor, and thus give the same size and layout
(same SOCBoard.getBoardEncodingFormat()
).private final void makeNewBoard_placeHexes(int[] landHexType, int[] landPath, int[] number, boolean shuffleDiceNumbers, boolean shuffleLandHexes, int landAreaNumber, boolean addToExistingLA, int maxPl, SOCGameOption optBC, java.lang.String scen) throws java.lang.IllegalStateException, java.lang.IllegalArgumentException
makeNewBoard(Map)
, place the land hexes, number, and robber,
after shuffling landHexType[].
Sets robberHex, contents of hexLayoutLg[] and numberLayoutLg[].
Adds to SOCBoardLarge.landHexLayout
and SOCBoard.nodesOnLand
.
Also checks vs game option BC: Break up clumps of # or more same-type hexes/ports
(for land hex resource types).
If landAreaNumber != 0, also adds to SOCBoardLarge.landAreasLegalNodes
.
Called from makeNewBoard(Map)
at server only; client has its board layout sent from the server.
For the board layout geometry, see the SOCBoardLarge
class javadoc's "Coordinate System" section.
This method does not clear out SOCBoardLarge.hexLayoutLg
or SOCBoardLarge.numberLayoutLg
before it starts placement. You can call it multiple times to set up multiple
areas of land hexes: Call once for each land area.
If scenario requires some nodes to be removed from legal placement, after the last call to this method
call makeNewBoard_removeLegalNodes(int[], int, int, boolean)
.
This method clears SOCBoardLarge.cachedGetLandHexCoords
to null.
landHexType
- Resource type to place into SOCBoardLarge.hexLayoutLg
for each land hex; will be shuffled.
Values are SOCBoard.CLAY_HEX
, SOCBoard.DESERT_HEX
, etc.
There should be no SOCBoardLarge.FOG_HEX
in here; land hexes are hidden by fog later.landPath
- Coordinates within SOCBoardLarge.hexLayoutLg
(also within SOCBoardLarge.numberLayoutLg
) for each land hex;
same array length as landHexType[]number
- Numbers to place into SOCBoardLarge.numberLayoutLg
for each land hex;
array length is landHexType[].length minus 1 for each desert in landHexType[].
If only some land hexes have dice numbers, number[] can be shorter; each
number[i] will be placed at landPath[i] until i >= number.length.
Can be null if none of these land hexes have dice numbers.shuffleDiceNumbers
- If true, shuffle the dice numbers before placing along landPath.
Also only if true, calls
makeNewBoard_placeHexes_moveFrequentNumbers(int[], ArrayList, int, String)
to make sure 6s, 8s aren't adjacent and gold hexes aren't on 6 or 8.
number[] must not be null.shuffleLandHexes
- If true, shuffle landHexType[] before placing along landPath.landAreaNumber
- 0 unless there will be more than 1 Land Area (group of islands).
If != 0, updates SOCBoardLarge.landAreasLegalNodes
[landAreaNumber]
with the same nodes added to SOCBoard.nodesOnLand
.addToExistingLA
- True if landAreaNumber
already has hexes and nodes, and landPath[]
contents should be added to it. Ignored if landAreaNumber == 0
.
Otherwise this should always be false
, to avoid typos and cut-and-paste
errors with Land Area numbers.maxPl
- For scenario boards, use 3-player or 4-player or 6-player layout?
Always tests maxPl for ==6 or < 4; actual value may be 6, 4, 3, or 2.optBC
- Game option "BC" from the options for this board, or null.scen
- Game scenario, such as SOCScenario.K_SC_FTRI
, or "";
some scenarios might want special distribution of certain hex types or dice numbers.
Handled via makeNewBoard_placeHexes_moveFrequentNumbers(int[], ArrayList, int, String)
.
java.lang.IllegalStateException
- if landAreaNumber != 0 and either
SOCBoardLarge.landAreasLegalNodes
== null, or not long enough, or
SOCBoardLarge.landAreasLegalNodes
[landAreaNumber] != null
because the land area has already been placed.
To avoid this exception if the second placement is deliberate, call with addToExistingLA
true.
java.lang.IllegalArgumentException
- if landHexType contains SOCBoardLarge.FOG_HEX
,
or if landHexType.length != landPath.length.makeNewBoard_placeHexes(int[], int[], int[], boolean, boolean, int[], boolean, int, SOCGameOption, String)
private final void makeNewBoard_placeHexes(int[] landHexType, int[] landPath, int[] number, boolean shuffleDiceNumbers, boolean shuffleLandHexes, int[] landAreaPathRanges, boolean addToExistingLA, int maxPl, SOCGameOption optBC, java.lang.String scen) throws java.lang.IllegalStateException, java.lang.IllegalArgumentException
makeNewBoard(Map)
, place the land hexes, number, and robber
for multiple land areas, after shuffling their common landHexType[].
Sets robberHex, contents of hexLayoutLg[] and numberLayoutLg[].
Adds to SOCBoardLarge.landHexLayout
and SOCBoard.nodesOnLand
.
Also checks vs game option BC: Break up clumps of # or more same-type hexes/ports
(for land hex resource types).
If Land Area Number != 0, also adds to SOCBoardLarge.landAreasLegalNodes
.
Called from makeNewBoard(Map)
at server only; client has its board layout sent from the server.
This method does not clear out SOCBoardLarge.hexLayoutLg
or SOCBoardLarge.numberLayoutLg
before it starts placement. You can call it multiple times to set up multiple
areas of land hexes: Call once for each group of Land Areas which shares a landPath and landHexType.
For each land area, it updates SOCBoardLarge.landAreasLegalNodes
[landAreaNumber]
with the same nodes added to SOCBoard.nodesOnLand
.
If only some parts of a Land Area should be shuffled: Call once with the hex coordinates of the shuffled part,
with shuffleDiceNumbers
and/or shuffleLandHexes
true. Then, call again with the coordinates of
the non-shuffled hexes, with shuffleLandHexes
false and addToExistingLA
true.
If part of the board will be hidden by SOCBoardLarge.FOG_HEX
, wait before doing that:
This method must shuffle and place the unobscured land hexes.
After the last call to makeNewBoard_placeHexes, call
makeNewBoard_hideHexesInFog(int[])
.
If scenario requires some nodes to be removed from legal placement, after the last call to this method
call makeNewBoard_removeLegalNodes(int[], int, int, boolean)
.
This method clears SOCBoardLarge.cachedGetLandHexCoords
to null.
landHexType
- Resource type to place into SOCBoardLarge.hexLayoutLg
for each land hex; will be shuffled.
Values are SOCBoard.CLAY_HEX
, SOCBoard.DESERT_HEX
, etc.
There should be no SOCBoardLarge.FOG_HEX
in here; land hexes are hidden by fog later.
For the Fog Island (scenario option _SC_FOG
),
one land area contains some water. So, landHexType[] may contain SOCBoard.WATER_HEX
.landPath
- Coordinates within SOCBoardLarge.hexLayoutLg
(also within SOCBoardLarge.numberLayoutLg
) for each hex to place;
same array length as landHexType[]
. May contain WATER_HEX
.
landAreaPathRanges[]
tells how to split this array of hex coordinates
into multiple Land Areas.number
- Numbers to place into SOCBoardLarge.numberLayoutLg
for each land hex;
array length is landHexType[].length minus 1 for each desert or water in landHexType[]
if every land hex has a dice number.
If only some land hexes have dice numbers, number[] can be shorter; each
number[i] will be placed at landPath[i] until i >= number.length.
Can be null if none of these land hexes have dice numbers.shuffleDiceNumbers
- If true, shuffle the dice numbers before placing along landPath.
number[] must not be null.shuffleLandHexes
- If true, shuffle landHexType[] before placing along landPath.landAreaPathRanges
- landPath[]'s Land Area Numbers, and the size of each land area.
Array length is 2 x the count of land areas included.
Index 0 is the first landAreaNumber, index 1 is the length of that land area (number of hexes).
Index 2 is the next landAreaNumber, index 3 is that one's length, etc.
The sum of those lengths must equal landPath.length.
Use landarea number 0 for hexes which will not have a land area.addToExistingLA
- True if the land area number already has hexes and nodes, and landPath[]
contents should be added to it. Ignored if land area number == 0.
Otherwise this should always be false
, to avoid typos and cut-and-paste
errors with Land Area numbers.maxPl
- For scenario boards, use 3-player or 4-player or 6-player layout?
Always tests maxPl for ==6 or < 4; actual value may be 6, 4, 3, or 2.optBC
- Game option "BC" from the options for this board, or null.scen
- Game scenario, such as SOCScenario.K_SC_FTRI
, or "";
some scenarios might want special distribution of certain hex types or dice numbers.
Handled via makeNewBoard_placeHexes_moveFrequentNumbers(int[], ArrayList, int, String)
.
java.lang.IllegalStateException
- if land area number != 0 and either
SOCBoardLarge.landAreasLegalNodes
== null, or not long enough, or any
SOCBoardLarge.landAreasLegalNodes
[landAreaNumber] != null
because the land area has already been placed.
To avoid this exception if the second placement is deliberate, call with addToExistingLA
true.
java.lang.IllegalArgumentException
- if landAreaPathRanges is null or has an uneven length, SOCBoardLarge.FOG_HEX
, SOCBoard.makeNewBoard_checkLandHexResourceClumps(Vector, int)
finds an invalid or uninitialized hex coordinate (hex type -1)makeNewBoard_placeHexes(int[], int[], int[], boolean, boolean, int, boolean, int, SOCGameOption, String)
private final void makeNewBoard_placeHexes_arrangeGolds(int[] hexCoords, int[] landAreaPathRanges, java.lang.String scen)
makeNewBoard(Map)
, after placing
land hexes and dice numbers into SOCBoardLarge.hexLayoutLg
,
fine-tune the randomized gold hex placement:
SC_TTD
, ensure the main island's only GOLD_HEX
is placed in land area 2, the small strip of land past the desert.
hexCoords
- All hex coordinates being shuffled; includes gold hexes and non-gold hexes, may include waterlandAreaPathRanges
- landPath[]'s Land Area Numbers, and the size of each land area;
see this parameter's javadoc at
makeNewBoard_placeHexes(int[], int[], int[], boolean, boolean, int[], boolean, int, SOCGameOption, String)
.scen
- Game scenario, such as SOCScenario.K_SC_TTD
, or "";
some scenarios might want special distribution of certain hex types or dice numbers.private final int makeNewBoard_placeHexes_arrGolds_addToAdjacList(java.util.HashMap<java.lang.Integer,java.util.List<java.lang.Integer>> goldAdjacGold, java.lang.Integer hex0, java.lang.Integer hex1)
goldAdjacGold
- Map from gold hexes to their adjacent gold hexeshex0
- Hex coordinate that will have a list of adjacents in goldAdjacGoldhex1
- Hex coordinate to add to hex0's list
private final void makeNewBoard_placeHexes_arrGolds_swapWithRandom(java.lang.Integer goldHex, java.util.HashSet<java.lang.Integer> nonAdjac, java.util.HashMap<java.lang.Integer,java.util.List<java.lang.Integer>> goldAdjacGold) throws java.lang.IllegalArgumentException
goldHex
- Coordinate of gold hex to swapnonAdjac
- All land hexes not currently adjacent to a gold hex;
should not include coordinates of any WATER_HEX
goldAdjacGold
- Map of golds adjacent to each other
java.lang.IllegalArgumentException
- if goldHex coordinates in hexLayoutLg aren't GOLD_HEXprivate final boolean makeNewBoard_placeHexes_moveFrequentNumbers(int[] landPath, java.util.ArrayList<java.lang.Integer> redHexes, int maxPl, java.lang.String scen) throws java.lang.IllegalStateException
makeNewBoard(Map)
, after placing
land hexes and dice numbers into hexLayoutLg
and numberLayoutLg
,
separate adjacent "red numbers" (6s, 8s)
and make sure gold hex dice aren't too frequent.
For algorithm details, see comments in this method and
makeNewBoard_placeHexes_moveFrequentNumbers_checkSpecialHexes(int[], ArrayList, int, String)
.
Call makeNewBoard_placeHexes_arrangeGolds(int[], int[], String)
before this
method, not after, so that gold hexes will already be in their final locations.
If using SOCBoardLarge.FOG_HEX
, no fog should be on the
board when calling this method: Don't call after
makeNewBoard_hideHexesInFog(int[])
.
landPath
- Final coordinates for each hex being placed; may contain waterredHexes
- Hex coordinates of placed "red" (frequent) dice numbers (6s, 8s)maxPl
- For scenario boards, use 3-player or 4-player or 6-player layout?
Always tests maxPl for ==6 or < 4; actual value may be 6, 4, 3, or 2.scen
- Game scenario, such as SOCScenario.K_SC_4ISL
, or "";
some scenarios might want special distribution of certain hex types or dice numbers.
Currently recognized here: SOCScenario.K_SC_FTRI
, SOCScenario.K_SC_WOND
.
java.lang.IllegalStateException
- if a SOCBoardLarge.FOG_HEX
is foundprivate final void makeNewBoard_placeHexes_moveFrequentNumbers_buildArrays(int[] landPath, java.util.ArrayList<java.lang.Integer> redHexes, java.util.HashSet<java.lang.Integer> ignoreHexes, java.util.HashSet<java.lang.Integer> otherCoastalHexes, java.util.HashSet<java.lang.Integer> otherHexes, java.lang.String scen, java.util.HashSet<java.lang.Integer> otherHexesForScen) throws java.lang.IllegalStateException
makeNewBoard_placeHexes_moveFrequentNumbers(int[], ArrayList, int, String)
.
Together, otherCoastalHexes and otherHexes are all land hexes in landPath not adjacent to redHexes.
otherCoastalHexes holds ones at the edge of the board,
which have fewer adjacent land hexes, and thus less chance of
taking up the last available non-adjacent places.
Water, desert, and gold hexes won't be added to either set.
landPath
- Coordinates for each hex being placed; may contain waterredHexes
- Hex coordinates of placed "red" (frequent) dice numbers (6s, 8s)ignoreHexes
- Hex coordinates to ignore in adjacency checks while building
otherCoastalHexes
and otherHexes
and to leave out of those
sets, or null
. Used only in certain scenarios where any red number
on these hexes will definitely be moved elsewhere.otherCoastalHexes
- Empty set to build hereotherHexes
- Empty set to build herescen
- Game scenario, such as SOCScenario.K_SC_4ISL
, or "" or null;
some scenarios might want special distribution of certain hex types or dice numbers.
SOCScenario.K_SC_FTRI
- Build a set of hexes from landPath
which have
a dice number other than 5, 6, 8, or 9, excluding ignoreHexes
otherHexesForScen
- Empty set to build here for some scenarios, see scen
for list and details;
normally this parameter is null
java.lang.IllegalStateException
- if a SOCBoardLarge.FOG_HEX
is foundprivate java.util.HashSet<java.lang.Integer> makeNewBoard_placeHexes_moveFrequentNumbers_checkSpecialHexes(int[] landPath, java.util.ArrayList<java.lang.Integer> redHexes, int maxPl, java.lang.String scen)
makeNewBoard_placeHexes_moveFrequentNumbers(int[], ArrayList, int, String)
won't move any red numbers back onto them.
landPath
- Coordinates for each hex being placed; may contain waterredHexes
- Hex coordinates of placed "red" (frequent) dice numbers (6s, 8s);
updated here if anything is moved.maxPl
- For scenario boards, use 3-player or 4-player or 6-player layout?
Always tests maxPl for ==6 or < 4; actual value may be 6, 4, 3, or 2.scen
- Game scenario, such as SOCScenario.K_SC_FTRI
, or "";
some scenarios might want special distribution of certain hex types or dice numbers.
Currently recognized here: SOCScenario.K_SC_FTRI
, SOCScenario.K_SC_WOND
.
null
private final IntTriple makeNewBoard_placeHexes_moveFrequentNumbers_swapOne(int swaphex, int swapi, java.util.ArrayList<java.lang.Integer> redHexes, java.util.HashSet<java.lang.Integer> ignoreHexes, java.util.HashSet<java.lang.Integer> otherCoastalHexes, java.util.HashSet<java.lang.Integer> otherHexes)
makeNewBoard_placeHexes_moveFrequentNumbers(int[], ArrayList, int, String)
.
If we can, pick a hex in otherCoastalHexes or otherHexes, swap and remove swaphex
from redHexes, then remove/add hexes from/to otherCoastalHexes, otherHexes, redHexes.
See comments for details.
This method's primary use case is un-clumping "red" dice numbers by moving them to other hexes from otherCoastalHexes or otherHexes, and updating related sets and data structures. It can also swap non-red dice number hexes with random hexes from a single set instead of those two. If calling for that, set otherHexes to null; if swaphex isn't a member of redHexes, use -1 for swapi. When otherHexes is null, the hexes adjacent to swaphex will never be added to otherCoastalHexes, but the new location of a red number and its adjacent hexes will still be removed from otherCoastalHexes.
swaphex
- Hex coordinate with a frequent number that needs to be swapped.
Must not be a member of otherCoastalHexes or otherHexes.swapi
- Index of swaphex within redHexes;
this is for convenience because the caller is iterating through redHexes,
and this method might remove elements below swapi.
See return value "index delta".
If swaphex isn't a red number and isn't in redHexes, use -1.redHexes
- Hex coordinates of placed "red" (frequent) dice numbers.
Treated here as a worklist for the caller: The old location swapHex is removed from
redHexes, and its adjacents might also be removed if they no longer have adjacent
reds and so don't need to be moved. The new location isn't added to redHexes.ignoreHexes
- Hex coordinates to never add to otherCoastalHexes or otherHexes,
or null. Used only in certain scenarios where any red number or 5 or 9 on these hexes has
been moved elsewhere, and no dice number should be swapped with it. No hex that's a member of
ignoreHexes may be a member of otherCoastalHexes or otherHexes when called.otherCoastalHexes
- Land hexes not adjacent to "red" numbers, at the edge of the island,
for swapping dice numbers. Coastal hexes have fewer adjacent land hexes, and
thus less chance of taking up the last available non-adjacent places when swapped.
Should not contain gold, desert, or water hexes.
Swap locations are randomly chosen from this set unless empty.otherHexes
- Land hexes not adjacent to "red" numbers, not at the edge of the island.
Should not contain gold, desert, or water hexes. Can be null.
private final void makeNewBoard_checkPortLocationsConsistent(int[] portsLocFacing) throws java.lang.IllegalArgumentException
makeNewBoard(Map)
, check port locations and facings, and make sure
no port overlaps with a land hex. Each port's edge coordinate has 2 valid perpendicular
facing directions, and ports should be on a land/water edge, facing the land side.
Call this method after placing all land hexes.
portsLocFacing
- Array of port location edges and "port facing" directions
(FACING_NE
= 1, etc), such as PORT_EDGE_FACING_MAINLAND_4PL
.
Each port has 2 consecutive elements: Edge coordinate (0xRRCC), Port Facing (towards land).
java.lang.IllegalArgumentException
- If a port's facing direction isn't possible,
or its location causes its water portion to "overlap" land.
Stops with the first error, doesn't keep checking other ports afterwards.
The detail string will be something like:private void makeNewBoard_fillNodesOnLandFromHexes(int[] landHexCoords, int startIdx, int pastEndIdx, int landAreaNumber, boolean addToExistingLA) throws java.lang.IllegalStateException
makeNewBoard_placeHexes(int[], int[], int[], boolean, boolean, int[], boolean, int, SOCGameOption, String)
.
Can use all or part of a landHexCoords array.
Iterative: Can call multiple times, giving different hexes each time.
Each call will add those hexes to SOCBoard.nodesOnLand
.
If landAreaNumber != 0, also adds them to SOCBoardLarge.landAreasLegalNodes
.
Call this method once for each land area.
Before the first call, clear nodesOnLand.
If scenario requires some nodes to be removed from legal placement, after the last call to this method
call makeNewBoard_removeLegalNodes(int[], int, int, boolean)
.
landHexCoords
- Coordinates of a contiguous group of land hexes.
If startIdx and pastEndIdx partially use this array,
only that part needs to be contiguous, the rest of landHexCoords is ignored.
Any hex coordinates here which are SOCBoard.WATER_HEX
are ignored.startIdx
- First index to use within landHexCoords[]; 0 if using the entire arraypastEndIdx
- Just past the last index to use within landHexCoords[];
If this call uses landHexCoords up through its end, this is landHexCoords.lengthlandAreaNumber
- 0 unless there will be more than 1 Land Area (groups of islands).
If != 0, updates SOCBoardLarge.landAreasLegalNodes
[landAreaNumber]
with the same nodes added to SOCBoard.nodesOnLand
.addToExistingLA
- True if landAreaNumber
already has hexes and nodes, and landHexCoords[]
contents should be added to it. Ignored if landAreaNumber == 0
.
Otherwise this should always be false
.
java.lang.IllegalStateException
- if landAreaNumber != 0 and either
SOCBoardLarge.landAreasLegalNodes
== null, or not long enough, or
SOCBoardLarge.landAreasLegalNodes
[landAreaNumber] != nullSOCBoardLarge.initLegalRoadsFromLandNodes()
,
SOCBoardLarge.initLegalShipEdges()
private final void makeNewBoard_removeLegalNodes(int[] nodeCoords, int landAreaNumber, int addNodeListNumber, boolean emptyPartAfterInitPlace) throws java.lang.IllegalArgumentException
makeNewBoard(Map)
, remove some nodes from legal/potential initial placement
locations. Does not remove from nodesOnLand
.
Used in some scenarios (_SC_WOND
) after the last call to
makeNewBoard_placeHexes(int[], int[], int[], boolean, boolean, int, boolean, int, SOCGameOption, String)
.
To re-add nodes after initial placement, call SOCBoardLarge.addLegalNodes(int[], int)
.
This is done automatically by SOCGame.updateAtGameFirstTurn()
if the nodes are
in lists referenced from Added Layout Part "AL"
(see parameter addNodeListNumber
).
nodeCoords
- Nodes to remove from landAreasLegalNodes
[landAreaNumber
] and SOCBoardLarge.getLegalAndPotentialSettlements()
landAreaNumber
- Land Area to remove nodes from. If this is
startingLandArea
,
will also remove the nodes from potential initial settlement locations.addNodeListNumber
- If != 0, these nodes will be re-added to legal locations after initial placement.
Adds this node list number to Added Layout Part "AL"
and calls
setAddedLayoutPart("N" + addNodeListNumber, nodeCoords)
to add a Layout Part such as "N1"
, "N2"
, etc.
For details see "AL" in the "Other layout parts" section of the
SOCBoardLayout2
message javadoc.emptyPartAfterInitPlace
- If true, the Added Layout Part ("N1"
, "N2"
, etc) is used only
during initial placement, and its contents should be emptied after that
java.lang.IllegalArgumentException
- if landAreaNumber
<= 0 or addNodeListNumber
< 0protected void makeNewBoard_hideHexesInFog(int[] hexCoords) throws java.lang.IllegalStateException
makeNewBoard(Map)
, hide these hexes under SOCBoardLarge.FOG_HEX
to be revealed later.
The hexes will be stored in SOCBoardLarge.fogHiddenHexes
; their SOCBoardLarge.hexLayoutLg
and SOCBoardLarge.numberLayoutLg
elements will be set to SOCBoardLarge.FOG_HEX
and -1.
Does not remove anything from SOCBoard.nodesOnLand
or SOCBoardLarge.landAreasLegalNodes
.
To simplify the bot, client, and network, hexes can be hidden only during makeNewBoard, before the board layout is made and sent to the client.
hexCoords
- Coordinates of each hex to hide in the fog
java.lang.IllegalStateException
- if any hexCoord is already SOCBoardLarge.FOG_HEX
within SOCBoardLarge.hexLayoutLg
SOCBoardLarge.revealFogHiddenHexPrep(int)
private static int getBoardSize(java.util.Map<java.lang.String,SOCGameOption> gameOpts, int maxPlayers)
BoardFactoryAtServer.createBoard
:
The default size BOARDHEIGHT_LARGE
by
BOARDWIDTH_LARGE
,
unless gameOpts contains a scenario ("SC") whose layout has a custom height/width.
The fallback 6-player layout size is taller,
BOARDHEIGHT_LARGE
+ 3 by BOARDWIDTH_LARGE
.
gameOpts
- Game options, or nullmaxPlayers
- Maximum players; must be 4 or 6
"_BHW"
SOCBoardLarge.getBoardSize(Map, int)
public static final int[][] getLegalSeaEdges(SOCGame ga, int forPN)
_SC_PIRI
,
get the list of Legal Sea Edges arranged for the players not vacant.
Arranged in same player order as the Lone Settlement locations in Added Layout Part "LS"
.
ga
- Game data, for SOCGame.maxPlayers
and SOCGame.isSeatVacant(int)
forPN
- -1 for all players, or a specific player number
PIR_ISL_SEA_EDGES
, containing either
one array when forPN
!= -1, or an array for each
player from 0 to ga.maxPlayers
, where vacant players
get empty subarrays of length 0.
Each player's list is their individual edge coordinates and/or ranges. Ranges are designated by a pair of positive,negative numbers: 0xC04, -0xC0D is a range of the valid edges from C04 through C0D inclusive.
If game doesn't have SOCGameOption.K_SC_PIRI
, returns null
.
startGame_putInitPieces(SOCGame)
public void startGame_putInitPieces(SOCGame ga)
_SC_PIRI
,
place each player's initial pieces. For _SC_FTRI
,
set aside some dev cards to be claimed later at Special Edges.
Otherwise do nothing.
For _SC_PIRI
, also calls each player's SOCPlayer.addLegalSettlement(int, boolean)
for their Lone Settlement location (adds layout part "LS").
Vacant player numbers get 0 for their "LS"
element.
Called only at server. For a method called during game start
at server and clients, see SOCGame.updateAtBoardLayout()
.
Called from SOCGameHandler.startGame(SOCGame)
for those
scenario game options; if you need it called for your game, add
a check there for your scenario's SOCGameOption
.
This is called after makeNewBoard(Map)
and before
SOCGameHandler.getBoardLayoutMessage(soc.game.SOCGame)
. So if needed,
it can call SOCBoardLarge.setAddedLayoutPart(String, int[])
.
If ship placement is restricted by the scenario, please call each player's
SOCPlayer.setRestrictedLegalShips(int[])
before calling this method,
so the legal and potential arrays will be initialized.
getLegalSeaEdges(SOCGame, int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |