/*
 * Lords of the Realm 2 — siege battle map tile
 *
 * 80×80 grid (0x50 × 0x50), 8 bytes per tile, linear index (y * 0x50 + x) * 8.
 * Loaded from castles.dat (0x3200 bytes per castle layout).
 *
 * Provenance: docs/structs/lotr2_battle_tile.md
 * Confidence: likely
 */
#ifndef LOTR2_BATTLE_TILE_H
#define LOTR2_BATTLE_TILE_H

#include <stdint.h>

#pragma pack(push, 1)

typedef enum lotr2_tile_type {
    LOTR2_TILE_OPEN_GROUND    = 0,
    LOTR2_TILE_GATE_OPEN      = 1,
    LOTR2_TILE_GATE_DRAWBRIDGE = 2,
    LOTR2_TILE_WALL_BREACH    = 3,
    LOTR2_TILE_WALL_INTACT    = 4,
    LOTR2_TILE_GATE_RAM_FACE  = 5,
    LOTR2_TILE_OIL_CAULDRON   = 7,
    LOTR2_TILE_MOAT_WATER     = 9,
    LOTR2_TILE_OIL_SPILL      = 10,
    LOTR2_TILE_VICTORY_FLAG   = 14,
} lotr2_tile_type;

typedef struct lotr2_battle_tile {
    uint8_t  damage_counter;    /* +0x00 gate/wall hit points */
    uint8_t  flags_a;             /* +0x01 moat/water bits */
    uint8_t  flags_b;             /* +0x02 passability / render */
    uint8_t  terrain_sprite;      /* +0x03 terrain animation index */
    uint8_t  elevation;           /* +0x04 height level */
    uint8_t  _pad05[0x02];
    uint8_t  tile_type;           /* +0x07 lotr2_battle_tile_type */
} lotr2_battle_tile;

#pragma pack(pop)

#define LOTR2_BATTLE_MAP_SIZE     0x50
#define LOTR2_BATTLE_TILE_STRIDE    8
#define LOTR2_SIEGE_GATE_BREAK_HITS 15

#endif /* LOTR2_BATTLE_TILE_H */
