# C-evo Map File Specification

Map file version 0

## File Structure

Offset | Length | Content | Description
0x0000 | 8 | Format ID | String "cEvoMap", ignored by program
0x0008 | 4 | Format version | Must be 0 for this specification
0x000C | 4 | MaxTurn | Reserved for future use
0x0010 | 4 | LX | Horizontal map size (number of tiles), min. 20, max. 100
0x0014 | 4 | LY | Vertical map size (number of tiles), max. 96
0x0018 | LX*LY*4 | Tiles | List of DWords defining the single tiles

## Tile Order

Due to this system, LX and LY have different scales. While LX counts double tile columns, LY only counts single tile rows.
LY must always be an even number.

## Tile Definition

Each tile is defined by a DWord which is a combination of its terrain type, tile improvement and optional flags.
Flags are also used to define the nation starting positions. These definitions are essential, a map can not be played by more players than it has starting positions.

Terrain types (exclude each other):

0x00 | Ocean |  | 0x24 | Prairie+Wheat
0x01 | Coast |  | 0x25 | Tundra+Gold
0x02 | Grassland |  | 0x26 | Arctic+Ivory
0x03 | Desert |  | 0x27 | Swamp+Peat
0x04 | Prairie |  | 0x29 | Forest+Game
0x05 | Tundra |  | 0x2A | Hills+Wine
0x06 | Arctic |  | 0x2B | Mountains+Iron
0x07 | Swamp |  | 0x41 | Coast+Manganese
0x09 | Forest |  | 0x43 | Desert+Oil
0x0A | Hills |  | 0x44 | Prairie+Bauxite
0x0B | Mountains |  | 0x45 | Tundra+Natural Gas
0x21 | Coast+Fish |  | 0x49 | Forest+Mineral Water
0x22 | Plains |  | 0x4A | Hills+Coal
0x23 | Desert+Oasis |  | 0x4B | Mountains+Diamonds

Tile improvements (exclude each other):

0x00001000 | Irrigation
0x00002000 | Farmland
0x00003000 | Mine
0x00004000 | Fort
0x00005000 | Military base

Tile flags:

0x00000080 | River
0x00000100 | Road
0x00000200 | Railroad
0x00000400 | Canal
0x00010000 | Pollution
0x01000000 | Dead Lands
0x03000000 | Cobalt
0x05000000 | Uranium
0x07000000 | Mercury
0x00200000 | Nation starting position, preferred for human players
0x00400000 | Normal nation starting position

## Restrictions

Some conditions which are not checked by the program but should be cared for:

- Several flag combinations are not allowed by the game rules, e.g. grassland with mine or a tile with both road and railroad. Such illegal constructions are likely to cause problems when playing the map.
- Ocean tiles should never be in the city radius of a potential city.
- Ocean and coast tiles can not have additional flags or improvements at all.
- Arctic tiles with rivers are not fully supported by the graphic engine.