#textdomain wesnoth

#define IMAGE_NW IMAGESTEM
    [image]
        name={IMAGESTEM}-nw
        base=63,144
        center=90,144
    [/image]
#enddef
#define IMAGE_N IMAGESTEM
    [image]
        name={IMAGESTEM}-n
        base=90,144
        center=90,144
    [/image]
#enddef
#define IMAGE_NE IMAGESTEM
    [image]
        name={IMAGESTEM}-ne
        base=117,144
        center=90,144
    [/image]
#enddef
#define IMAGE_SE IMAGESTEM
    [image]
        name={IMAGESTEM}-se
        base=117,182
        center=90,144
    [/image]
#enddef
#define IMAGE_S IMAGESTEM
    [image]
        name={IMAGESTEM}-s
        base=90,196
        center=90,144
    [/image]
#enddef
#define IMAGE_SW IMAGESTEM
    [image]
        name={IMAGESTEM}-sw
        base=63,182
        center=90,144
    [/image]
#enddef
#define IMAGE_NW_N IMAGESTEM
    [image]
        name={IMAGESTEM}-nw-n
        base=81,144
        center=90,144
    [/image]
#enddef
#define IMAGE_N_NE IMAGESTEM
    [image]
        name={IMAGESTEM}-n-ne
        base=99,144
        center=90,144
    [/image]
#enddef
#define IMAGE_NE_SE IMAGESTEM
    [image]
        name={IMAGESTEM}-ne-se
        base=108,182
        center=90,144
    [/image]
#enddef
#define IMAGE_SE_S IMAGESTEM
    [image]
        name={IMAGESTEM}-se-s
        base=99,182
        center=90,144
    [/image]
#enddef
#define IMAGE_S_SW IMAGESTEM
    [image]
        name={IMAGESTEM}-s-sw
        base=81,182
        center=90,144
    [/image]
#enddef
#define IMAGE_SW_NW IMAGESTEM
    [image]
        name={IMAGESTEM}-sw-nw
        base=72,182
        center=90,144
    [/image]
#enddef
#define IMAGE_NW_N_NE IMAGESTEM
    [image]
        name={IMAGESTEM}-nw-n-ne
        base=90,144
        center=90,144
    [/image]
#enddef
#define IMAGE_N_NE_SE IMAGESTEM
    [image]
        name={IMAGESTEM}-n-ne-se-bg
        base=99,144
        center=90,144
    [/image]
    [image]
        name={IMAGESTEM}-n-ne-se-fg
        base=108,182
        center=90,144
    [/image]
#enddef
#define IMAGE_NE_SE_S IMAGESTEM
    [image]
        name={IMAGESTEM}-ne-se-s
        base=99,182
        center=90,144
    [/image]
#enddef
#define IMAGE_SE_S_SW IMAGESTEM
    [image]
        name={IMAGESTEM}-se-s-sw
        base=90,182
        center=90,144
    [/image]
#enddef
#define IMAGE_S_SW_NW IMAGESTEM
    [image]
        name={IMAGESTEM}-s-sw-nw
        base=81,182
        center=90,144
    [/image]
#enddef
#define IMAGE_SW_NW_N IMAGESTEM
    [image]
        name={IMAGESTEM}-sw-nw-n-bg
        base=81,144
        center=90,144
    [/image]
    [image]
        name={IMAGESTEM}-sw-nw-n-fg
        base=72,182
        center=90,144
    [/image]
#enddef

#define IMAGE_N_NE_SE_S IMAGESTEM
    {IMAGE_N_NE {IMAGESTEM}}
    {IMAGE_SE_S {IMAGESTEM}}
    [image]
        name={IMAGESTEM}-n-ne-se-s-fg
        base=144,183  # in front of SE_S
        center=90,144
    [/image]
#enddef
#define IMAGE_S_SW_NW_N IMAGESTEM
    {IMAGE_NW_N {IMAGESTEM}}
    {IMAGE_S_SW {IMAGESTEM}}
    [image]
        name={IMAGESTEM}-s-sw-nw-n-fg
        base=72,183  # in front of S_SW
        center=90,144
    [/image]
