#textdomain wesnoth

# Attaches an image to all terrain types matching
# a specified pattern, with a given probability.
# Example: {TERRAIN_BASE_PROBABILITY Gg grassland-rocks 20}

#define TERRAIN_BASE_PROB_FL TERRAIN_PATTERN IMAGESTEM PROB FLAG LAYER
    [terrain_graphics]
        [tile]
            x=0
            y=0
            type="{TERRAIN_PATTERN}"
            [image]
                layer={LAYER}
                name={IMAGESTEM}
            [/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 TERRAIN_PATTERN IMAGESTEM FLAG LAYER
    {TERRAIN_BASE_PROB_FL ({TERRAIN_PATTERN}) {IMAGESTEM} 100 {FLAG} {LAYER}}
#enddef

#define TERRAIN_BASE_PROB TERRAIN_PATTERN IMAGESTEM PROB
    {TERRAIN_BASE_PROB_FL ({TERRAIN_PATTERN}) {IMAGESTEM} {PROB} base -1000}
#enddef
#define TERRAIN_BASE_PROB_OV TERRAIN_PATTERN IMAGESTEM PROB
    {TERRAIN_BASE_PROB_FL ({TERRAIN_PATTERN}) {IMAGESTEM} {PROB} overlay -80}
#enddef
#define TERRAIN_BASE_OV TERRAIN_PATTERN IMAGESTEM
    {TERRAIN_BASE_FL ({TERRAIN_PATTERN}) {IMAGESTEM} overlay -80}
#enddef

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

#define KEEP_BASE TERRAIN_PATTERN IMAGESTEM
    # this draws keep floor as a single-hex overlay, which will hide some things
    # that happen to be erroneously drawn inside the walls.
    [terrain_graphics]
        [tile]
            x=0
            y=0
            type={TERRAIN_PATTERN}
            [image]
                name={IMAGESTEM}
                layer=-1
            [/image]
        [/tile]
        no_flag="base"
        set_flag="base"
    [/terrain_graphics]
#enddef
