Files
Dreierpack-Manager/src/modern/game/national.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

66 lines
4.3 KiB
C++

// SPDX-License-Identifier: GPL-3.0-only
#pragma once
#include "game/national.hpp"
// The national team (BMH.exe V2.24 + supported rule profile patch), team id 0x165 (no_team()), squad slots
// 0xc00-0xc17 (LargeSquadClubCount).
//
// With the world game on (CompetitionSelection bit 1) the calendar holds national team days (entry
// 0x4006, DayCompetitions -> national-only flag). On such a day AdvanceTurn calls NationalTeamDay, which
// nominates the squad: the manager slots are swapped so that slot 0 is a spare one
// (SwapManagerSlots(4, 0); a Bundestrainer instead takes slot 0 over with the national team,
// SwapManagerSlots2), the 3 goalkeepers, 5 defenders, 7 midfielders and 5 forwards
// (NationalRuntimeField) of the highest strength among the available German players of all clubs
// join the national squad with a fresh tactics board entry (PendingOfferAnswer), the national team
// gets its line-up (Int2(0x165, 0xe4)) and the slots are swapped back. Without a
// Bundestrainer the day then prepares an empty matchday (no desk, no match).
#include "game/random.hpp"
#include "modern/game/modern_state.hpp"
namespace bmh::modern {
// SwapManagerSlots(a, b): manager slots a and b change places - the manager records (0xb0c
// bytes), the tactics boards (0x840) and the desktop layouts (block Desktops, 0x360).
void swap_manager_slots(ModernState& g, int a, int b);
// PendingOfferAnswer(manager, from_slot, -1, squad_start): the player of the absolute squad slot
// `from_slot` gets the first free slot of the squad starting at `squad_start` (24 slots;
// the slot value is copied with its flags) and a fresh entry on the tactics board of
// manager slot `manager`: neutral settings, familiarity W(40, 60), the four attribute
// bytes W(2, 39) each (1 for the first two places) and the salary of a 2-year contract
// at W(95, 105) percent (AddToSquad). Returns the new absolute slot, -1 if the squad is full.
int add_to_squad(ModernState& g, int manager, int from_slot, int squad_start, WatcomRandom& rand);
// The board part of PendingOfferAnswer (also called with a given place `index`): the entry of
// the player in absolute squad slot `slot` on the tactics board of `manager`.
void new_board_entry(ModernState& g, int manager, int index, int slot, WatcomRandom& rand);
// NationalTeamDay: the national team day (see above). Returns whether a Bundestrainer manages
// the national team (CoachActive) - then his desk follows (AdvanceTurn: local_28 = 4).
bool national_team_day(ModernState& g, WatcomRandom& rand, MinuteReport& report);
// The Bundestrainer (national coach), see national.cpp. SwapManagerSlots2: notes the number of
// managers (OriginalManagerCount) and `active_manager` (ClubPlayerDetail_InvalidArgument_RuntimeField3 = ActiveManager); a manager
// flagged in his record (+0x21c), every manager in the world game without leagues
// (CompetitionSelection == 2) and the only manager of a one-manager game takes the national team over:
// the national team's record (slot 4) gets his name and portrait, the number of managers
// becomes 1, slots 4 and 0 change places, slot 0 manages team 0x165 and copies +0x218 from
// slot 4, the national team gets its line-up (Int2(0x165, 0xe4)) and
// CoachActive = 1.
// `source_season_day` is the 16-bit value visible in DaysIntoSeason at this exact Source call
// site. It is not always `g.season_day()`: DailyInterest advances the counter before
// quiet-day rest but after rest on the completed-event path.
void national_coach_take_over(ModernState& g, int active_manager, uint16_t source_season_day);
// NationalCoachHandBack: with CoachActive set the slots change places again, the number of managers
// is restored from OriginalManagerCount and CoachActive cleared.
void national_coach_hand_back(ModernState& g);
// CupDraw_FormatError_RuntimeField2 == 0x165: slot 0 manages the national team.
bool national_coach_active(const ModernState& g);
// NationalCoachAfterLoad (saving and loading): the savegame holds the slots swapped back with
// CoachActive still 1; afterwards (and so after loading) SwapManagerSlots2 takes over again.
void national_coach_after_load(ModernState& g);
// The state as NationalCoachAfterLoad writes it (for the savegame writer and comparisons).
ModernState national_coach_save_form(const ModernState& g);
} // namespace bmh::modern