unit uHCAnnexDefs;

{$ifdef FPC}
{$mode objfpc}{H+}
{$endif}

interface

uses Classes, uHCTypeDefs, uHCDefines;

const
  // ALE 20150928 Misc constants
  INDEX_MASK      = $07FF;
  ANNEX_MASK      = $F000;
  INVALID_ID      = $FFFF;
  INVALID_IDX     = $FF;

  // ALE 20150813 Annex numbers
  SHIP_FLAG =       $00;   // A1
  SUB_FLAG =        $01;   // A2
  PLANE_FLAG =      $02;   // B1
  GUN_FLAG =        $03;   // C1
  MISSILE_FLAG =    $04;   // D1
  ASW_FLAG =        $05;   // E1
  TORP_FLAG =       $06;   // F1
  ATOG_FLAG =       $07;   // G1
  ECM_FLAG =        $08;   // G2
  NUKE_FLAG =       $09;   // I1
  RADAR_FLAG =      $0A;   // J1
  SONAR_FLAG =      $0B;   // M1
  BASE_FLAG =       $0C;   // P1
  LOADOUT_FLAG =    $0D;   // Y1
  MOUNT_FLAG =      $0E;   // Z1
  MULTI_FLAG =      $0F;   // Z2

  // ALE 20150814 Class Name Lengths
  C1_NAME_LEN = 48;
  D1_NAME_LEN = 48;
  E1_NAME_LEN = 48;
  F1_NAME_LEN = 48;
  G1_NAME_LEN = 48;
  G2_NAME_LEN = 48;
  J1_NAME_LEN = 48;
  M1_NAME_LEN = 48;
  Z1_NAME_LEN = 48;

  // ALE 20250220 for mem annexes
  DAMAGED_SHIP_SPEEDS = 4;

