Package net.sf.freecol.server.generator
Class ColonizationMapLoader
- java.lang.Object
-
- net.sf.freecol.server.generator.ColonizationMapLoader
-
- All Implemented Interfaces:
MapLoader
public class ColonizationMapLoader extends java.lang.Object implements MapLoader
Just pass the name of a Colonization map file (with extension ".MP"). The map file starts with a six-byte header. Byte zero encodes the map width, byte two encodes the map height. The function of the other bytes is unknown, their values, however, are fixed. The header is followed by three "layers", each the size of the map. The first "layer" encodes the terrain type. The function of the other layers is unknown. They are filled with zero bytes. It seems that the least significant three bits encode the basic terrain type, the next two bits encode the forest overlay and the special tile types ice, ocean and sea lanes. The three most significant bits encode combinations of the hill, mountain and river overlays. bits 0-2: tile type bit 3 (8): forest bit 4 (16): forest bits 3+4 (24): special, values larger than 26 are not defined bits 5-7: overlays 0: nothing 1: hill 2: minor river 3: hill + minor river (extremely rare) 4: nothing 5: mountain 6: major river 7: mountain + major river (never seen)
-
-
Field Summary
Fields Modifier and Type Field Description private static byte[]
header
A byte array of file headersstatic int
HEIGHT
static int
HIGH_SEAS
private byte[]
layer1
private static java.util.logging.Logger
logger
static int
OCEAN
private static java.lang.String[]
tiletypes
A String array of title types.static int
WIDTH
-
Constructor Summary
Constructors Constructor Description ColonizationMapLoader(java.io.File file)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map.Layer
getHighestLayer()
Returns the highest layer this MapLoader is able to load.Map.Layer
loadMap(Game game, Map.Layer layer)
Load a map into the given game, copying all layers up to the given layer.
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
WIDTH
public static final int WIDTH
- See Also:
- Constant Field Values
-
HEIGHT
public static final int HEIGHT
- See Also:
- Constant Field Values
-
OCEAN
public static final int OCEAN
- See Also:
- Constant Field Values
-
HIGH_SEAS
public static final int HIGH_SEAS
- See Also:
- Constant Field Values
-
tiletypes
private static final java.lang.String[] tiletypes
A String array of title types. Each represents a single type of tile available in FreeCol.
-
header
private static final byte[] header
A byte array of file headers
-
layer1
private byte[] layer1
-
-
Method Detail
-
loadMap
public Map.Layer loadMap(Game game, Map.Layer layer)
Load a map into the given game, copying all layers up to the given layer. Returns the highest layer actually copied, e.g. NONE if map loading failed, or the highest level available if an even higher level was requested.
-
getHighestLayer
public Map.Layer getHighestLayer()
Returns the highest layer this MapLoader is able to load.- Specified by:
getHighestLayer
in interfaceMapLoader
- Returns:
- The
Layer
value for RIVERS
-
-