
#define TERRAIN_BASE_FLAG LETTER FLAG IMAGE
[terrain_graphics]
	[tile]
		x=0
		y=0
		type="{LETTER}"
		has_flag={FLAG}
		[image]
			layer=-1000
			name={IMAGE}
		[/image]
	[/tile]
	no_flag="base"
	set_flag="base"
[/terrain_graphics]
#enddef


# This is more or less a hack that's used to remove a glitch.

#define TERRAIN_BASE_FLAG_IF_NOT_NORTH_OF_WATER LETTER FLAG IMAGE
[terrain_graphics]
map="
1
  .
2"
	[tile]
		pos=1
		type="{LETTER}"
		no_flag="base"
		set_flag="base"
		[image]
			layer=-1000
			name={IMAGE}
		[/image]
	[/tile]
	[tile]
		pos=2
		type=!kscZ\|/
	[/tile]
[/terrain_graphics]
#enddef

# Attachs an image to a single terrain tile, with a given probability.
# example: {TERRAIN_BASE_PROBABILITY g grassland-rocks 20}

#define TERRAIN_BASE_PROB_FL LETTER IMAGE PROB FLAG LAYER
[terrain_graphics]
	[tile]
		x=0
		y=0
		type="{LETTER}"
		[image]
			layer={LAYER}
			name={IMAGE}
		[/image]
	[/tile]

	probability={PROB}
	no_flag={FLAG}
	set_flag={FLAG}
[/terrain_graphics]
#enddef

# Same as above, but with 100% probability
# example: {TERRAIN_BASE g grassland}
# Should be last on the list: when a terrain has been placed, no other one can.

#define TERRAIN_BASE_FL LETTER IMAGE FLAG LAYER
{TERRAIN_BASE_PROB_FL ({LETTER}) {IMAGE} 100 {FLAG} {LAYER}}
#enddef

#define TERRAIN_BASE_PROB LETTER IMAGE PROB
{TERRAIN_BASE_PROB_FL ({LETTER}) {IMAGE} {PROB} base -1000}
#enddef
#define TERRAIN_BASE LETTER IMAGE
{TERRAIN_BASE_FL ({LETTER}) {IMAGE} base -1000}
#enddef
#define TERRAIN_BASE_PROB_OV LETTER IMAGE PROB
{TERRAIN_BASE_PROB_FL ({LETTER}) {IMAGE} {PROB} overlay -80}
#enddef
#define TERRAIN_BASE_OV LETTER IMAGE
{TERRAIN_BASE_FL ({LETTER}) {IMAGE} overlay -80}
#enddef

#define TERRAIN_BASE_DEFAULT IMAGE
[terrain_graphics]
	[tile]
		x=0
		y=0
		type=*
		[image]
			layer=-1000
			name={IMAGE}
		[/image]
	[/tile]
	no_flag="base"
	set_flag="base"
	precedence=9999
[/terrain_graphics]
#enddef

