// This file has been automatically generated.

#include "AppHdr.h"
#include "libutil.h"
#include "tiledef-icons.h"

static unsigned int _tile_icons_count[TILEI_ICONS_MAX - TILEG_GUI_MAX] =
{
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    8,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    8,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
};

unsigned int tile_icons_count(tileidx_t idx)
{
    ASSERT_RANGE(idx, TILEG_GUI_MAX, TILEI_ICONS_MAX);
    return _tile_icons_count[idx - TILEG_GUI_MAX];
}

static tileidx_t _tile_icons_basetiles[TILEI_ICONS_MAX - TILEG_GUI_MAX] =
{
    0,
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9,
    10,
    11,
    12,
    13,
    14,
    15,
    16,
    17,
    18,
    19,
    20,
    21,
    22,
    23,
    24,
    25,
    26,
    27,
    28,
    29,
    30,
    31,
    32,
    33,
    34,
    35,
    36,
    37,
    38,
    39,
    40,
    41,
    42,
    43,
    44,
    45,
    46,
    47,
    48,
    49,
    50,
    51,
    52,
    53,
    54,
    55,
    56,
    57,
    58,
    59,
    60,
    61,
    62,
    63,
    64,
    65,
    66,
    67,
    68,
    69,
    70,
    71,
    72,
    73,
    74,
    75,
    76,
    77,
    78,
    79,
    80,
    81,
    82,
    83,
    84,
    85,
    86,
    87,
    88,
    89,
    90,
    91,
    92,
    93,
    94,
    95,
    96,
    97,
    98,
    99,
    100,
    101,
    102,
    103,
    104,
    105,
    106,
    107,
    108,
    109,
    110,
    111,
    112,
    113,
    114,
    115,
    116,
    117,
    118,
    119,
    120,
    121,
    122,
    123,
    124,
    125,
    126,
    127,
    128,
    129,
    130,
    131,
    132,
    133,
    134,
    135,
    136,
    137,
    138,
    139,
    140,
    141,
    142,
    143,
    144,
    145,
    146,
    147,
    148,
    149,
    150,
    151,
    152,
    153,
    154,
    155,
    156,
    156,
    156,
    156,
    156,
    156,
    156,
    156,
    164,
    164,
    164,
    164,
    164,
    164,
    164,
    164,
};

tileidx_t tile_icons_basetile(tileidx_t idx)
{
    ASSERT_RANGE(idx, TILEG_GUI_MAX, TILEI_ICONS_MAX);
    return _tile_icons_basetiles[idx - TILEG_GUI_MAX] + TILEG_GUI_MAX;
}

static int _tile_icons_probs[TILEI_ICONS_MAX - TILEG_GUI_MAX] =
{
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
};

int tile_icons_probs(tileidx_t idx)
{
    ASSERT_RANGE(idx, TILEG_GUI_MAX, TILEI_ICONS_MAX);
    return _tile_icons_probs[idx - TILEG_GUI_MAX];
}

static int _tile_icons_dominoes[TILEI_ICONS_MAX - TILEG_GUI_MAX] =
{
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
};

int tile_icons_dominoes(tileidx_t idx)
{
    ASSERT_RANGE(idx, TILEG_GUI_MAX, TILEI_ICONS_MAX);
    return _tile_icons_dominoes[idx - TILEG_GUI_MAX];
}

