Keep final tables and competition winners in the almanac

At the start of the season transition, before promotion moves the
clubs, the almanac stores the final table of every league (rank, games,
wins, draws, defeats, goals, points) and each league's champion and
runner-up. Every decided cup (national cup, European cups, supercup,
play-off, national tournaments, each indoor tournament and the Masters)
is noted with its date, last stage and runner-up. Almanac format
version 2; version 1 seasons are still read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-24 09:01:52 +02:00
1 parent d42c855843
commit 7c08e39607
7 files changed
+165 -3

No files matched your search

+6
View File
@@ -605,6 +605,11 @@ void advance_cup(ModernState& g, int id, WatcomRandom& rand, MinuteReport& repor
if (!losers.empty()) mem.set16(e + 0x24, losers[0]);
}
if (type == 0xc) remove_competition(mem, 0xc);
// The almanac notes every decided competition (not the replay and friendly
// containers 9 and 10): the runner-up is the final's loser or the group's second.
if (type != 9 && type != 10 && !winners.empty())
modern::almanac_cup_winner(g, type, entry, winners[0],
winners.size() > 1 ? winners[1] : losers.empty() ? -1 : losers[0]);
// CupRuntimeField5: the title of the competition (0xFF: none)
static constexpr uint8_t kTitle[14] = {1, 2, 3, 4, 5, 0xff, 6, 0xff, 8, 0xff, 0xff, 0xff, 0xff, 0xff};
const uint8_t title = type >= 0 && type < 14 ? kTitle[type] : 0xff;
@@ -656,6 +661,7 @@ void advance_cup(ModernState& g, int id, WatcomRandom& rand, MinuteReport& repor
winner_display(g, {7, winner});
if (mem.u8(::bmh::layout::Cup_AdvanceCup_RuntimeField) == 0 && mem.has(::bmh::layout::CareerSession_BeginFriendlyOpponentTable_ExecutableField2)) mem.set8(::bmh::layout::CareerSession_BeginFriendlyOpponentTable_ExecutableField2, 0);
mem.set16(::bmh::layout::Titles + 7 * 100 + uint32_t(std::min<int>(g.season, 0x31)) * 2, winner);
modern::almanac_cup_winner(g, 0xb, entry, winner, -1, true); // the Masters (almanac)
if (mem.has(::bmh::layout::Cup_AdvanceCup_RuntimeField7)) mem.set16(::bmh::layout::Cup_AdvanceCup_RuntimeField7, winner);
const int manager = g.manager_of(winner);
if (manager >= 0) {