namespace Theriapolis.Core.World;
///
/// Per-tile data for a single world tile (1/1024 of the continent's width).
/// All float fields are normalized to [0, 1] unless noted.
///
public struct WorldTile
{
public float Elevation; // 0 = sea floor, 1 = mountain peak
public float Moisture; // 0 = arid, 1 = saturated
public float Temperature; // 0 = polar, 1 = equatorial
public BiomeId Biome;
public FeatureFlags Features;
/// Macro-grid cell index (x + y*32) for this tile.
public byte MacroX;
public byte MacroY;
// ── Phase 2+3 additions ──────────────────────────────────────────────────
///
/// Direction (Dir.N..Dir.NW, or Dir.None) that a river polyline flows through this tile.
/// Set by HydrologyGenStage when rasterizing river polylines.
///
public byte RiverFlowDir;
///
/// Direction (Dir.N..Dir.NW, or Dir.None) that a rail polyline passes through this tile.
/// Set by RailNetworkGenStage when rasterizing rail polylines.
///
public byte RailDir;
///
/// Settlement ID (1-based) of the settlement whose footprint covers this tile.
/// 0 = no settlement.
///
public ushort SettlementId;
}
///
/// Biome identifiers. Enums, not magic ints.
///
public enum BiomeId : byte
{
None = 0,
Ocean,
Tundra,
Boreal,
TemperateDeciduous,
TemperateGrassland,
MountainAlpine,
MountainForested,
SubtropicalForest,
Wetland,
Coastal,
RiverValley,
Scrubland,
DesertCold,
// Transition biomes (assigned by BorderDistortionGen)
ForestEdge,
Foothills,
MarshEdge,
Beach,
Cliff,
TidalFlat,
Mangrove,
}
///
/// Bitmask of linear and special features on a tile.
/// Per-tile flags are derived caches — polylines are the source of truth for rivers/roads/rail.
///
[Flags]
public enum FeatureFlags : ushort
{
None = 0,
HasRiver = 1 << 0,
HasRoad = 1 << 1,
HasRail = 1 << 2,
IsSettlement = 1 << 3,
IsPoi = 1 << 4,
IsCoast = 1 << 5,
IsBorder = 1 << 6, // biome or land/ocean border (set during distortion pass)
RiverAdjacent = 1 << 7,
RailroadAdjacent = 1 << 8,
}