static const char *_tile_icons_name[TILEI_ICONS_MAX - TILEG_GUI_MAX] =
{
    "TRAP_NET",
    "MASK_DEEP_WATER",
    "MASK_SHALLOW_WATER",
    "MASK_DEEP_WATER_MURKY",
    "MASK_SHALLOW_WATER_MURKY",
    "MASK_DEEP_WATER_SHOALS",
    "MASK_SHALLOW_WATER_SHOALS",
    "MASK_LAVA",
    "CURSOR",
    "CURSOR2",
    "CURSOR3",
    "TUTORIAL_CURSOR",
    "DISABLED",
    "RAMPAGE",
    "TRAP_WEB",
    "FRIENDLY",
    "GOOD_NEUTRAL",
    "NEUTRAL",
    "ANIMATED_WEAPON",
    "SUMMONED",
    "UNREWARDING",
    "MINION",
    "POISON",
    "MORE_POISON",
    "MAX_POISON",
    "STICKY_FLAME",
    "INNER_FLAME",
    "CONSTRICTED",
    "BERSERK",
    "FRENZIED",
    "SLOWED",
    "HASTED",
    "MIGHT",
    "PETRIFYING",
    "PETRIFIED",
    "BLIND",
    "FLEEING",
    "UNAWARE",
    "CONFUSED",
    "STAB_BRAND",
    "PAIN_MIRROR",
    "RECALL",
    "DRAIN",
    "IDEALISED",
    "BOUND_SOUL",
    "INFESTED",
    "CORRODED",
    "SWIFT",
    "VILE_CLUTCH",
    "POSSESSABLE",
    "SLOWLY_DYING",
    "FIRE_CHAMP",
    "ANGUISH",
    "ANTIMAGIC",
    "CONC_VENOM",
    "DAZED",
    "FIRE_VULN",
    "INJURY_BOND",
    "PARTIALLY_CHARGED",
    "FULLY_CHARGED",
    "DEFLECT_MISSILES",
    "GHOSTLY",
    "STILL_WINDS",
    "WATERLOGGED",
    "WEAKENED",
    "TELEPORTING",
    "BRILLIANCE",
    "RESISTANCE",
    "MALMUTATED",
    "GLOW_LIGHT",
    "GLOW_HEAVY",
    "PAIN_BOND",
    "PARALYSED",
    "BULLSEYE",
    "VITRIFIED",
    "CURSE_OF_AGONY",
    "REGENERATION",
    "RETREAT",
    "VENGEANCE_TARGET",
    "TOUCH_OF_BEOGH",
    "RIMEBLIGHT",
    "UNDYING_ARMS",
    "SHADOWLESS",
    "BIND",
    "WEAK_WILLED",
    "SIGN_OF_RUIN",
    "DOUBLED_VIGOUR",
    "KINETIC_GRAPNEL",
    "TEMPERED",
    "HEART",
    "UNSTABLE",
    "LACED_WITH_CHAOS",
    "VEXED",
    "VAMPIRE_THRALL",
    "ENKINDLED_1",
    "ENKINDLED_2",
    "NOBODY_MEMORY_1",
    "NOBODY_MEMORY_2",
    "NOBODY_MEMORY_3",
    "PYRRHIC",
    "MAGNETISED",
    "FIGMENT",
    "PARADOX",
    "WARDING",
    "DIMMED",
    "SENTINEL_MARK",
    "STRONG_WILLED",
    "TESSERACT_SPAWN",
    "SUNDERING",
    "SOMETHING_UNDER",
    "NEW_STAIR",
    "NEW_TRANSPORTER",
    "ELLIPSIS",
    "MESH",
    "OOR_MESH",
    "MAGIC_MAP_MESH",
    "TRAVEL_EXCLUSION_FG",
    "TRAVEL_EXCLUSION_CENTRE_FG",
    "NUM0",
    "NUM1",
    "NUM2",
    "NUM3",
    "NUM4",
    "NUM5",
    "NUM6",
    "NUM7",
    "NUM8",
    "NUM9",
    "NUM_MINUS5",
    "NUM_MINUS4",
    "NUM_MINUS3",
    "NUM_MINUS2",
    "NUM_MINUS1",
    "NUM_ZERO",
    "NUM_PLUS1",
    "NUM_PLUS2",
    "NUM_PLUS3",
    "NUM_PLUS4",
    "NUM_PLUS5",
    "NUM_PLUS6",
    "NUM_PLUS7",
    "NUM_PLUS8",
    "NUM_PLUS9",
    "NUM_PLUS10",
    "NUM_PLUS11",
    "DEMON_NUM1",
    "DEMON_NUM2",
    "DEMON_NUM3",
    "DEMON_NUM4",
    "DEMON_NUM5",
    "ITEM_SLOT_SELECTED",
    "MDAM_LIGHTLY_DAMAGED",
    "MDAM_MODERATELY_DAMAGED",
    "MDAM_HEAVILY_DAMAGED",
    "MDAM_SEVERELY_DAMAGED",
    "MDAM_ALMOST_DEAD",
    "TRAVEL_PATH_FROM",
    "TRAVEL_PATH_FROM_1",
    "TRAVEL_PATH_FROM_2",
    "TRAVEL_PATH_FROM_3",
    "TRAVEL_PATH_FROM_4",
    "TRAVEL_PATH_FROM_5",
    "TRAVEL_PATH_FROM_6",
    "TRAVEL_PATH_FROM_7",
    "TRAVEL_PATH_TO",
    "TRAVEL_PATH_TO_1",
    "TRAVEL_PATH_TO_2",
    "TRAVEL_PATH_TO_3",
    "TRAVEL_PATH_TO_4",
    "TRAVEL_PATH_TO_5",
    "TRAVEL_PATH_TO_6",
    "TRAVEL_PATH_TO_7",
};

