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>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-23 18:08:54 +02:00
1 parent badd08f05e
commit f2fcb28f65
81 files changed
+29351 -91

No files matched your search

+118
View File
@@ -0,0 +1,118 @@
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
#include "game/weekly.hpp"
// OpenBMH deviates from the original: uses the supported weekly processing and transfer rule profile.
// The weekly processing (DayStepRest3, BMH.exe V2.24 + supported rule profile patch).
//
// DayStepRest runs it on the day after a training day when that day has weekday code 3
// (in games with the full economy, CompetitionSelection bit 0). In order:
// 1. per human manager: offers and incidents (Bool), the ageing of the club's
// facilities (FacilityDamage) and random damage to them (SeasonTicketCompensation), each followed
// by the season ticket compensation (Void3); every third week new advertising
// offers (TransferListCountdown2)
// 2. the transfer list (TransferListCountdown(0)): the days left of every listed player count
// down; at 0 the highest-rated eligible bid wins unless a human-seller selector is set
// 3. new bids for listed players (TransferBid)
// 4. every player in a squad: injuries in training, players out (w35c bits 27-31) come
// back or retire
// 5. per human manager: debts, the training camp bill, player bonuses, the weekly
// statistics (FacilityRating)
// Messages to the managers (PostMessage / SystemIdentity) are not produced; dialogs that
// wait for a decision of the player are reported as unsupported.
#include "game/match_engine.hpp"
#include "game/random.hpp"
#include "modern/game/modern_state.hpp"
#include "game/transfer_allocator.hpp"
#include "game/human_buyer_sale.hpp"
#include "game/pending_offer.hpp"
#include "game/transfer_bid.hpp"
#include "game/transfer_offer_view.hpp"
#include <array>
#include <cstdint>
#include <functional>
namespace bmh::modern {
// Projects the current live rows without mutation or RNG. The selector caller
// performs the Source-ranked selection and ProjectTransferOfferList post-selection check.
TransferOfferListView project_transfer_offer_list(const ModernState& g, int list_entry);
void weekly_processing(ModernState& g, GameRandom& game, WatcomRandom& rand, MinuteReport& report,
TransferAllocatorContext allocator = TransferAllocatorContext::unsupported);
// The single steps, public for tests.
void manager_offers(ModernState& g, int manager, WatcomRandom& rand, MinuteReport& report); // Bool
void facility_ageing(ModernState& g, int manager, GameRandom& game, WatcomRandom& rand, MinuteReport& report); // FacilityDamage
void facility_damage(ModernState& g, int manager, GameRandom& game, WatcomRandom& rand); // SeasonTicketCompensation
void season_ticket_compensation(ModernState& g, int manager); // Void3
// Source-visible compensation path: the notice receives the state after the
// usable-capacity calculation, but before the forced/statistical money booking.
void season_ticket_compensation_source(ModernState& g, int manager,
const SeasonTicketCompensationNoticeHook& notice = {});
void advertising_offers(ModernState& g, int manager, WatcomRandom& rand, MinuteReport& report); // TransferListCountdown2
// TransferListCountdown(all): the days left of every listed player count down; at 0 the best bid wins
// (with `all`, at the season end, every list is settled at once)
void transfer_list_countdown(ModernState& g, GameRandom& game, WatcomRandom& rand, MinuteReport& report, bool all = false,
TransferAllocatorContext allocator = TransferAllocatorContext::unsupported);
// TransferBid(slot, list entry, 0, -1): a new bid of some club for the player in the
// absolute squad slot (a listed player), or with list_entry 0 a move of the player to a
// club that wants him.
void transfer_bid(ModernState& g, int slot, uint32_t list_entry, bool high, int months, GameRandom& game,
WatcomRandom& rand, MinuteReport& report);
void weekly_statistics(ModernState& g, int manager); // FacilityRating
// FacilityRating2(manager, with_rand, &second): rating of a human club's stadium facilities
// (about 24-100). *second receives the covered share of the stands in percent. With `rand`
// (the attendance calculation) every stand under construction costs 10-12 % of the
// facility sum, drawn per stand.
int facility_rating(ModernState& g, int manager, int* second, WatcomRandom* rand = nullptr);
// Squad helpers shared with the month change (month.cpp):
// Nationality: nationality of a player (w368 bits 27-31, +32 with the flag in *PlayerBonuses).
int nationality(const ModernState& g, int player);
// SquadCount(team, flags): players of a club (bit 1: the injured too; bit 0: plus the
// players bought for later, table Career_RemoveJoinLoans_RuntimeField).
int squad_count(const ModernState& g, int team, int flags);
// SlotTeam: club of an absolute squad slot, -1 for the transfer pool.
int slot_team(int slot);
// Int2(team, 100) after a transfer (only clubs with a squad).
void lineup_after_transfer(ModernState& g, int team);
// ReleasePlayer(seller, player): the player leaves the club (0xFFF: the pool).
bool remove_from_seller(ModernState& g, int seller, int player, MinuteReport& report);
// Finalize a high-confidence manager offer immediately after the seller/player accepts it.
bool accept_transfer_bid_immediately(ModernState& g, int list_entry, int bid, WatcomRandom& rand,
MinuteReport& report,
TransferAllocatorContext allocator = TransferAllocatorContext::unsupported);
} // namespace bmh::modern
namespace bmh::modern {
// PreMatchOffer, before a human manager's matchday: now and then a club makes an offer for
// one of his players (1 in 71 - manager rating / 50).
// Returns whether an offer was shown (its message box waits for a click before the desk).
bool pre_match_offer(ModernState& g, int manager, GameRandom& game, WatcomRandom& rand, MinuteReport& report);
// ClubAttraction(team, 0): how attractive a club is for advertisers (0-100): its European
// campaign, its league and table position (weekly.cpp).
int club_attraction(const ModernState& g, int team);
// Modern versions of functions that transfer_bid.hpp, human_buyer_sale.hpp and
// pending_offer.hpp declare for Classic; all are implemented in weekly.cpp.
TransferBidRating rate_transfer_bid_source(ModernState&, const TransferBidRatingRequest&,
WatcomRandom&, MinuteReport&);
HumanBuyerSaleResult settle_human_buyer_sale(ModernState&, const HumanBuyerSaleRequest&,
const HumanBuyerSaleHooks&, WatcomRandom&, MinuteReport&);
PendingOfferResult process_player_card_pending_offers(ModernState& g,
const ClubPlayerDetailSelection& selection, GameRandom& game, WatcomRandom& rand,
const PendingOfferHooks& hooks, MinuteReport& report);
PendingOfferResult process_natural_pending_offers_after_desk(ModernState& g,
const PendingOfferDeskRequest& request, GameRandom& game, WatcomRandom& rand,
const PendingOfferHooks& hooks, MinuteReport& report);
PendingOfferResult process_national_nomination_pending_after_desk(ModernState& g,
const PendingOfferDeskRequest& request, GameRandom& game, WatcomRandom& rand,
const PendingOfferHooks& hooks, MinuteReport& report);
} // namespace bmh::modern