#enddef
#define IMAGE_NW_N_NE_SE IMAGESTEM
    [image]
        name={IMAGESTEM}-nw-n-ne-se-bg
        base=99,144
        center=90,144
    [/image]
    [image]
        name={IMAGESTEM}-n-ne-se-fg
        base=108,182
        center=90,144
    [/image]
#enddef
#define IMAGE_SW_NW_N_NE IMAGESTEM
    [image]
        name={IMAGESTEM}-sw-nw-n-ne-bg
        base=81,144
        center=90,144
    [/image]
    [image]
        name={IMAGESTEM}-sw-nw-n-fg
        base=72,182
        center=90,144
    [/image]
#enddef
#define IMAGE_NE_SE_S_SW IMAGESTEM
    [image]
        name={IMAGESTEM}-ne-se-s-sw
        base=90,182
        center=90,144
    [/image]
#enddef
#define IMAGE_SE_S_SW_NW IMAGESTEM
    [image]
        name={IMAGESTEM}-se-s-sw-nw
        base=90,182
        center=90,144
    [/image]
#enddef

#define IMAGE_NW_N_NE_SE_S IMAGESTEM
    {IMAGE_NW_N_NE {IMAGESTEM}}
    {IMAGE_SE_S {IMAGESTEM}}
    [image]
        name={IMAGESTEM}-n-ne-se-s-fg
        base=144,183  # in front of SE_S
        center=90,144
    [/image]
#enddef
#define IMAGE_N_NE_SE_S_SW IMAGESTEM
    {IMAGE_N_NE {IMAGESTEM}}
    {IMAGE_SE_S_SW {IMAGESTEM}}
    [image]
        name={IMAGESTEM}-n-ne-se-s-fg
        base=144,183  # in front of SE_S_SW
        center=90,144
    [/image]
#enddef
#define IMAGE_NE_SE_S_SW_NW IMAGESTEM
    {IMAGE_NE_SE {IMAGESTEM}}
    {IMAGE_SW_NW {IMAGESTEM}}
    [image]
        name={IMAGESTEM}-ne-se-s-sw-nw-fg
        base=90,183  # in front of NE_SE and SW_NW
        center=90,144
    [/image]
#enddef
#define IMAGE_SE_S_SW_NW_N IMAGESTEM
    {IMAGE_SE_S_SW {IMAGESTEM}}
    {IMAGE_NW_N {IMAGESTEM}}
    [image]
        name={IMAGESTEM}-s-sw-nw-n-fg
        base=72,183  # in front of SE_S_SW
        center=90,144
    [/image]
#enddef
#define IMAGE_S_SW_NW_N_NE IMAGESTEM
    {IMAGE_S_SW {IMAGESTEM}}
    {IMAGE_NW_N_NE {IMAGESTEM}}
    [image]
        name={IMAGESTEM}-s-sw-nw-n-fg
        base=72,183  # in front of S_SW
        center=90,144
    [/image]
#enddef
#define IMAGE_SW_NW_N_NE_SE IMAGESTEM
    [image]
        name={IMAGESTEM}-n-ne-se-fg
        base=108,182
        center=90,144
    [/image]
    [image]
        name={IMAGESTEM}-sw-nw-n-fg
        base=72,182
        center=90,144
    [/image]
    [image]
        name={IMAGESTEM}-sw-nw-n-ne-se-bg
        base=90,144
        center=90,144
    [/image]
#enddef

#define IMAGE_N_NE_SE_S_SW_NW IMAGESTEM
    {IMAGE_NW_N_NE {IMAGESTEM}}
    {IMAGE_SE_S_SW {IMAGESTEM}}
    [image]
        name={IMAGESTEM}-s-sw-nw-n-fg
        base=72,183
        center=90,144
    [/image]
    [image]
        name={IMAGESTEM}-n-ne-se-s-fg
        base=144,183
        center=90,144
    [/image]
