

#define HIMG LAYER NAME
[image]
	name={NAME}
	position=horizontal
	layer={LAYER}
[/image]

#enddef

#define VIMG BASE NAME
[image]
	name={NAME}
	position=vertical
	base={BASE}
[/image]

#enddef

#define HIMG_NIGHT LAYER NAME NAME_NIGHT
[image]
	name={NAME}
	position=horizontal
	layer={LAYER}

	[variant]
		tod=dusk
		name={NAME_NIGHT}
	[/variant]
	[variant]
		tod=first_watch
		name={NAME_NIGHT}
	[/variant]
	[variant]
		tod=second_watch
		name={NAME_NIGHT}
	[/variant]
	[variant]
		tod=dawn
		name={NAME_NIGHT}
	[/variant]
[/image]

#enddef

#define VIMG_NIGHT BASE NAME NAME_NIGHT
[image]
	name={NAME}
	position=vertical
	base={BASE}

	[variant]
		tod=dusk
		name={NAME_NIGHT}
	[/variant]
	[variant]
		tod=first_watch
		name={NAME_NIGHT}
	[/variant]
	[variant]
		tod=second_watch
		name={NAME_NIGHT}
	[/variant]
	[variant]
		tod=dawn
		name={NAME_NIGHT}
	[/variant]
[/image]

#enddef

# This utility macro disables standard transitions on a given terrain type. It
# is used for castles and keeps, as those have custom transitions.

#define DISABLE_TRANSITIONS LETTER
[terrain_graphics]
	map="
  1
6   2
  7
5   3
  4
"
	[tile]
		pos=1
		set_flag=overlay-s,transition-s
	[/tile]
	[tile]
		pos=2
		set_flag=overlay-sw,transition-sw
	[/tile]
	[tile]
		pos=3
		set_flag=overlay-nw,transition-nw
	[/tile]
	[tile]
		pos=4
		set_flag=overlay-n,transition-n
	[/tile]
	[tile]
		pos=5
		set_flag=overlay-ne,transition-ne
    [/tile]
	[tile]
		pos=6
		set_flag=overlay-se,transition-se
	[/tile]
	[tile]
		pos=7
		type={LETTER}
	[/tile]
[/terrain_graphics]
#enddef

# Sets a specified flag to all hexes adjacent to a given type which is in turn
# adjacent to another given type. Used to set the transition2 flag for sunken
# keeps, so their cliff transition to water will be disabled.

#define SET_ADJACENT_FLAG CENTER_LETTER ADJACENT_LETTER ADJACENT_TO_LETTER FLAG
[terrain_graphics]
    map="
  2
.   .
  1
.   .
  ."

	[tile]
		pos=1
		type={CENTER_LETTER}
	[/tile]
	[tile]
		pos=2
		type={ADJACENT_LETTER}
		set_flag="adjacent_to_{ADJACENT_TO_LETTER}"
		no_flag="adjacent_to_{ADJACENT_TO_LETTER}"
	[/tile]

	rotations=n,ne,se,s,sw,nw
[/terrain_graphics]

[terrain_graphics]
    map="
  4
.   .
  3
.   .
  ."

	[tile]
		pos=3
		type={ADJACENT_LETTER}
		has_flag="adjacent_to_{ADJACENT_TO_LETTER}"
	[/tile]
	[tile]
		pos=4
		type={ADJACENT_TO_LETTER}
		no_flag={FLAG}-@R3
		set_flag={FLAG}-@R3
	[/tile]

	rotations=n,ne,se,s,sw,nw
[/terrain_graphics]
#enddef

# This utility macro sets a flag on a given terrain, if it is adjacent to an
# other terrain.
# Example:
# {FLAG_IF_ADJACENT K C keep-of-castle} makes flags all K tiles adjacent to C
# tiles with the keep-of-castle flag
#
# Use this to make other rule depend on adjacent terrain

#define FLAG_IF_ADJACENT LETTER ADJACENT FLAG CLASS
[terrain_graphics]
	[tile]
		x=0
		y=0
		type={LETTER}
		set_flag={FLAG},{CLASS}
		no_flag={CLASS}
	[/tile]
	[tile]
		x=0
		y=1
		type={ADJACENT}
	[/tile]
	rotations=x,x,x,x,x,x
[/terrain_graphics]
#enddef

#define FLAG_REMAINING LETTER FLAG CLASS
[terrain_graphics]
	[tile]
		x=0
		y=0
		type={LETTER}
		set_flag={FLAG},{CLASS}
		no_flag={CLASS}
	[/tile]
[/terrain_graphics]
#enddef