type
  // ALE 20150713 Forward type declarations so we can use them in later types
  PHCAnnexA1_disk = ^THCAnnexA1_disk;
  PHCAnnexA2_disk = ^THCAnnexA2_disk;
  PHCAnnexB1_disk = ^THCAnnexB1_disk;
  PHCAnnexC1_disk = ^THCAnnexC1_disk;
  PHCAnnexD1_disk = ^THCAnnexD1_disk;
  PHCAnnexE1_disk = ^THCAnnexE1_disk;
  PHCAnnexF1_disk = ^THCAnnexF1_disk;
  PHCAnnexG1_disk = ^THCAnnexG1_disk;
  PHCAnnexG2_disk = ^THCAnnexG2_disk;
  PHCAnnexI1_disk = ^THCAnnexI1_disk;
  PHCAnnexJ1_disk = ^THCAnnexJ1_disk;
  PHCAnnexM1_disk = ^THCAnnexM1_disk;
  PHCAnnexP1_disk = ^THCAnnexP1_disk;
  PHCAnnexY1_disk = ^THCAnnexY1_disk;
  PHCAnnexZ1_disk = ^THCAnnexZ1_disk;
  PHCAnnexZ2_disk = ^THCAnnexZ2_disk;
  PHCAnnexes_disk = ^THCAnnexes_disk;

  PHCAnnexA1_disk_V1 = ^THCAnnexA1_disk_V1;
  PHCAnnexA2_disk_V1 = ^THCAnnexA2_disk_V1;
  PHCAnnexB1_disk_V1 = ^THCAnnexB1_disk_V1;
  PHCAnnexP1_disk_V1 = ^THCAnnexP1_disk_V1;
  PHCAnnexes_disk_V2 = ^THCAnnexes_disk_V2;

  PHCAnnexA1_mem = ^THCAnnexA1_mem;
  PHCAnnexA2_mem = ^THCAnnexA2_mem;
  PHCAnnexB1_mem = ^THCAnnexB1_mem;
  PHCAnnexC1_mem = ^THCAnnexC1_mem;
  PHCAnnexD1_mem = ^THCAnnexD1_mem;
  PHCAnnexE1_mem = ^THCAnnexE1_mem;
  PHCAnnexF1_mem = ^THCAnnexF1_mem;
  PHCAnnexG1_mem = ^THCAnnexG1_mem;
  PHCAnnexG2_mem = ^THCAnnexG2_mem;
  PHCAnnexI1_mem = ^THCAnnexI1_mem;
  PHCAnnexJ1_mem = ^THCAnnexJ1_mem;
  PHCAnnexM1_mem = ^THCAnnexM1_mem;
  PHCAnnexP1_mem = ^THCAnnexP1_mem;
  PHCAnnexY1_mem = ^THCAnnexY1_mem;
  PHCAnnexZ1_mem = ^THCAnnexZ1_mem;
  PHCAnnexZ2_mem = ^THCAnnexZ2_mem;
  PHCAnnexes_mem = ^THCAnnexes_mem;

  // ALE 20150713 back to our regularly scheduled type definitions
  THCAnnexA1_disk = packed record // ALE 20150813 Ships/MLUs
    DiskId: ID;
    Displacement: long;  // water tonage displacement       -- disk only
    MntId: array[0..MAX_SHIP_MOUNTS - 1] of ID;    // mount disk ids          -- disk,temp
    SensId: array[0..MAX_SHIP_SENSORS - 1] of ID;  // sensor disk ids         -- disk,temp
    OrigDp: ushort;        		// Original damage points          -- disk,temp
    TextIndex: ushort;     		// file offset for text            -- disk only
    PictureIndex: ushort;  		// file offset for picture         -- disk, mem
    Length: ushort;        		// Length of ship in meters        -- disk only
    MagStart: ushort;      		// starting location of ship's mags-- disk,temp
    MagCount: ushort;      		// # of magazine records           -- disk,temp
    UnitFlags: uchar;      		// bitfield for this unit          -- disk, mem
    MaxSpeed: uchar;       		// max speed for ship (Speed[3])   -- disk, mem
    DetectSize: uchar;     		// size factor affecting detection -- disk, mem
    SearchHeight: uchar;   		// height of ship (alt band)       -- disk,temp
    DeprecatedCountry: uchar;	// Ship's country of origin        -- disk only
    VicType: uchar;        		// broad grouping for vict condit. -- disk,temp
    Subtype: uchar;        		// index into ship strs (DDG,etc)  -- disk,temp
    ShipForm: uchar;       		// ship form type                  -- disk,temp
    Propulsion: ShortInt;  		// Propulsion type                 -- disk, mem
    Armor: array[0..ARMOR_SECTORS - 1] of ShortInt;  // Armor values for 6 ship sects   -- disk, mem
    Runway: ShortInt;      		// runway length (if any!)         -- disk, mem
    PlaneCapacity: uchar;  		// # of air assets we can hold (/2)-- disk, mem
    SType: AnsiChar;       		// Unit type -- 'S'                -- disk,temp
    ClassName: array[0..CLASS_NAME_LEN-1] of AnsiChar; // Name of class (eg O.H. Perry)   -- disk, mem
    RCS: uchar;  				// Radar cross section of ship -- disk, mem
    BaseSourceLevel: ShortInt; 	// Sonar base source level -- disk, mem
    Country: ulong;
    Spares: array[0..NUM_SPARE_BYTES - 2 - 1 - 4] of Byte;  // ALE took 1 for RCS, 1 for BaseSourceLevel, 4 for Country
  end;

  THCAnnexA1_mem = packed record
    case Integer of
      0: (
        disk: THCAnnexA1_disk; // Replace Tdisk with the actual type
        Speed: array[0..DAMAGED_SHIP_SPEEDS - 1] of uchar;
      );
  end;

  THCAnnexA1_disk_V1 = packed record // ALE 20150813 Ships/MLUs
    DiskId: ID;
    Displacement: long;  // water tonage displacement       -- disk only
    MntId: array[0..MAX_SHIP_MOUNTS - 1] of ID;    // mount disk ids          -- disk,temp
    SensId: array[0..MAX_SHIP_SENSORS - 1] of ID;  // sensor disk ids         -- disk,temp
    OrigDp: ushort;        // Original damage points          -- disk,temp
    TextIndex: ushort;     // file offset for text            -- disk only
    PictureIndex: ushort;  // file offset for picture         -- disk, mem
    Length: ushort;        // Length of ship in meters        -- disk only
    MagStart: ushort;      // starting location of ship's mags-- disk,temp
    MagCount: ushort;      // # of magazine records           -- disk,temp
    UnitFlags: uchar;      // bitfield for this unit          -- disk, mem
    MaxSpeed: uchar;       // max speed for ship (Speed[3])   -- disk, mem
    DetectSize: uchar;     // size factor affecting detection -- disk, mem
    SearchHeight: uchar;   // height of ship (alt band)       -- disk,temp
    Country: uchar;        // Ship's country of origin        -- disk only
    VicType: uchar;        // broad grouping for vict condit. -- disk,temp
    Subtype: uchar;        // index into ship strs (DDG,etc)  -- disk,temp
    ShipForm: uchar;       // ship form type                  -- disk,temp
    Propulsion: ShortInt;  // Propulsion type                 -- disk, mem
    Armor: array[0..ARMOR_SECTORS - 1] of ShortInt;  // Armor values for 6 ship sects   -- disk, mem
    Runway: ShortInt;      // runway length (if any!)         -- disk, mem
    PlaneCapacity: uchar;  // # of air assets we can hold (/2)-- disk, mem
    SType: AnsiChar;       // Unit type -- 'S'                -- disk,temp
    ClassName: array[0..CLASS_NAME_LEN-1] of AnsiChar; // Name of class (eg O.H. Perry)   -- disk, mem
    RCS: uchar;  // Radar cross section of ship -- disk, mem
    BaseSourceLevel: ShortInt; // Sonar base source level -- disk, mem
    Spares: array[0..NUM_SPARE_BYTES - 2 - 1] of Byte;  // ALE took 1 for RCS, 1 for BaseSourceLevel
  end;

  THCAnnexA2_disk = packed record // ALE 20150813 Subs
    DiskId: ID;
    Displacement: long;  // water tonage displacement       -- disk only
    MntId: array[0..MAX_SUB_MOUNTS - 1] of ID;    // mount disk ids          -- disk,temp
    SensId: array[0..MAX_SUB_SENSORS - 1] of ID;  // sensor disk ids         -- disk,temp
    OrigDp: ushort;        		// Original damage points          -- disk,temp
    TextIndex: ushort;     		// file offset for text            -- disk only
    PictureIndex: ushort;  		// file offset for picture         -- disk, mem
    Length: ushort;        		// Length of sub in meters         -- disk only
    UnitFlags: ushort;     		// bitfield for this unit          -- disk, mem
    MaxSubSpeed: uchar;    		// max speed for sub submerged     -- disk, mem
    MaxSurfSpeed: uchar;   		// max speed for sub on surface    -- disk, mem
    CreepSpeed: uchar;     		// creep speed for sub             -- disk, mem
    MaxDepth: uchar;       		// maximum depth of sub (alt band) -- disk, mem
    DetectSize: uchar;     		// size factor affecting detection -- disk, mem
    DeprecatedCountry: uchar;	// Sub's country of origin         -- disk only
    VicType: uchar;        		// index into broad, vict cond typ -- disk,temp
    Subtype: uchar;        		// index into ship strs (DDG,etc)  -- disk,temp
    ShipForm: uchar;       		// ship form type                  -- disk,temp
    Propulsion: ShortInt;  		// Propulsion type                 -- disk, mem
    HydroPdMod: ShortInt;  		// passive sonar detect modifier   -- disk,temp
    SonarPdMod: ShortInt;  		// active sonar detect modifier    -- disk,temp
    ClassName: array[0..CLASS_NAME_LEN-1] of AnsiChar; // name of class (ie Imp. Los Angeles)   -- disk, temp
    RCS: uchar;  				// Radar cross section of sub -- disk, mem
    BaseSourceLevel: ShortInt; 	// Sonar base source level -- disk, mem
    Country: ulong;
    Spares: array[0..NUM_SPARE_BYTES - 2 - 1 - 4] of Byte;  // ALE took 1 for RCS, 1 for BaseSourceLevel, 4 for Country
  end;

  THCAnnexA2_mem = packed record
    case Integer of
      0: (
        disk: THCAnnexA2_disk;
        SubSpeed: array[0..DAMAGED_SHIP_SPEEDS - 1] of uchar; // submerged speed for 0, 25%, 50%, 75% damage
        SurfSpeed: array[0..DAMAGED_SHIP_SPEEDS - 1] of uchar; // speed for 0, 25%, 50%, 75% damage
      );
  end;

  THCAnnexA2_disk_V1 = packed record // ALE 20150813 Subs
    DiskId: ID;
    Displacement: long;  // water tonage displacement       -- disk only
    MntId: array[0..MAX_SUB_MOUNTS - 1] of ID;    // mount disk ids          -- disk,temp
    SensId: array[0..MAX_SUB_SENSORS - 1] of ID;  // sensor disk ids         -- disk,temp
    OrigDp: ushort;        		// Original damage points          -- disk,temp
    TextIndex: ushort;     		// file offset for text            -- disk only
    PictureIndex: ushort;  		// file offset for picture         -- disk, mem
    Length: ushort;        		// Length of sub in meters         -- disk only
    UnitFlags: ushort;     		// bitfield for this unit          -- disk, mem
    MaxSubSpeed: uchar;    		// max speed for sub submerged     -- disk, mem
    MaxSurfSpeed: uchar;   		// max speed for sub on surface    -- disk, mem
    CreepSpeed: uchar;     		// creep speed for sub             -- disk, mem
    MaxDepth: uchar;       		// maximum depth of sub (alt band) -- disk, mem
    DetectSize: uchar;     		// size factor affecting detection -- disk, mem
    DeprecatedCountry: uchar;	// Sub's country of origin         -- disk only
    VicType: uchar;        		// index into broad, vict cond typ -- disk,temp
    Subtype: uchar;        		// index into ship strs (DDG,etc)  -- disk,temp
    ShipForm: uchar;       		// ship form type                  -- disk,temp
    Propulsion: ShortInt;  		// Propulsion type                 -- disk, mem
    HydroPdMod: ShortInt;  		// passive sonar detect modifier   -- disk,temp
    SonarPdMod: ShortInt;  		// active sonar detect modifier    -- disk,temp
    ClassName: array[0..CLASS_NAME_LEN-1] of AnsiChar; // name of class (ie Imp. Los Angeles)   -- disk, temp
    RCS: uchar;  				// Radar cross section of sub -- disk, mem
    BaseSourceLevel: ShortInt; 	// Sonar base source level -- disk, mem
    Spares: array[0..NUM_SPARE_BYTES - 2 - 1] of Byte;  // ALE took 1 for RCS, 1 for BaseSourceLevel
  end;

  THCAnnexB1_disk = packed record // ALE 20150813 Aircraft
    DiskId: ID;
    SensId: array[0..MAX_PLANE_SENSORS - 1] of ID;  // disk ids for sensors  -- disk, mem
    LoadId: array[0..MAX_PLANE_LOADOUTS - 1] of ID; // disk ids for loadouts -- disk,temp
    Range: ushort;  // Distance plane can go on fuel   -- disk, mem
    InternalFuel: ushort; // Internal Fuel in 10*Kg          -- disk, mem
    SpeedLevels: array[0..PLANE_SPEED_LEVELS - 1] of ushort;  // Boundaries corresp to spd types -- disk, mem
    ClimbRate: ushort;     		// Rate of climb                   -- disk, mem
    TextIndex: ushort;     		// resource index for text         -- disk only
    PictureIndex: ushort;  		// resource index for picture      -- disk, mem
    UnitFlags: ushort;     		// Bitfield used in sensors and possibly more -- disk, mem
    MaxAlt: uchar;      		// how high this thing can go -band-- disk, mem
    Size: uchar;        		// size target                     -- disk, mem
    ATA: uchar;         		// Air to Air Rating               -- disk, mem
    DATA: uchar;        		// Defensive ATA                   -- disk, mem
    VicType: uchar;     		// index into broad vic cond types -- disk, mem
    Subtype: uchar;     		// Air subtype (index to type strs)-- disk, mem
    Ecm: uchar;         		// Built in ECM value              -- disk, mem
    Country: uchar;				// Country of origin               -- disk only
    Propulsion: uchar;  		// Jet or Prop                     -- disk, mem
    Runway: uchar;      		// the type of runway it needs     -- disk, mem
    AType: AnsiChar; 			// Unit type -- 'A' or 'H'         -- disk, mem
    ClassName: array[0..C1_NAME_LEN-1] of AnsiChar; // name of class (ie P-3C Orion)   -- disk, temp
    RCS: uchar;  				// Radar cross section of plane -- disk, mem
    Spares: array[0..NUM_SPARE_BYTES - 1 - 1] of Byte;  // ALE took 1 for RCS
  end;

  THCAnnexB1_mem = packed record
    case Integer of
      0: (
        disk: THCAnnexB1_disk;
      );
  end;

  THCAnnexB1_disk_V1 = packed record // ALE 20150813 Aircraft
    DiskId: ID;
    SensId: array[0..MAX_PLANE_SENSORS - 1] of ID;  // disk ids for sensors  -- disk, mem
    LoadId: array[0..MAX_PLANE_LOADOUTS - 1] of ID; // disk ids for loadouts -- disk,temp
    Range: ushort;  // Distance plane can go on fuel   -- disk, mem
    InternalFuel: ushort; // Internal Fuel in 10*Kg          -- disk, mem
    SpeedLevels: array[0..PLANE_SPEED_LEVELS - 1] of ushort;  // Boundaries corresp to spd types -- disk, mem
    ClimbRate: ushort;     		// Rate of climb                   -- disk, mem
    TextIndex: ushort;     		// resource index for text         -- disk only
    PictureIndex: ushort;  		// resource index for picture      -- disk, mem
    UnitFlags: ushort;     		// Bitfield used in sensors and possibly more -- disk, mem
    MaxAlt: uchar;      		// how high this thing can go -band-- disk, mem
    Size: uchar;        		// size target                     -- disk, mem
    ATA: uchar;         		// Air to Air Rating               -- disk, mem
    DATA: uchar;        		// Defensive ATA                   -- disk, mem
    VicType: uchar;     		// index into broad vic cond types -- disk, mem
    Subtype: uchar;     		// Air subtype (index to type strs)-- disk, mem
    Ecm: uchar;         		// Built in ECM value              -- disk, mem
    DeprecatedCountry: uchar;	// Country of origin               -- disk only
    Propulsion: uchar;  		// Jet or Prop                     -- disk, mem
    Runway: uchar;      		// the type of runway it needs     -- disk, mem
    AType: AnsiChar; 			// Unit type -- 'A' or 'H'         -- disk, mem
    ClassName: array[0..C1_NAME_LEN-1] of AnsiChar; // name of class (ie P-3C Orion)   -- disk, temp
    RCS: uchar;  				// Radar cross section of plane -- disk, mem
	Country: ulong;
    Spares: array[0..NUM_SPARE_BYTES - 1 - 1 - 4] of Byte;  // ALE took 1 for RCS, 4 for Country
  end;

  THCAnnexC1_disk = packed record // ALE 20150813 Guns
    DiskId: ID;
    SurfRange: ushort; // Range in nm against surface targets   -- disk, mem
    AirRange: ushort;  // Range in nm against air targets       -- disk, mem
    Dp: uchar;  // Damage Points gun inflicts      -- disk, mem
    SurfNearPh: uchar; // PH at distance up to 1/2 range  -- disk, mem
    SurfFarPh: uchar; // PH between 1/2 and full range   -- disk, mem
    AirPh: uchar;     // PH against air targets          -- disk, mem
    MaxAlt: uchar;    // Max altitude (band)             -- disk, mem
    MinAlt: uchar;    // Min altitude (band)             -- disk, mem
    ArmorTable: uchar; // index into Armor Table          -- disk, mem
    ClassName: array[0..C1_NAME_LEN-1] of AnsiChar; // Class Name of gun               -- disk only
    Spares: array[0..NUM_SPARE_BYTES-1] of Byte;
  end;

  THCAnnexC1_mem = packed record
    case Integer of
      0: (
        disk: THCAnnexC1_disk;
      );
  end;

  THCAnnexD1_disk = packed record // ALE 20150813 Missiles
    DiskId: ID;
    Dp: ushort; // <= MAX_CONV_DP -- dp, else nuke id      -- disk, mem
    SurfRange: ushort; // Range in nm against surface targets   -- disk, mem
    AirRange: ushort;  // Range in nm against air targets       -- disk, mem
    MinRange: ushort;  // minimum range (nm)              -- disk, mem
    Speed: ushort; // speed of travel (kts)           -- disk, mem
    MissileFlags: uchar;  // bitfield                        -- disk, mem
    SurfPh: uchar; // PH against surface targets      -- disk, mem
    AirPh: uchar;  // PH against air targets          -- disk, mem
    MaxAlt: uchar;  // Max altitude (band)             -- disk, mem
    MinAlt: uchar;   // Min altitude (band)             -- disk, mem
    ArmorTable: uchar; // index into Armor Table          -- disk, mem
    Guidance: uchar; // guidance code                   -- disk, mem
    TermTraj: uchar; // pop-up or not?                  -- disk, mem
    WayPoints: uchar; // how many way points             -- disk, mem
    ClassName: array[0..D1_NAME_LEN - 1] of AnsiChar; // name of missile class           -- disk only
    RCS: uchar; // Radar cross section of missile -- disk, mem
    Spares: array[0..NUM_SPARE_BYTES - 1 - 1] of Byte; // ALE took 1 for RCS
  end;

  THCAnnexD1_mem = packed record
    case Integer of
      0: (
        disk: THCAnnexD1_disk;
      );
  end;

  THCAnnexE1_disk = packed record // ALE 20150813 ASW (Depth Charges,...)
    DiskId: ID;
    Dp: ushort; // <= MAX_CONV_DP -- dp, else nuke id      -- disk, mem
    MaxRange: ushort;  // Maximum range (nm)              -- disk, mem
    MinRange: ushort;  // minimum range (nm)              -- disk, mem
    Speed: ushort; // speed of travel (kts)           -- disk, mem
    Ph: uchar; // probability of hit              -- disk, mem
    WType: ShortInt; // weapon type                     -- disk, mem
    ClassName: array[0..D1_NAME_LEN - 1] of AnsiChar; // name of weapon class           -- disk only
    RCS: uchar; // Radar cross section of missile -- disk, mem
    Spares: array[0..NUM_SPARE_BYTES - 1 - 1] of Byte; // ALE took 1 for RCS
  end;

  THCAnnexE1_mem = packed record
    case Integer of
      0: (
        disk: THCAnnexE1_disk;
      );
  end;

  THCAnnexF1_disk = packed record // ALE 20150813 Torpedoes
    DiskId: ID;
    SubDp: ushort;   // <= MAX_CONV_DP dp, else nuke (I1) id    -- disk, mem
    SurfDp: ushort;  // <= MAX_CONV_DP dp, else nuke (I1) id    -- disk, mem
    MaxRange: array[0..TORPEDO_SPEEDS - 1] of ushort; // ranges for dual speed torp      -- disk, mem
    AcquisRange: ushort;  // acquisition range               -- disk, mem
    TorpFlags: uchar;  // bitfield                        -- disk, mem
    Speed: array[0..TORPEDO_SPEEDS - 1] of uchar; // speeds for dual speed torp      -- disk, mem
    Ph: uchar;   // probability of hit              -- disk, mem
    MaxDepth: uchar;  // maximum depth for target        -- disk, mem
    Guidance: ShortInt;   // guidance code                   -- disk, mem
    ClassName: array[0..F1_NAME_LEN - 1] of AnsiChar; // name of torp class              -- disk only
    BaseSourceLevel: ShortInt; // Sonar base source level -- disk, mem
    Spares: array[0..NUM_SPARE_BYTES - 1 - 1] of Byte;  // ALE took 1 for BaseSourceLevel
  end;

  THCAnnexF1_mem = packed record
    case Integer of
      0: (
        disk: THCAnnexF1_disk;
      );
  end;

  THCAnnexG1_disk = packed record // ALE 20150813 ATOG (Air to Ground/Bombs)
    DiskId: ID;
    Dp: ushort; // <= MAX_CONV_DP -- dp, else nuke id      -- disk, mem
    MaxRange: ushort;   // Maximum range (nm)              -- disk, mem
    Ph: uchar;   // probability of hit              -- disk, mem
    WType: ShortInt; // weapon type                     -- disk, mem
    ClassName: array[0..G1_NAME_LEN - 1] of AnsiChar; // name of weapon class              -- disk only
    Spares: array[0..NUM_SPARE_BYTES - 1] of Byte;
  end;

   THCAnnexG1_mem = packed record
    case Integer of
      0: (
        disk: THCAnnexG1_disk;
      );
  end;

  THCAnnexG2_disk = packed record // ALE 20150813 ECM
    DiskId: ID;
    MaxRange: ushort;   // Maximum range (nm)              -- disk, mem
    Modifier: uchar;    // modifier to enemy's Pd for range-- disk, mem
    WType: ShortInt;    // ecm type                        -- disk, mem
    ClassName: array[0..G2_NAME_LEN - 1] of AnsiChar; // name of ECM class              -- disk only
    Spares: array[0..NUM_SPARE_BYTES - 1] of Byte;
  end;

  THCAnnexG2_mem = packed record
    case Integer of
      0: (
        disk: THCAnnexG2_disk;
      );
  end;

  THCAnnexI1_disk = packed record // ALE 20150813 Nukes
    DiskId: ID;
    KillRange: ushort;   // Kill radius x10? (nm)                -- disk, mem
    DamageRange: ushort;   // Damage radius x10? (nm)              -- disk, mem
    BurstType: ShortInt;   // where it detonates air or surface    -- disk, mem
    Spares: array[0..NUM_SPARE_BYTES - 1] of Byte;
  end;

  THCAnnexI1_mem = packed record
    case Integer of
      0: (
        disk: THCAnnexI1_disk;
      );
  end;

  THCAnnexJ1_disk = packed record // ALE 20150813 Radars
    DiskId: ID;
    MaxRange: ushort;   // max detection range             -- disk, mem
    RType: uchar; // radar type                      -- disk, mem
    Pd: uchar;    // probability of detection        -- disk, mem
    Eccm: uchar;  // anti-ecm capability             -- disk, mem
    ClassName: array[0..J1_NAME_LEN - 1] of AnsiChar; // name of radar              -- disk only
    Spares: array[0..NUM_SPARE_BYTES - 1] of Byte;
  end;

  THCAnnexJ1_mem = packed record
    case Integer of
      0: (
        disk: THCAnnexJ1_disk;
      );
  end;

  THCAnnexM1_disk = packed record // ALE 20150813 Sonars
    DiskId: ID;
    ActiveRange: ushort;   // max range when active           -- disk, mem
    PassiveRange: ushort;  // max range when passive          -- disk, mem
    Cz: uchar;             // # of convergence zones          -- disk, mem
    ActivePd: uchar;       // prob of detect when active      -- disk, mem
    PassivePd: uchar;      // prob of detect when passive     -- disk, mem
    SType: ShortInt;       // type of sonar                   -- disk, mem
    ClassName: array[0..M1_NAME_LEN - 1] of AnsiChar; // name of radar              -- disk only
    Spares: array[0..NUM_SPARE_BYTES - 1] of Byte;
  end;

  THCAnnexM1_mem = packed record
    case Integer of
      0: (
        disk: THCAnnexM1_disk;
        ActiveRD: Byte;
        PassiveRD: Byte;
        Frequency: Byte;
        DiskActiveRange: long;  // max range when active
        DiskPassiveRange: long; // max range when passive
        DiskCz: long;           // # of convergence zones
      );
  end;

  THCAnnexP1_disk = packed record // ALE 20150813 Installations/Bases
    DiskId: ID;
    sLat: long; // position in slivers             -- disk,temp
    sLon: long;
    MntId: array[0..MAX_BASE_MOUNTS - 1] of ushort;   // base's default mounts   -- disk,temp
    SensId: array[0..MAX_BASE_SENSORS - 1] of ushort; // base's default sensors  -- disk,temp
    OrigDp: ushort;   			// starting damage points          -- disk,temp
    MagStart: ushort; 			// starting location of base's mags-- disk,temp
    MagCount: ushort; 			// # of magazine records           -- disk,temp
    Side: uchar;      			// default alignment               -- disk only
    DeprecatedCountry: uchar;	// Country where located           -- disk, mem
    VicType: uchar;   			// index into broad vict cond types -- disk,temp
    Runway: ShortInt; 			// the type of runway it has       -- disk, mem
    NumRunways: ShortInt;  		// the number of runways           -- disk, mem
    IType: ShortInt;  			// the type of base this is        -- disk,temp
    Name: array[0..CLASS_NAME_LEN - 1] of AnsiChar; // name of installation              -- disk only
    RCS: uchar;   				// Radar cross section of base -- disk, mem
	Country: ulong;
    Spares: array[0..NUM_SPARE_BYTES - 1 - 1 - 4] of Byte;  // ALE took 1 for RCS, 4 for Country
  end;

  THCAnnexP1_mem = packed record
    case Integer of
      0: (
        disk: THCAnnexP1_disk;
      );
  end;

  THCAnnexP1_disk_V1 = packed record // ALE 20150813 Installations/Bases
    DiskId: ID;
    sLat: long; // position in slivers             -- disk,temp
    sLon: long;
    MntId: array[0..MAX_BASE_MOUNTS - 1] of ushort;   // base's default mounts   -- disk,temp
    SensId: array[0..MAX_BASE_SENSORS - 1] of ushort; // base's default sensors  -- disk,temp
    OrigDp: ushort;   			// starting damage points          -- disk,temp
    MagStart: ushort; 			// starting location of base's mags-- disk,temp
    MagCount: ushort; 			// # of magazine records           -- disk,temp
    Side: uchar;      			// default alignment               -- disk only
    Country: uchar;				// Country where located           -- disk, mem
    VicType: uchar;   			// index into broad vict cond types -- disk,temp
    Runway: ShortInt; 			// the type of runway it has       -- disk, mem
    NumRunways: ShortInt;  		// the number of runways           -- disk, mem
    IType: ShortInt;  			// the type of base this is        -- disk,temp
    Name: array[0..CLASS_NAME_LEN - 1] of AnsiChar; // name of installation              -- disk only
    RCS: uchar;   				// Radar cross section of base -- disk, mem
    Spares: array[0..NUM_SPARE_BYTES - 1 - 1] of Byte;  // ALE took 1 for RCS
  end;

  THCAnnexY1_disk = packed record // ALE 20150813 Loadouts
    DiskId: ID;
    WepId: array[0..MAX_LOADOUT_WEAPONS - 1] of ID; // ALE 20150813 AnnexID of each weapon
    Range: ushort; // ALE 20150813 range in nm
    MissionID: uchar;
    WepQty: array[0..MAX_LOADOUT_WEAPONS - 1] of uchar;
    DATA: uchar; // ALE 20150813 Defensive ATA rating
    Spares: array[0..(NUM_SPARE_BYTES - ((MAX_LOADOUT_WEAPONS - 4) * (SizeOf(uchar) + SizeOf(ID)))-1)] of Byte;
  end;

  THCAnnexY1_mem = packed record
    case Integer of
      0: (
        disk: THCAnnexY1_disk;
      );
  end;

  THCAnnexZ1_disk = packed record // ALE 20150813 Mounts
    DiskId: ID;
    Location: ulong; // bitfield -- mount's phys. locat.-- disk only
    WepId: ID;       // weapon id                       -- disk, mem
    Arc: ushort;     // bitfield -- mount's firing arc  -- disk, mem
    NumMounts: uchar;    // # physical mounts in this mount -- disk, mem
    NumRoundsMnt: uchar; // ammo count per mount            -- disk, mem
    NumTubes: uchar;     // # of tubes per physical mount   -- disk, mem
    NumTargets: uchar;   // # targets can simult. engage    -- disk, mem
    RateOfFire: uchar;   // # bursts per turn               -- disk, mem
    Autonomous: uchar;   // is this autonomous?             -- disk, mem
    CavityLabel: uchar;  // index to label string - display -- disk only
    MntArmor: ShortInt;  // Mnt Armor type                  -- disk, mem
    ClassName: array[0..Z1_NAME_LEN - 1] of AnsiChar; // name of mount              -- disk only
    Spares: array[0..NUM_SPARE_BYTES - 1] of Byte;
  end;

  THCAnnexZ1_mem = packed record
    case Integer of
      0: (
        disk: THCAnnexZ1_disk;
        FireLocations: uchar; // if this mount catches fire, where will it be?
      );
  end;

  THCAnnexZ2_disk = packed record // ALE 20150813 Multi-Mounts
    DiskId: ID;
    WepId: array[0..MOUNTS_PER_MULTI - 1] of ID; // weapon offsets                  -- disk, mem
    WepQty: array[0..MOUNTS_PER_MULTI - 1] of uchar; // qty of each type of weapon      -- disk, mem
    Spares: array[0..(NUM_SPARE_BYTES - ((MOUNTS_PER_MULTI - 4) * (sizeof(uchar) + sizeof(ushort))) - 1)] of Byte;
  end;

  THCAnnexZ2_mem = packed record
    case Integer of
      0: (
        disk: THCAnnexZ2_disk;
      );
  end;

  THCAnnexes_disk = packed record // ALE 20150813 How we package up the DB for use by ExportDLLs
    AnnexDiskRecCount: array[0..NUM_ANNEXES-1] of ID;
    PA1_DISK_PTR_LIST: PHCAnnexA1_disk;
    PA2_DISK_PTR_LIST: PHCAnnexA2_disk;
    PB1_DISK_PTR_LIST: PHCAnnexB1_disk;
    PC1_DISK_PTR_LIST: PHCAnnexC1_disk;
    PD1_DISK_PTR_LIST: PHCAnnexD1_disk;
    PE1_DISK_PTR_LIST: PHCAnnexE1_disk;
    PF1_DISK_PTR_LIST: PHCAnnexF1_disk;
    PG1_DISK_PTR_LIST: PHCAnnexG1_disk;
    PG2_DISK_PTR_LIST: PHCAnnexG2_disk;
    PI1_DISK_PTR_LIST: PHCAnnexI1_disk;
    PJ1_DISK_PTR_LIST: PHCAnnexJ1_disk;
    PM1_DISK_PTR_LIST: PHCAnnexM1_disk;
    PP1_DISK_PTR_LIST: PHCAnnexP1_disk;
    PY1_DISK_PTR_LIST: PHCAnnexY1_disk;
    PZ1_DISK_PTR_LIST: PHCAnnexZ1_disk;
    PZ2_DISK_PTR_LIST: PHCAnnexZ2_disk;
    // ALE 20150916 added for DllIntVer 14, HC 2015.016
    PBSStrings: PHCBS_STRINGS;
    PMAG_DISK_PTR_LIST: PHCMagRecsDiskPlatform ; // ALE 20150923 linked list of magazine records
    PNAME_DISK_PTR_LIST: PHCNameRecsDiskPlatform ; // ALE 20150924 linked list of platform names (individual units, not class name)
    PlatDescCount: long;
    PPLAT_DESC_LIST: PHCPlatformDescription ; // ALE 20150924 array of platform text descriptions
  end;

  THCAnnexes_disk_V2 = packed record // ALE 20150813 How we package up the DB for use by ExportDLLs
    AnnexDiskRecCount: array[0..NUM_ANNEXES-1] of ID;
    PA1_DISK_PTR_LIST: PHCAnnexA1_disk_V1;
    PA2_DISK_PTR_LIST: PHCAnnexA2_disk_V1;
    PB1_DISK_PTR_LIST: PHCAnnexB1_disk_V1;
    PC1_DISK_PTR_LIST: PHCAnnexC1_disk;
    PD1_DISK_PTR_LIST: PHCAnnexD1_disk;
    PE1_DISK_PTR_LIST: PHCAnnexE1_disk;
    PF1_DISK_PTR_LIST: PHCAnnexF1_disk;
    PG1_DISK_PTR_LIST: PHCAnnexG1_disk;
    PG2_DISK_PTR_LIST: PHCAnnexG2_disk;
    PI1_DISK_PTR_LIST: PHCAnnexI1_disk;
    PJ1_DISK_PTR_LIST: PHCAnnexJ1_disk;
    PM1_DISK_PTR_LIST: PHCAnnexM1_disk;
    PP1_DISK_PTR_LIST: PHCAnnexP1_disk_V1;
    PY1_DISK_PTR_LIST: PHCAnnexY1_disk;
    PZ1_DISK_PTR_LIST: PHCAnnexZ1_disk;
    PZ2_DISK_PTR_LIST: PHCAnnexZ2_disk;
    // ALE 20150916 added for DllIntVer 14, HC 2015.016
    PBSStrings: PHCBS_STRINGS_V2;
    PMAG_DISK_PTR_LIST: PHCMagRecsDiskPlatform ; // ALE 20150923 linked list of magazine records
    PNAME_DISK_PTR_LIST: PHCNameRecsDiskPlatform ; // ALE 20150924 linked list of platform names (individual units, not class name)
    PlatDescCount: long;
    PPLAT_DESC_LIST: PHCPlatformDescription ; // ALE 20150924 array of platform text descriptions
  end;

  THCAnnexes_mem = packed record // ALE 20250220 How we package up the DB for use by ExportDLLs
    AnnexMemRecCount: array[0..NUM_ANNEXES-1] of ID;
    PA1_MEM_PTR_LIST: PHCAnnexA1_mem;
    PA2_MEM_PTR_LIST: PHCAnnexA2_mem;
    PB1_MEM_PTR_LIST: PHCAnnexB1_mem;
    PC1_MEM_PTR_LIST: PHCAnnexC1_mem;
    PD1_MEM_PTR_LIST: PHCAnnexD1_mem;
    PE1_MEM_PTR_LIST: PHCAnnexE1_mem;
    PF1_MEM_PTR_LIST: PHCAnnexF1_mem;
    PG1_MEM_PTR_LIST: PHCAnnexG1_mem;
    PG2_MEM_PTR_LIST: PHCAnnexG2_mem;
    PI1_MEM_PTR_LIST: PHCAnnexI1_mem;
    PJ1_MEM_PTR_LIST: PHCAnnexJ1_mem;
    PM1_MEM_PTR_LIST: PHCAnnexM1_mem;
    PP1_MEM_PTR_LIST: PHCAnnexP1_mem;
    PY1_MEM_PTR_LIST: PHCAnnexY1_mem;
    PZ1_MEM_PTR_LIST: PHCAnnexZ1_mem;
    PZ2_MEM_PTR_LIST: PHCAnnexZ2_mem;
  end;

  implementation
end.