#enddef

## this is defined separately for random variations for -n walls
#define WALL_1_VARIATION PROB TERRAIN_PATTERN ADJACENT IMAGESTEM
    [terrain_graphics]
        map="
,  2
*,   *
,  1
*,   *
,  *"
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-s
            set_flag=wall-s
        [/tile]
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        {IMAGE_N {IMAGESTEM}}
        probability={PROB}
    [/terrain_graphics]
#enddef

#define WALL_ADJACENT_1 TERRAIN_PATTERN ADJACENT IMAGESTEM

    ## *-n wall uses up to 9 random variations, if present
    {WALL_1_VARIATION 10 ({TERRAIN_PATTERN}) ({ADJACENT}) {IMAGESTEM}9}
    {WALL_1_VARIATION 12 ({TERRAIN_PATTERN}) ({ADJACENT}) {IMAGESTEM}8}
    {WALL_1_VARIATION 14 ({TERRAIN_PATTERN}) ({ADJACENT}) {IMAGESTEM}7}
    {WALL_1_VARIATION 17 ({TERRAIN_PATTERN}) ({ADJACENT}) {IMAGESTEM}6}
    {WALL_1_VARIATION 20 ({TERRAIN_PATTERN}) ({ADJACENT}) {IMAGESTEM}5}
    {WALL_1_VARIATION 25 ({TERRAIN_PATTERN}) ({ADJACENT}) {IMAGESTEM}4}
    {WALL_1_VARIATION 33 ({TERRAIN_PATTERN}) ({ADJACENT}) {IMAGESTEM}3}
    {WALL_1_VARIATION 50 ({TERRAIN_PATTERN}) ({ADJACENT}) {IMAGESTEM}2}
    {WALL_1_VARIATION 100 ({TERRAIN_PATTERN}) ({ADJACENT}) {IMAGESTEM}}

    [terrain_graphics]
        map="
,  *
*,   2
,  1
*,   *
,  *"
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-sw
            set_flag=wall-sw
        [/tile]
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        {IMAGE_NE {IMAGESTEM}}
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
*,   *
,  1
*,   2
,  *"
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-nw
            set_flag=wall-nw
        [/tile]
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        {IMAGE_SE {IMAGESTEM}}
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
*,   *
,  1
*,   *
,  2"
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-n
            set_flag=wall-n
        [/tile]
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        {IMAGE_S {IMAGESTEM}}
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
*,   *
,  1
2,   *
,  *"
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-ne
            set_flag=wall-ne
        [/tile]
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        {IMAGE_SW {IMAGESTEM}}
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
2,   *
,  1
*,   *
,  *"
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-se
            set_flag=wall-se
        [/tile]
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        {IMAGE_NW {IMAGESTEM}}
    [/terrain_graphics]
#enddef

## for random variations in n-ne and nw-n walls
#define WALL_2_VARIATION PROB TERRAIN_PATTERN ADJACENT IMAGESTEM
    [terrain_graphics]
        map="
,  3
2,   *
,  1
*,   *
,  *"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-se
            set_flag=wall-se
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            no_flag=wall-s
            set_flag=wall-s
        [/tile]
        {IMAGE_NW_N {IMAGESTEM}}
        probability={PROB}
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  2
*,   3
,  1
*,   *
,  *"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-s
            set_flag=wall-s
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            no_flag=wall-sw
            set_flag=wall-sw
        [/tile]
        {IMAGE_N_NE {IMAGESTEM}}
        probability={PROB}
    [/terrain_graphics]
#enddef

