Files
Dreierpack-Manager/src/modern/game/bank_credit.hpp
T
ClaudeandClaude Opus 5.5 f2fcb28f65 Fork the Classic season core into src/modern and add the world layout (M1)
- src/modern/game: the season modules as bmh::modern, working on ModernState
  (a GameState). Data types stay shared with Classic; Modern code calls its
  season functions qualified (modern::...), so a missing Modern function is a
  compile error instead of a silent call into Classic.
- src/modern/app/modern_session: the session on the Modern core. It still uses
  the Classic UI projections until the Modern projections exist.
- SeasonHooks: the shared match core reaches player statistics and the table
  prediction of the season core that owns the game (Classic: unchanged).
- WorldLayout: team ranges, squad slots and pools of the running world. Shared
  code and the Modern fork read them; Classic keeps the original numbers.
- Transfer list views moved to game/transfer_offer_view.hpp (shared).
- tools/modern/check_fork_calls.sh, modern_season_sim and world_layout_tests.

Verified: Classic tests and replay regression unchanged; season_sim and
modern_season_sim produce identical output with Classic data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 18:08:54 +02:00

40 lines
1.8 KiB
C++

// SPDX-License-Identifier: GPL-3.0-only
#pragma once
#include "game/bank_credit.hpp"
#include <array>
#include <cstdint>
#include <vector>
#include "formats/le.hpp"
#include "modern/game/modern_state.hpp"
namespace bmh::modern {
// MaxSharesToBuy case 4 (the bank) and case 5 (another manager lends). Row c of
// each manager's native 0x78-byte loan matrix (Loans + borrower * 0x78 + c * 0x18)
// is the credit from the bank (c = 0) or from manager c - 1, and contains principal,
// total, monthly payment, term, elapsed months and payments made. Case 5 differs only
// in: the principal is limited by the lender's balance plus credit line, the monthly
// payment (field 2) can be set within 20 % of the annuity, there are no fees and no
// fee question, and every booking is mirrored on the lender. The original asks the
// lender nothing. Projection and draft editing are read-only.
BankCreditContext bank_credit_context(const ModernState&, const LeImage&, int manager, int counterparty = 0);
// ChangeBankCreditInterest: apply the automatic interest change to the bank loan record.
bool change_bank_credit_interest(ModernState&, int manager, uint8_t new_rate);
BankCreditDraft bank_credit_draft(const BankCreditContext&);
BankCreditBounds bank_credit_bounds(const BankCreditContext&, const BankCreditDraft&, int field);
bool edit_bank_credit(const BankCreditContext&, BankCreditDraft&, int field, uint32_t value);
// Replay the local Source edits against the current native record before
// booking; fees and refund are derived here, never trusted from a UI amount.
BankCreditResult commit_bank_credit(ModernState&, const LeImage&, int manager,
const std::array<uint32_t, 6>& expected, const std::vector<BankCreditEdit>& edits,
bool accept_fees, int counterparty = 0);
} // namespace bmh::modern