use super::offsets::*;
use crate::inspect::smp::common::read_i32_at;

pub(in crate::inspect::smp) fn parse_save_company_available_track_laying_capacity(
    bytes: &[u8],
    record_offset: usize,
) -> Option<Option<u32>> {
    let raw = read_i32_at(
        bytes,
        record_offset + SAVE_COMPANY_RECORD_TRACK_LAYING_CAPACITY_OFFSET,
    )?;
    if raw < 0 {
        Some(None)
    } else {
        Some(Some(raw as u32))
    }
}