#define WALL_ADJACENT_2 TERRAIN_PATTERN ADJACENT IMAGESTEM

    ## *-nw-n and *-n-ne facing use up to 9 random variations, if present
    {WALL_2_VARIATION 10 ({TERRAIN_PATTERN}) ({ADJACENT}) {IMAGESTEM}9}
    {WALL_2_VARIATION 12 ({TERRAIN_PATTERN}) ({ADJACENT}) {IMAGESTEM}8}
    {WALL_2_VARIATION 14 ({TERRAIN_PATTERN}) ({ADJACENT}) {IMAGESTEM}7}
    {WALL_2_VARIATION 17 ({TERRAIN_PATTERN}) ({ADJACENT}) {IMAGESTEM}6}
    {WALL_2_VARIATION 20 ({TERRAIN_PATTERN}) ({ADJACENT}) {IMAGESTEM}5}
    {WALL_2_VARIATION 25 ({TERRAIN_PATTERN}) ({ADJACENT}) {IMAGESTEM}4}
    {WALL_2_VARIATION 33 ({TERRAIN_PATTERN}) ({ADJACENT}) {IMAGESTEM}3}
    {WALL_2_VARIATION 50 ({TERRAIN_PATTERN}) ({ADJACENT}) {IMAGESTEM}2}
    {WALL_2_VARIATION 100 ({TERRAIN_PATTERN}) ({ADJACENT}) {IMAGESTEM}}

    [terrain_graphics]
        map="
,  *
*,   2
,  1
*,   3
,  *"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-sw
            set_flag=wall-sw
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            no_flag=wall-nw
            set_flag=wall-nw
        [/tile]
        {IMAGE_NE_SE {IMAGESTEM}}
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
*,   *
,  1
*,   2
,  3"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-nw
            set_flag=wall-nw
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            no_flag=wall-n
            set_flag=wall-n
        [/tile]
        {IMAGE_SE_S {IMAGESTEM}}
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
*,   *
,  1
3,   *
,  2"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-n
            set_flag=wall-n
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            no_flag=wall-ne
            set_flag=wall-ne
        [/tile]
        {IMAGE_S_SW {IMAGESTEM}}
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
3,   *
,  1
2,   *
,  *"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-ne
            set_flag=wall-ne
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            no_flag=wall-se
            set_flag=wall-se
        [/tile]
        {IMAGE_SW_NW {IMAGESTEM}}
    [/terrain_graphics]

#enddef

#define WALL_ADJACENT_3 TERRAIN_PATTERN ADJACENT IMAGESTEM

    [terrain_graphics]
        map="
,  3
2,   4
,  1
*,   *
,  *"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-se
            set_flag=wall-se
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            no_flag=wall-s
            set_flag=wall-s
        [/tile]
        [tile]
            pos=4
            type={TERRAIN_PATTERN}
            no_flag=wall-sw
            set_flag=wall-sw
        [/tile]
        {IMAGE_NW_N_NE {IMAGESTEM}}
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  2
*,   3
,  1
*,   4
,  *"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-s
            set_flag=wall-s
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            no_flag=wall-sw
            set_flag=wall-sw
        [/tile]
        [tile]
            pos=4
            type={TERRAIN_PATTERN}
            no_flag=wall-nw
            set_flag=wall-nw
        [/tile]
        {IMAGE_N_NE_SE {IMAGESTEM}}
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
*,   2
,  1
*,   3
,  4"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-sw
            set_flag=wall-sw
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            no_flag=wall-nw
            set_flag=wall-nw
        [/tile]
        [tile]
            pos=4
            type={TERRAIN_PATTERN}
            no_flag=wall-n
            set_flag=wall-n
        [/tile]
        {IMAGE_NE_SE_S {IMAGESTEM}}
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
*,   *
,  1
4,   2
,  3"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-nw
            set_flag=wall-nw
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            no_flag=wall-n
            set_flag=wall-n
        [/tile]
        [tile]
            pos=4
            type={TERRAIN_PATTERN}
            no_flag=wall-ne
            set_flag=wall-ne
        [/tile]
        {IMAGE_SE_S_SW {IMAGESTEM}}
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
4,   *
,  1
3,   *
,  2"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-n
            set_flag=wall-n
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            no_flag=wall-ne
            set_flag=wall-ne
        [/tile]
        [tile]
            pos=4
            type={TERRAIN_PATTERN}
            no_flag=wall-se
            set_flag=wall-se
        [/tile]
        {IMAGE_S_SW_NW {IMAGESTEM}}
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  4
3,   *
,  1
2,   *
,  *"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-ne
            set_flag=wall-ne
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            no_flag=wall-se
            set_flag=wall-se
        [/tile]
        [tile]
            pos=4
            type={TERRAIN_PATTERN}
            no_flag=wall-s
            set_flag=wall-s
        [/tile]
        {IMAGE_SW_NW_N {IMAGESTEM}}
    [/terrain_graphics]