const char *tile_icons_name(tileidx_t idx)
{
    ASSERT_RANGE(idx, TILEG_GUI_MAX, TILEI_ICONS_MAX);
    return _tile_icons_name[idx - TILEG_GUI_MAX];
}

static tile_info _tile_icons_info[TILEI_ICONS_MAX - TILEG_GUI_MAX] =
{
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
    tile_info(0, 0, 0, 0, 0, 0, 0, 0),
};

tile_info &tile_icons_info(tileidx_t idx)
{
    ASSERT_RANGE(idx, TILEG_GUI_MAX, TILEI_ICONS_MAX);
    return _tile_icons_info[idx - TILEG_GUI_MAX];
}


typedef pair<const char*, tileidx_t> _name_pair;

static _name_pair icons_name_pairs[] =
{
    _name_pair("anguish", 52 + TILEG_GUI_MAX),
    _name_pair("animated_weapon", 18 + TILEG_GUI_MAX),
    _name_pair("antimagic", 53 + TILEG_GUI_MAX),
    _name_pair("berserk", 28 + TILEG_GUI_MAX),
    _name_pair("bind", 83 + TILEG_GUI_MAX),
    _name_pair("blind", 35 + TILEG_GUI_MAX),
    _name_pair("bound_soul", 44 + TILEG_GUI_MAX),
    _name_pair("brilliance", 66 + TILEG_GUI_MAX),
    _name_pair("bullseye", 73 + TILEG_GUI_MAX),
    _name_pair("conc_venom", 54 + TILEG_GUI_MAX),
    _name_pair("confused", 38 + TILEG_GUI_MAX),
    _name_pair("constricted", 27 + TILEG_GUI_MAX),
    _name_pair("corroded", 46 + TILEG_GUI_MAX),
    _name_pair("curse_of_agony", 75 + TILEG_GUI_MAX),
    _name_pair("cursor", 8 + TILEG_GUI_MAX),
    _name_pair("cursor2", 9 + TILEG_GUI_MAX),
    _name_pair("cursor3", 10 + TILEG_GUI_MAX),
    _name_pair("dazed", 55 + TILEG_GUI_MAX),
    _name_pair("deflect_missiles", 60 + TILEG_GUI_MAX),
    _name_pair("demon_num1", 145 + TILEG_GUI_MAX),
    _name_pair("demon_num2", 146 + TILEG_GUI_MAX),
    _name_pair("demon_num3", 147 + TILEG_GUI_MAX),
    _name_pair("demon_num4", 148 + TILEG_GUI_MAX),
    _name_pair("demon_num5", 149 + TILEG_GUI_MAX),
    _name_pair("dimmed", 104 + TILEG_GUI_MAX),
    _name_pair("disabled", 12 + TILEG_GUI_MAX),
    _name_pair("doubled_vigour", 86 + TILEG_GUI_MAX),
    _name_pair("drain", 42 + TILEG_GUI_MAX),
    _name_pair("ellipsis", 112 + TILEG_GUI_MAX),
    _name_pair("enkindled_1", 94 + TILEG_GUI_MAX),
    _name_pair("enkindled_2", 95 + TILEG_GUI_MAX),
    _name_pair("figment", 101 + TILEG_GUI_MAX),
    _name_pair("fire_champ", 51 + TILEG_GUI_MAX),
    _name_pair("fire_vuln", 56 + TILEG_GUI_MAX),
    _name_pair("fleeing", 36 + TILEG_GUI_MAX),
    _name_pair("frenzied", 29 + TILEG_GUI_MAX),
    _name_pair("friendly", 15 + TILEG_GUI_MAX),
    _name_pair("fully_charged", 59 + TILEG_GUI_MAX),
    _name_pair("ghostly", 61 + TILEG_GUI_MAX),
    _name_pair("glow_heavy", 70 + TILEG_GUI_MAX),
    _name_pair("glow_light", 69 + TILEG_GUI_MAX),
    _name_pair("good_neutral", 16 + TILEG_GUI_MAX),
    _name_pair("hasted", 31 + TILEG_GUI_MAX),
    _name_pair("heart", 89 + TILEG_GUI_MAX),
    _name_pair("idealised", 43 + TILEG_GUI_MAX),
    _name_pair("infested", 45 + TILEG_GUI_MAX),
    _name_pair("injury_bond", 57 + TILEG_GUI_MAX),
    _name_pair("inner_flame", 26 + TILEG_GUI_MAX),
    _name_pair("item_slot_selected", 150 + TILEG_GUI_MAX),
    _name_pair("kinetic_grapnel", 87 + TILEG_GUI_MAX),
    _name_pair("laced_with_chaos", 91 + TILEG_GUI_MAX),
    _name_pair("magic_map_mesh", 115 + TILEG_GUI_MAX),
    _name_pair("magnetised", 100 + TILEG_GUI_MAX),
    _name_pair("malmutated", 68 + TILEG_GUI_MAX),
    _name_pair("mask_deep_water", 1 + TILEG_GUI_MAX),
    _name_pair("mask_deep_water_murky", 3 + TILEG_GUI_MAX),
    _name_pair("mask_deep_water_shoals", 5 + TILEG_GUI_MAX),
    _name_pair("mask_lava", 7 + TILEG_GUI_MAX),
    _name_pair("mask_shallow_water", 2 + TILEG_GUI_MAX),
    _name_pair("mask_shallow_water_murky", 4 + TILEG_GUI_MAX),
    _name_pair("mask_shallow_water_shoals", 6 + TILEG_GUI_MAX),
    _name_pair("max_poison", 24 + TILEG_GUI_MAX),
    _name_pair("mdam_almost_dead", 155 + TILEG_GUI_MAX),
    _name_pair("mdam_heavily_damaged", 153 + TILEG_GUI_MAX),
    _name_pair("mdam_lightly_damaged", 151 + TILEG_GUI_MAX),
    _name_pair("mdam_moderately_damaged", 152 + TILEG_GUI_MAX),
    _name_pair("mdam_severely_damaged", 154 + TILEG_GUI_MAX),
    _name_pair("mesh", 113 + TILEG_GUI_MAX),
    _name_pair("might", 32 + TILEG_GUI_MAX),
    _name_pair("minion", 21 + TILEG_GUI_MAX),
    _name_pair("more_poison", 23 + TILEG_GUI_MAX),
    _name_pair("neutral", 17 + TILEG_GUI_MAX),
    _name_pair("new_stair", 110 + TILEG_GUI_MAX),
    _name_pair("new_transporter", 111 + TILEG_GUI_MAX),
    _name_pair("nobody_memory_1", 96 + TILEG_GUI_MAX),
    _name_pair("nobody_memory_2", 97 + TILEG_GUI_MAX),
    _name_pair("nobody_memory_3", 98 + TILEG_GUI_MAX),
    _name_pair("num0", 118 + TILEG_GUI_MAX),
    _name_pair("num1", 119 + TILEG_GUI_MAX),
    _name_pair("num2", 120 + TILEG_GUI_MAX),
    _name_pair("num3", 121 + TILEG_GUI_MAX),
    _name_pair("num4", 122 + TILEG_GUI_MAX),
    _name_pair("num5", 123 + TILEG_GUI_MAX),
    _name_pair("num6", 124 + TILEG_GUI_MAX),
    _name_pair("num7", 125 + TILEG_GUI_MAX),
    _name_pair("num8", 126 + TILEG_GUI_MAX),
    _name_pair("num9", 127 + TILEG_GUI_MAX),
    _name_pair("num_minus1", 132 + TILEG_GUI_MAX),
    _name_pair("num_minus2", 131 + TILEG_GUI_MAX),
    _name_pair("num_minus3", 130 + TILEG_GUI_MAX),
    _name_pair("num_minus4", 129 + TILEG_GUI_MAX),
    _name_pair("num_minus5", 128 + TILEG_GUI_MAX),
    _name_pair("num_plus1", 134 + TILEG_GUI_MAX),
    _name_pair("num_plus10", 143 + TILEG_GUI_MAX),
    _name_pair("num_plus11", 144 + TILEG_GUI_MAX),
    _name_pair("num_plus2", 135 + TILEG_GUI_MAX),
    _name_pair("num_plus3", 136 + TILEG_GUI_MAX),
    _name_pair("num_plus4", 137 + TILEG_GUI_MAX),
    _name_pair("num_plus5", 138 + TILEG_GUI_MAX),
    _name_pair("num_plus6", 139 + TILEG_GUI_MAX),
    _name_pair("num_plus7", 140 + TILEG_GUI_MAX),
    _name_pair("num_plus8", 141 + TILEG_GUI_MAX),
    _name_pair("num_plus9", 142 + TILEG_GUI_MAX),
    _name_pair("num_zero", 133 + TILEG_GUI_MAX),
    _name_pair("oor_mesh", 114 + TILEG_GUI_MAX),
    _name_pair("pain_bond", 71 + TILEG_GUI_MAX),
    _name_pair("pain_mirror", 40 + TILEG_GUI_MAX),
    _name_pair("paradox", 102 + TILEG_GUI_MAX),
    _name_pair("paralysed", 72 + TILEG_GUI_MAX),
    _name_pair("partially_charged", 58 + TILEG_GUI_MAX),
    _name_pair("petrified", 34 + TILEG_GUI_MAX),
    _name_pair("petrifying", 33 + TILEG_GUI_MAX),
    _name_pair("poison", 22 + TILEG_GUI_MAX),
    _name_pair("possessable", 49 + TILEG_GUI_MAX),
    _name_pair("pyrrhic", 99 + TILEG_GUI_MAX),
    _name_pair("rampage", 13 + TILEG_GUI_MAX),
    _name_pair("recall", 41 + TILEG_GUI_MAX),
    _name_pair("regeneration", 76 + TILEG_GUI_MAX),
    _name_pair("resistance", 67 + TILEG_GUI_MAX),
    _name_pair("retreat", 77 + TILEG_GUI_MAX),
    _name_pair("rimeblight", 80 + TILEG_GUI_MAX),
    _name_pair("sentinel_mark", 105 + TILEG_GUI_MAX),
    _name_pair("shadowless", 82 + TILEG_GUI_MAX),
    _name_pair("sign_of_ruin", 85 + TILEG_GUI_MAX),
    _name_pair("slowed", 30 + TILEG_GUI_MAX),
    _name_pair("slowly_dying", 50 + TILEG_GUI_MAX),
    _name_pair("something_under", 109 + TILEG_GUI_MAX),
    _name_pair("stab_brand", 39 + TILEG_GUI_MAX),
    _name_pair("sticky_flame", 25 + TILEG_GUI_MAX),
    _name_pair("still_winds", 62 + TILEG_GUI_MAX),
    _name_pair("strong_willed", 106 + TILEG_GUI_MAX),
    _name_pair("summoned", 19 + TILEG_GUI_MAX),
    _name_pair("sundering", 108 + TILEG_GUI_MAX),
    _name_pair("swift", 47 + TILEG_GUI_MAX),
    _name_pair("teleporting", 65 + TILEG_GUI_MAX),
    _name_pair("tempered", 88 + TILEG_GUI_MAX),
    _name_pair("tesseract_spawn", 107 + TILEG_GUI_MAX),
    _name_pair("touch_of_beogh", 79 + TILEG_GUI_MAX),
    _name_pair("trap_net", 0 + TILEG_GUI_MAX),
    _name_pair("trap_web", 14 + TILEG_GUI_MAX),
    _name_pair("travel_exclusion_centre_fg", 117 + TILEG_GUI_MAX),
    _name_pair("travel_exclusion_fg", 116 + TILEG_GUI_MAX),
    _name_pair("travel_path_from", 156 + TILEG_GUI_MAX),
    _name_pair("travel_path_to", 164 + TILEG_GUI_MAX),
    _name_pair("tutorial_cursor", 11 + TILEG_GUI_MAX),
    _name_pair("unaware", 37 + TILEG_GUI_MAX),
    _name_pair("undying_arms", 81 + TILEG_GUI_MAX),
    _name_pair("unrewarding", 20 + TILEG_GUI_MAX),
    _name_pair("unstable", 90 + TILEG_GUI_MAX),
    _name_pair("vampire_thrall", 93 + TILEG_GUI_MAX),
    _name_pair("vengeance_target", 78 + TILEG_GUI_MAX),
    _name_pair("vexed", 92 + TILEG_GUI_MAX),
    _name_pair("vile_clutch", 48 + TILEG_GUI_MAX),
    _name_pair("vitrified", 74 + TILEG_GUI_MAX),
    _name_pair("warding", 103 + TILEG_GUI_MAX),
    _name_pair("waterlogged", 63 + TILEG_GUI_MAX),
    _name_pair("weak_willed", 84 + TILEG_GUI_MAX),
    _name_pair("weakened", 64 + TILEG_GUI_MAX),
};

