# Path: mgz/util.py
# def find_version(ctx):
#     """Find version."""
#     if 'version' not in ctx:
#         return find_version(ctx._)
#     return ctx.version
# 
# def find_save_version(ctx):
#     """Find save version."""
#     if 'save_version' not in ctx:
#         return find_save_version(ctx._)
#     return ctx.save_version
# 
# class Version(Enum):
#     """Version enumeration.
# 
#     Using consts from https://github.com/goto-bus-stop/recanalyst/blob/master/src/Model/Version.php
#     for consistency.
#     """
#     AOK = 1
#     AOC = 4
#     AOC10 = 5
#     AOC10C = 8
#     USERPATCH12 = 12
#     USERPATCH13 = 13
#     USERPATCH14 = 11
#     USERPATCH15 = 20
#     DE = 21
#     USERPATCH14RC2 = 22
#     MCP = 30
#     HD = 19


from construct import (
    Struct, Float32l, Int16ul, Byte, Embedded, Switch, If,
    Int32ul, Array, String, Padding, IfThenElse, this
)
from mgz.util import find_version, find_save_version, Version
        "x"/Int16ul,
        "y"/Int16ul
    ),
    "construction_radius"/Struct(
        "x"/Float32l,
        "y"/Float32l
    ),
    "elevation_flag"/Byte,
    "fog_flag"/Byte,
    "terrain_restriction_id"/Int16ul,
    "movement_type"/Byte,
    "attribute_max"/Int16ul,
    "attribute_rot"/Float32l,
    "area_effect_level"/Byte,
    "combat_level"/Byte,
    "select_level"/Byte,
    "map_draw_level"/Byte,
    "unit_level"/Byte,
    "multiple_attribute_mod"/Float32l,
    "map_color"/Byte,
    "help_string_id"/Int32ul,
    "help_page_id"/Int32ul,
    "hotkey_id"/Int32ul,
    "recyclable"/Byte,
    "track_as_resource"/Byte,
    "create_doppleganger"/Byte,
    "resource_group"/Byte,
    "occlusion_mask"/Byte,
    "obstruction_type"/Byte,
    "selection_shape"/Byte,

# Path: mgz/util.py
# def find_version(ctx):
#     """Find version."""
#     if 'version' not in ctx:
#         return find_version(ctx._)
#     return ctx.version
# 
# def find_save_version(ctx):
#     """Find save version."""
#     if 'save_version' not in ctx:
#         return find_save_version(ctx._)
#     return ctx.save_version
# 
# class Version(Enum):
#     """Version enumeration.
# 
#     Using consts from https://github.com/goto-bus-stop/recanalyst/blob/master/src/Model/Version.php
#     for consistency.
#     """
#     AOK = 1
#     AOC = 4
#     AOC10 = 5
#     AOC10C = 8
#     USERPATCH12 = 12
#     USERPATCH13 = 13
#     USERPATCH14 = 11
#     USERPATCH15 = 20
#     DE = 21
#     USERPATCH14RC2 = 22
#     MCP = 30
#     HD = 19


# Path: mgz/header/unit_type.py
from construct import (
    Struct, Float32l, Int16ul, Byte, Embedded, Switch, If,
    Int32ul, Array, String, Padding, IfThenElse, this
)
from mgz.util import find_version, find_save_version, Version

        "x"/Int16ul,
        "y"/Int16ul
    ),
    "construction_radius"/Struct(
        "x"/Float32l,
        "y"/Float32l
    ),
    "elevation_flag"/Byte,
    "fog_flag"/Byte,
    "terrain_restriction_id"/Int16ul,
    "movement_type"/Byte,
    "attribute_max"/Int16ul,
    "attribute_rot"/Float32l,
    "area_effect_level"/Byte,
    "combat_level"/Byte,
    "select_level"/Byte,
    "map_draw_level"/Byte,
    "unit_level"/Byte,
    "multiple_attribute_mod"/Float32l,
    "map_color"/Byte,
    "help_string_id"/Int32ul,
    "help_page_id"/Int32ul,
    "hotkey_id"/Int32ul,
    "recyclable"/Byte,
    "track_as_resource"/Byte,
    "create_doppleganger"/Byte,
    "resource_group"/Byte,
    "occlusion_mask"/Byte,
    "obstruction_type"/Byte,
    "selection_shape"/Byte,

    "object_flags"/If(lambda ctx: find_version(ctx) != Version.AOK, Int32ul),