#enddef

#define WALL_ADJACENT_4 TERRAIN_PATTERN ADJACENT IMAGESTEM

    [terrain_graphics]
        map="
,  3
2,   4
,  1
*,   5
,  *"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-se
            set_flag=wall-se
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            no_flag=wall-s
            set_flag=wall-s
        [/tile]
        [tile]
            pos=4
            type={TERRAIN_PATTERN}
            no_flag=wall-sw
            set_flag=wall-sw
        [/tile]
        [tile]
            pos=5
            type={TERRAIN_PATTERN}
            no_flag=wall-nw
            set_flag=wall-nw
        [/tile]
        {IMAGE_NW_N_NE_SE {IMAGESTEM}}
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  2
*,   3
,  1
*,   4
,  5"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-s
            set_flag=wall-s
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            no_flag=wall-sw
            set_flag=wall-sw
        [/tile]
        [tile]
            pos=4
            type={TERRAIN_PATTERN}
            no_flag=wall-nw
            set_flag=wall-nw
        [/tile]
        [tile]
            pos=5
            type={TERRAIN_PATTERN}
            no_flag=wall-n
            set_flag=wall-n
        [/tile]
        {IMAGE_N_NE_SE_S {IMAGESTEM}}
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
*,   2
,  1
5,   3
,  4"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-sw
            set_flag=wall-sw
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            no_flag=wall-nw
            set_flag=wall-nw
        [/tile]
        [tile]
            pos=4
            type={TERRAIN_PATTERN}
            no_flag=wall-n
            set_flag=wall-n
        [/tile]
        [tile]
            pos=5
            type={TERRAIN_PATTERN}
            no_flag=wall-ne
            set_flag=wall-ne
        [/tile]
        {IMAGE_NE_SE_S_SW {IMAGESTEM}}
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
5,   *
,  1
4,   2
,  3"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-nw
            set_flag=wall-nw
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            no_flag=wall-n
            set_flag=wall-n
        [/tile]
        [tile]
            pos=4
            type={TERRAIN_PATTERN}
            no_flag=wall-ne
            set_flag=wall-ne
        [/tile]
        [tile]
            pos=5
            type={TERRAIN_PATTERN}
            no_flag=wall-se
            set_flag=wall-se
        [/tile]
        {IMAGE_SE_S_SW_NW {IMAGESTEM}}
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  5
4,   *
,  1
3,   *
,  2"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-n
            set_flag=wall-n
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            no_flag=wall-ne
            set_flag=wall-ne
        [/tile]
        [tile]
            pos=4
            type={TERRAIN_PATTERN}
            no_flag=wall-se
            set_flag=wall-se
        [/tile]
        [tile]
            pos=5
            type={TERRAIN_PATTERN}
            no_flag=wall-s
            set_flag=wall-s
        [/tile]
        {IMAGE_S_SW_NW_N {IMAGESTEM}}
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  4
3,   5
,  1
2,   *
,  *"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-ne
            set_flag=wall-ne
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            no_flag=wall-se
            set_flag=wall-se
        [/tile]
        [tile]
            pos=4
            type={TERRAIN_PATTERN}
            no_flag=wall-s
            set_flag=wall-s
        [/tile]
        [tile]
            pos=5
            type={TERRAIN_PATTERN}
            no_flag=wall-sw
            set_flag=wall-sw
        [/tile]
        {IMAGE_SW_NW_N_NE {IMAGESTEM}}
    [/terrain_graphics]