bool tile_icons_index(const char *str, tileidx_t *idx)
{
    ASSERT(str);
    if (!str)
        return false;

    string lc = str;
    for (unsigned int i = 0; i < lc.size(); i++)
        lc[i] = toalower(lc[i]);

    int num_pairs = sizeof(icons_name_pairs) / sizeof(icons_name_pairs[0]);
    bool result = binary_search<const char *, tileidx_t>(
       lc.c_str(), &icons_name_pairs[0], num_pairs, &strcmp, idx);
    return result;
}

bool tile_icons_equal(tileidx_t tile, tileidx_t idx)
{
    ASSERT_RANGE(tile, TILEG_GUI_MAX, TILEI_ICONS_MAX);
    return idx >= tile && idx < tile + tile_icons_count(tile);
}


typedef pair<tile_variation, tileidx_t> _variation_pair;

static _variation_pair icons_colour_pairs[] =
{
    _variation_pair(tile_variation(0, 0), 0),
};

tileidx_t tile_icons_coloured(tileidx_t idx, int col)
{
    int num_pairs = sizeof(icons_colour_pairs) / sizeof(icons_colour_pairs[0]);
    tile_variation key(idx, col);
    tileidx_t found;
    bool result = binary_search<tile_variation, tileidx_t>(
       key, &icons_colour_pairs[0], num_pairs,
       &tile_variation::cmp, &found);
    return (result ? found : idx);
}

static _variation_pair icons_enchant_pairs[] =
{
    _variation_pair(tile_variation(0, 0), 0),
};

tileidx_t tile_icons_enchanted(tileidx_t idx, int ench)
{
    int num_pairs = sizeof(icons_enchant_pairs) / sizeof(icons_enchant_pairs[0]);
    tile_variation key(idx, ench);
    tileidx_t found;
    bool result = binary_search<tile_variation, tileidx_t>(
       key, &icons_enchant_pairs[0], num_pairs,
       &tile_variation::cmp, &found);
    return (result ? found : idx);
}

