Rehost company credit rating reader

This commit is contained in:
Jan Petykiewicz 2026-04-17 23:26:59 -07:00
commit 3306763bad
4 changed files with 438 additions and 19 deletions

View file

@ -16439,6 +16439,14 @@ mod tests {
u8::from(city_connection_latch);
bytes[record_offset + SAVE_COMPANY_RECORD_LINKED_TRANSIT_LATCH_OFFSET] =
u8::from(linked_transit_latch);
let current_cash: f64 = if index == 0 { 125_000.0 } else { -25_000.0 };
let current_cash_slot_offset = record_offset
+ SAVE_COMPANY_RECORD_STAT_BAND_ROOT_0D7F_OFFSET
+ (crate::RUNTIME_COMPANY_STAT_SLOT_CURRENT_CASH as usize
* crate::RUNTIME_COMPANY_YEAR_STAT_FAMILY_SPAN as usize
* 8);
bytes[current_cash_slot_offset..current_cash_slot_offset + 8]
.copy_from_slice(&current_cash.to_bits().to_le_bytes());
}
let header_probe = parse_save_company_collection_header_probe(
@ -16484,6 +16492,7 @@ mod tests {
assert_eq!(roster.selected_company_id, Some(2));
assert_eq!(roster.entries.len(), 2);
assert_eq!(roster.entries[0].company_id, 1);
assert_eq!(roster.entries[0].current_cash, 125_000);
assert_eq!(roster.entries[0].linked_chairman_profile_id, Some(1));
assert_eq!(roster.entries[0].debt, 1_550_000);
assert_eq!(roster.entries[0].available_track_laying_capacity, Some(603));
@ -16546,6 +16555,7 @@ mod tests {
"0xd77"
);
assert_eq!(roster.entries[1].company_id, 2);
assert_eq!(roster.entries[1].current_cash, -25_000);
assert_eq!(roster.entries[1].linked_chairman_profile_id, Some(2));
assert_eq!(roster.entries[1].debt, 500_000);
assert_eq!(roster.entries[1].available_track_laying_capacity, None);