#enddef

#define WALL_ADJACENT_5 TERRAIN_PATTERN ADJACENT IMAGESTEM

    [terrain_graphics]
        map="
,  3
2,   4
,  1
*,   5
,  6"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-se
            set_flag=wall-se
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            no_flag=wall-s
            set_flag=wall-s
        [/tile]
        [tile]
            pos=4
            type={TERRAIN_PATTERN}
            no_flag=wall-sw
            set_flag=wall-sw
        [/tile]
        [tile]
            pos=5
            type={TERRAIN_PATTERN}
            no_flag=wall-nw
            set_flag=wall-nw
        [/tile]
        [tile]
            pos=6
            type={TERRAIN_PATTERN}
            no_flag=wall-n
            set_flag=wall-n
        [/tile]
        {IMAGE_NW_N_NE_SE_S {IMAGESTEM}}
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  2
*,   3
,  1
6,   4
,  5"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-s
            set_flag=wall-s
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            no_flag=wall-sw
            set_flag=wall-sw
        [/tile]
        [tile]
            pos=4
            type={TERRAIN_PATTERN}
            no_flag=wall-nw
            set_flag=wall-nw
        [/tile]
        [tile]
            pos=5
            type={TERRAIN_PATTERN}
            no_flag=wall-n
            set_flag=wall-n
        [/tile]
        [tile]
            pos=6
            type={TERRAIN_PATTERN}
            no_flag=wall-ne
            set_flag=wall-ne
        [/tile]
        {IMAGE_N_NE_SE_S_SW {IMAGESTEM}}
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  *
6,   2
,  1
5,   3
,  4"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-sw
            set_flag=wall-sw
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            no_flag=wall-nw
            set_flag=wall-nw
        [/tile]
        [tile]
            pos=4
            type={TERRAIN_PATTERN}
            no_flag=wall-n
            set_flag=wall-n
        [/tile]
        [tile]
            pos=5
            type={TERRAIN_PATTERN}
            no_flag=wall-ne
            set_flag=wall-ne
        [/tile]
        [tile]
            pos=6
            type={TERRAIN_PATTERN}
            no_flag=wall-se
            set_flag=wall-se
        [/tile]
        {IMAGE_NE_SE_S_SW_NW {IMAGESTEM}}
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  6
5,   *
,  1
4,   2
,  3"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-nw
            set_flag=wall-nw
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            no_flag=wall-n
            set_flag=wall-n
        [/tile]
        [tile]
            pos=4
            type={TERRAIN_PATTERN}
            no_flag=wall-ne
            set_flag=wall-ne
        [/tile]
        [tile]
            pos=5
            type={TERRAIN_PATTERN}
            no_flag=wall-se
            set_flag=wall-se
        [/tile]
        [tile]
            pos=6
            type={TERRAIN_PATTERN}
            no_flag=wall-s
            set_flag=wall-s
        [/tile]
        {IMAGE_SE_S_SW_NW_N {IMAGESTEM}}
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  5
4,   6
,  1
3,   *
,  2"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-n
            set_flag=wall-n
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            no_flag=wall-ne
            set_flag=wall-ne
        [/tile]
        [tile]
            pos=4
            type={TERRAIN_PATTERN}
            no_flag=wall-se
            set_flag=wall-se
        [/tile]
        [tile]
            pos=5
            type={TERRAIN_PATTERN}
            no_flag=wall-s
            set_flag=wall-s
        [/tile]
        [tile]
            pos=6
            type={TERRAIN_PATTERN}
            no_flag=wall-sw
            set_flag=wall-sw
        [/tile]
        {IMAGE_S_SW_NW_N_NE {IMAGESTEM}}
    [/terrain_graphics]

    [terrain_graphics]
        map="
