Expose company periodic side-latch trio

This commit is contained in:
Jan Petykiewicz 2026-04-18 07:13:49 -07:00
commit 05e5ade1d8
6 changed files with 49 additions and 2 deletions

View file

@ -138,6 +138,9 @@ year and halve live bond principals in place instead of treating bankruptcy as a
The same save-native live bond-slot surface now also carries per-slot maturity years all the way
through runtime summaries and annual bond policy state, which is the next owner seam needed for
shellless repayment and bond-burden simulation instead of another round of raw-slot guessing.
The same save-native company direct-record seam now also carries the full outer periodic-company
side-latch trio rooted at `0x0d17/0x0d18/0x0d56`, including the preferred-locomotive engine-type
chooser byte that sits beside the city-connection and linked-transit finance gates.
That same seam now also derives the current live coupon burden directly from owned bond slots, so
later finance service work can consume a runtime reader instead of recomputing from scattered raw
fields.

View file

@ -5300,6 +5300,7 @@ mod tests {
management_attitude: 58,
takeover_cooldown_year: Some(1839),
merger_cooldown_year: Some(1838),
preferred_locomotive_engine_type_raw_u8: Some(2),
market_state: Some(crate::RuntimeCompanyMarketState {
outstanding_shares: 20_000,
bond_count: 2,
@ -5359,6 +5360,7 @@ mod tests {
management_attitude: 31,
takeover_cooldown_year: None,
merger_cooldown_year: None,
preferred_locomotive_engine_type_raw_u8: Some(0),
market_state: Some(crate::RuntimeCompanyMarketState {
outstanding_shares: 18_000,
bond_count: 1,

View file

@ -2352,6 +2352,8 @@ pub struct SmpLoadedCompanyRosterEntry {
#[serde(default)]
pub merger_cooldown_year: Option<u32>,
#[serde(default)]
pub preferred_locomotive_engine_type_raw_u8: Option<u8>,
#[serde(default)]
pub market_state: Option<RuntimeCompanyMarketState>,
}
@ -2465,6 +2467,8 @@ pub struct SmpSaveCompanyRecordAnalysisEntry {
pub founding_year: u32,
pub last_bankruptcy_year: u32,
pub last_dividend_year: u32,
pub preferred_locomotive_engine_type_raw_u8: u8,
pub preferred_locomotive_engine_type_raw_hex: String,
pub city_connection_latch: bool,
pub linked_transit_latch: bool,
pub merger_cooldown_year: u32,
@ -3183,6 +3187,10 @@ pub fn inspect_save_company_and_chairman_analysis_bytes(
&bytes,
record_offset + SAVE_COMPANY_RECORD_LAST_DIVIDEND_YEAR_OFFSET,
)?;
let preferred_locomotive_engine_type_raw_u8 = read_u8_at(
&bytes,
record_offset + SAVE_COMPANY_RECORD_PREFERRED_LOCOMOTIVE_ENGINE_TYPE_OFFSET,
)?;
let city_connection_latch = read_u8_at(
&bytes,
record_offset + SAVE_COMPANY_RECORD_CITY_CONNECTION_LATCH_OFFSET,
@ -3254,6 +3262,10 @@ pub fn inspect_save_company_and_chairman_analysis_bytes(
founding_year,
last_bankruptcy_year,
last_dividend_year,
preferred_locomotive_engine_type_raw_u8,
preferred_locomotive_engine_type_raw_hex: format!(
"0x{preferred_locomotive_engine_type_raw_u8:02x}"
),
city_connection_latch,
linked_transit_latch,
merger_cooldown_year,
@ -3724,6 +3736,7 @@ const SAVE_COMPANY_RECORD_PRIOR_ISSUE_CALENDAR_OFFSET: usize = 0x173;
const SAVE_COMPANY_RECORD_PRIOR_ISSUE_CALENDAR_OFFSET_2: usize = 0x177;
const SAVE_COMPANY_RECORD_TAKEOVER_COOLDOWN_OFFSET: usize = 0x289;
const SAVE_COMPANY_RECORD_LAST_DIVIDEND_YEAR_OFFSET: usize = 0x0d2d;
const SAVE_COMPANY_RECORD_PREFERRED_LOCOMOTIVE_ENGINE_TYPE_OFFSET: usize = 0x0d17;
const SAVE_COMPANY_RECORD_CITY_CONNECTION_LATCH_OFFSET: usize = 0x0d18;
const SAVE_COMPANY_RECORD_SUPPORT_PROGRESS_OFFSET: usize = 0x0d07;
const SAVE_COMPANY_RECORD_CHAIRMAN_SALARY_CURRENT_OFFSET: usize = 0x0d59;
@ -3920,6 +3933,10 @@ fn parse_save_company_roster_probe(
bytes,
record_offset + SAVE_COMPANY_RECORD_PRIOR_ISSUE_CALENDAR_OFFSET_2,
)?;
let preferred_locomotive_engine_type_raw_u8 = read_u8_at(
bytes,
record_offset + SAVE_COMPANY_RECORD_PREFERRED_LOCOMOTIVE_ENGINE_TYPE_OFFSET,
)?;
let city_connection_latch = read_u8_at(
bytes,
record_offset + SAVE_COMPANY_RECORD_CITY_CONNECTION_LATCH_OFFSET,
@ -4007,6 +4024,7 @@ fn parse_save_company_roster_probe(
management_attitude: 0,
takeover_cooldown_year,
merger_cooldown_year,
preferred_locomotive_engine_type_raw_u8: Some(preferred_locomotive_engine_type_raw_u8),
market_state: Some(RuntimeCompanyMarketState {
outstanding_shares,
bond_count,
@ -16534,6 +16552,7 @@ mod tests {
current_issue_calendar_word_2,
prior_issue_calendar_word,
prior_issue_calendar_word_2,
preferred_locomotive_engine_type_raw_u8,
city_connection_latch,
linked_transit_latch,
),
@ -16562,6 +16581,7 @@ mod tests {
8u32,
6u32,
7u32,
2u8,
true,
false,
),
@ -16589,6 +16609,7 @@ mod tests {
4u32,
2u32,
3u32,
1u8,
false,
true,
),
@ -16683,6 +16704,8 @@ mod tests {
bytes[record_offset + SAVE_COMPANY_RECORD_PRIOR_ISSUE_CALENDAR_OFFSET_2
..record_offset + SAVE_COMPANY_RECORD_PRIOR_ISSUE_CALENDAR_OFFSET_2 + 4]
.copy_from_slice(&prior_issue_calendar_word_2.to_le_bytes());
bytes[record_offset + SAVE_COMPANY_RECORD_PREFERRED_LOCOMOTIVE_ENGINE_TYPE_OFFSET] =
preferred_locomotive_engine_type_raw_u8;
bytes[record_offset + SAVE_COMPANY_RECORD_CITY_CONNECTION_LATCH_OFFSET] =
u8::from(city_connection_latch);
bytes[record_offset + SAVE_COMPANY_RECORD_LINKED_TRANSIT_LATCH_OFFSET] =
@ -16781,6 +16804,10 @@ mod tests {
assert_eq!(market_state.current_issue_calendar_word_2, 8);
assert_eq!(market_state.prior_issue_calendar_word, 6);
assert_eq!(market_state.prior_issue_calendar_word_2, 7);
assert_eq!(
roster.entries[0].preferred_locomotive_engine_type_raw_u8,
Some(2)
);
assert!(market_state.city_connection_latch);
assert!(!market_state.linked_transit_latch);
assert_eq!(
@ -16828,6 +16855,10 @@ mod tests {
assert_eq!(second_market_state.current_issue_calendar_word_2, 4);
assert_eq!(second_market_state.prior_issue_calendar_word, 2);
assert_eq!(second_market_state.prior_issue_calendar_word_2, 3);
assert_eq!(
roster.entries[1].preferred_locomotive_engine_type_raw_u8,
Some(1)
);
assert!(!second_market_state.city_connection_latch);
assert!(second_market_state.linked_transit_latch);
}

View file

@ -181,6 +181,9 @@ The highest-value next passes are now:
`[world+0x65/+0x69/+0x6d]`, the complement trio `[world+0x71/+0x75/+0x79]`, and the scaled
companion trio `[world+0x7d/+0x81/+0x85]` from the bucket scalar instead of preserving stale
save-time residue
- the same save-native company direct-record seam now also carries the full outer periodic-company
side-latch trio rooted at `0x0d17/0x0d18/0x0d56`, including the preferred-locomotive
engine-type chooser byte beside the city-connection and linked-transit finance gates
- the project rule on the remaining closure work is now explicit too: when one runtime-facing field
is still ambiguous, prefer rehosting the owning source state or real reader/setter family first
instead of guessing another derived leaf field from neighboring raw offsets

View file

@ -9,8 +9,10 @@ Working rule:
## Next
- Rehost the next periodic-boundary world seam after the selected-year bucket family, favoring
owner-state rebuilds that can advance shellless simulation without freezing load-time residue.
- Rehost the outer periodic company-service seam around
`company_service_periodic_city_connection_finance_and_linked_transit_lanes`, using the now
save-native side-latch trio `0x0d17/0x0d18/0x0d56` as owned state instead of leaving that pass
split across annual-finance readers and atlas notes.
- Keep widening selected-year world-owner state only when a full owning reader/rebuild family is
grounded strongly enough to avoid one-off leaf guesses.
@ -52,6 +54,9 @@ Working rule:
`[world+0x65/+0x69/+0x6d]`, the complement trio `[world+0x71/+0x75/+0x79]`, and the scaled
companion trio `[world+0x7d/+0x81/+0x85]` from the checked-in `0x00433bd0` artifact instead of
preserving stale save-time residue.
- The save-native company direct-record seam now also carries the full outer periodic-company
side-latch trio rooted at `0x0d17/0x0d18/0x0d56`, including the preferred-locomotive
engine-type chooser byte beside the city-connection and linked-transit finance gates.
- Company cash, confiscation, and major governance effects now write through owner state instead of
drifting from market/cache readers.
- Company credit rating, prime rate, book value per share, investor confidence, and management

View file

@ -258,6 +258,9 @@ The annual dividend-adjustment lane now rides that same seam too: the runtime no
shared year-or-control-transfer metric reader, the board-approved dividend ceiling helper, and the
full annual dividend branch over owned cash, public float, current dividend, and building-growth
policy instead of treating dividend changes as shell-dialog-only logic.
The same save-native company direct-record seam now also carries the full outer periodic-company
side-latch trio rooted at `0x0d17/0x0d18/0x0d56`, including the preferred-locomotive
engine-type chooser byte beside the city-connection and linked-transit finance gates.
That same seam now also carries the fixed-world building-density growth setting plus the linked
chairman personality byte, which is enough to rehost the annual stock-repurchase gate on owned
save/runtime state instead of another threshold-only note. The stock-capital issue branch now