,  4
3,   5
,  1
2,   6
,  *"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            no_flag=wall-ne
            set_flag=wall-ne
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            no_flag=wall-se
            set_flag=wall-se
        [/tile]
        [tile]
            pos=4
            type={TERRAIN_PATTERN}
            no_flag=wall-s
            set_flag=wall-s
        [/tile]
        [tile]
            pos=5
            type={TERRAIN_PATTERN}
            no_flag=wall-sw
            set_flag=wall-sw
        [/tile]
        [tile]
            pos=6
            type={TERRAIN_PATTERN}
            no_flag=wall-nw
            set_flag=wall-nw
        [/tile]
        {IMAGE_SW_NW_N_NE_SE {IMAGESTEM}}
    [/terrain_graphics]

#enddef

#define WALL_ADJACENT_6 TERRAIN_PATTERN ADJACENT IMAGESTEM

    [terrain_graphics]
        map="
,  2
7,   3
,  1
6,   4
,  5"
        [tile]
            pos=1
            type={ADJACENT}
        [/tile]
        [tile]
            pos=2
            type={TERRAIN_PATTERN}
            set_flag=wall-s
        [/tile]
        [tile]
            pos=3
            type={TERRAIN_PATTERN}
            set_flag=wall-sw
        [/tile]
        [tile]
            pos=4
            type={TERRAIN_PATTERN}
            set_flag=wall-nw
        [/tile]
        [tile]
            pos=5
            type={TERRAIN_PATTERN}
            set_flag=wall-n
        [/tile]
        [tile]
            pos=6
            type={TERRAIN_PATTERN}
            set_flag=wall-ne
        [/tile]
        [tile]
            pos=7
            type={TERRAIN_PATTERN}
            set_flag=wall-se
        [/tile]
        {IMAGE_N_NE_SE_S_SW_NW {IMAGESTEM}}
    [/terrain_graphics]

#enddef

#define DISABLE_WALLS TERRAIN1 TERRAIN2 TERRAIN3
    [terrain_graphics]
        map="
3
,.
1"
        [tile]
            pos=1
            type={TERRAIN1}
            set_flag=wall-@R0
        [/tile]
        [tile]
            pos=2
            type={TERRAIN2}
        [/tile]
        [tile]
            pos=3
            type={TERRAIN3}
        [/tile]
        rotations=n,ne,se,s,sw,nw
    [/terrain_graphics]
#enddef

#define WALL_ADJACENT TERRAIN_PATTERN ADJACENT IMAGESTEM BASE_NAME

    {DISABLE_TRANSITIONS ({TERRAIN_PATTERN})}
    {KEEP_BASE ({TERRAIN_PATTERN}) {BASE_NAME}}

    {WALL_ADJACENT_6 ({TERRAIN_PATTERN}) ({ADJACENT}) {IMAGESTEM}}
    {WALL_ADJACENT_5 ({TERRAIN_PATTERN}) ({ADJACENT}) {IMAGESTEM}}
    {WALL_ADJACENT_4 ({TERRAIN_PATTERN}) ({ADJACENT}) {IMAGESTEM}}
    {WALL_ADJACENT_3 ({TERRAIN_PATTERN}) ({ADJACENT}) {IMAGESTEM}}
    {WALL_ADJACENT_2 ({TERRAIN_PATTERN}) ({ADJACENT}) {IMAGESTEM}}
    {WALL_ADJACENT_1 ({TERRAIN_PATTERN}) ({ADJACENT}) {IMAGESTEM}}

    # disable castle walls and cave
    # note: commented out until these macros exist in trunk
    #{DISABLE_CASTLES ({TERRAIN_PATTERN}) ({ADJACENT})}
    #{DISABLE_CAVEWALL ({TERRAIN_PATTERN}) ({ADJACENT})}

#enddef

# stone wall transitions to cavewall. Note that these have no graphics,
# so currently this is commented out for ugly, but vaguely working behaviour
#{TERRAIN_CORNER_STATIC cave Xos Xu (!,X*) BASE1 BASE2 IMAGESTEM}

# draw the walls!

{WALL_ADJACENT Xos (!,Xo*, Xu) walls/wall-stone walls/wall-stone-base}
