Modern press journal: monthly results

At the first kickoff of a new month each club manager's cash change over
the month just ended becomes finance.profit or finance.loss. The month
and the cash at its start are saved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-27 18:46:54 +01:00
1 parent d6d31f939d
commit 706577d002
5 files changed
+43 -1

No files matched your search

+1 -1
View File
@@ -35,7 +35,7 @@ Revision kommt vom Aufrufer (Konsole bzw. AppController), der Read ändert nicht
| `advertising` | 14 Banden (`ad:board/<n>`), Trikot (`ad:shirt`), TV-Rechte (`ad:tv`) je mit Vertrag (Sponsor, Monatsbetrag, Restmonate, Verlängerung, Option) und den offenen Angeboten (`offer:ad-<Platz>-<Nr.>`, Sponsor, Betrag, Banden, Monate, `allowed`); die drei Budgets (Merchandising, Presse, Fanarbeit) mit Stand, Höchstbetrag, Lieferwochen; die Finanzvorschau des Originals |
| `stadium` | Umfeld (14 Objekte mit Namen und Bautagen; Verkehrsanbindung mit `stage` und `maxStage`: Classic 3, Modern-Welt 4; sonst `built`), die acht Anlagen (Stufe, Höchststufe, Bauwochen, ob ausbaubar), die acht Tribünenblöcke (Plätze, Höchstplätze, Sitzplätze, Dach, Bauwochen, Plätze nach dem Bau), Eintrittspreis (8–25 €); das offene Angebot des Stadion-Dialogs (`quote`: Umfeld mit Preis, oder Anlage mit Zielstufe, Preis, Bauwochen und dem Trinkgeld-Bereich 6–14 %) |
| `transfer` | die Transferliste (`listing:<n>`: Spieler, Alter, Position, Stärke, Verkäufer, Ablöseforderung, Gehaltsreferenz pro Jahr, Gehaltsforderung in %, Zahl der Angebote, eigene Listung, eigenes Gebot), der eigene Kader (gelistet oder nicht), Kontostand, Kreditrahmen |
| `news` | Presseereignisse eines Teams (`teamId`, Vorgabe das Team am Schreibtisch), `from`/`until` (ISO, Vorgabe bis heute), `limit` (Vorgabe 50, die neuesten): `events` je `{id, type, date, scope, data, variant: null}` nach [Pressevertrag](../new_ui/integration/PRESS.md), `total`. Quelle ist der Almanach, darum gleich bei jedem Lesen und mit stabiler ID (`press-event:<Typ>:<Vorkommnis>:<Team>`). Typen: `match.result`, `cup.round_result`, `cup.final_result`, `cup.extra_time`, `cup.penalties`, `player.sent_off`, `player.injury`, `run.wins` (3/5/8/10/15), `run.unbeaten` (5/10/15/20/30), `run.winless` (5/8/10/15), `run.losses` (3/5/8/10), `league.position`, `league.champion`, `cup.won`, `indoor.won`. Fakten: `team`, `opponent`, `competition` (mit `kind`, `season`), `matchId`, `score {for, against}` aus Sicht des Teams, `venue`, `trailed`, `minute` (das entscheidende Tor), `outcome`, `round`, `shootout`, `player`, `matches`, `position`, `points`. Dazu Geschäftsereignisse aus dem Pressejournal im Spielstand (`state/modern.json`, `press`): beim Anstoß aus dem Kadervergleich der menschlichen Vereine `transfer.signed` (`fromClub`), `transfer.free`, `transfer.sold` (`toClub`; auch ein freigegebener Spieler, der im selben Anstoß woanders unterschreibt), `contract.ended`; `toto.win`/`toto.loss` (`amount`); `career.season_finished`/`career.season_started`; beim Saisonwechsel `league.promoted`/`league.relegated` (`competition` die neue, `from` die alte Liga); aus bestätigten Befehlen `contract.extended` (`years`, `wage`), `advertising.signed` (`company`, `amount` monatlich, `months`, `place` boards/shirt/tv), `finance.loan_approved`/`finance.loan_repaid` (`amount`, `bank`), `stadium.expansion_planned` (`block`, `seats` Ziel insgesamt) und `career.manager_resigned`. Ablösen kennt der Kadervergleich nicht (`fee: null`). Ohne Welt-IDs (Classic-Daten) heißt ein Verein `team:<Laufzeitnummer>`, die sich zum Saisonstart ändern kann. Noch nicht: Derby, Monatsbilanz (`finance.profit`/`finance.loss`), fertiger Stadionausbau, Aktien |
| `news` | Presseereignisse eines Teams (`teamId`, Vorgabe das Team am Schreibtisch), `from`/`until` (ISO, Vorgabe bis heute), `limit` (Vorgabe 50, die neuesten): `events` je `{id, type, date, scope, data, variant: null}` nach [Pressevertrag](../new_ui/integration/PRESS.md), `total`. Quelle ist der Almanach, darum gleich bei jedem Lesen und mit stabiler ID (`press-event:<Typ>:<Vorkommnis>:<Team>`). Typen: `match.result`, `cup.round_result`, `cup.final_result`, `cup.extra_time`, `cup.penalties`, `player.sent_off`, `player.injury`, `run.wins` (3/5/8/10/15), `run.unbeaten` (5/10/15/20/30), `run.winless` (5/8/10/15), `run.losses` (3/5/8/10), `league.position`, `league.champion`, `cup.won`, `indoor.won`. Fakten: `team`, `opponent`, `competition` (mit `kind`, `season`), `matchId`, `score {for, against}` aus Sicht des Teams, `venue`, `trailed`, `minute` (das entscheidende Tor), `outcome`, `round`, `shootout`, `player`, `matches`, `position`, `points`. Dazu Geschäftsereignisse aus dem Pressejournal im Spielstand (`state/modern.json`, `press`): beim Anstoß aus dem Kadervergleich der menschlichen Vereine `transfer.signed` (`fromClub`), `transfer.free`, `transfer.sold` (`toClub`; auch ein freigegebener Spieler, der im selben Anstoß woanders unterschreibt), `contract.ended`; `toto.win`/`toto.loss` (`amount`); `career.season_finished`/`career.season_started`; beim Saisonwechsel `league.promoted`/`league.relegated` (`competition` die neue, `from` die alte Liga); aus bestätigten Befehlen `contract.extended` (`years`, `wage`), `advertising.signed` (`company`, `amount` monatlich, `months`, `place` boards/shirt/tv), `finance.loan_approved`/`finance.loan_repaid` (`amount`, `bank`), `stadium.expansion_planned` (`block`, `seats` Ziel insgesamt) und `career.manager_resigned`. Ablösen kennt der Kadervergleich nicht (`fee: null`). Ohne Welt-IDs (Classic-Daten) heißt ein Verein `team:<Laufzeitnummer>`, die sich zum Saisonstart ändern kann. Monatlich `finance.profit`/`finance.loss` (`amount` die Veränderung des Kontostands im abgelaufenen Monat, alles Gebuchte eingeschlossen, `month` als JJJJ-MM; vermerkt beim ersten Anstoß im neuen Monat). Noch nicht: Derby, fertiger Stadionausbau, Aktien |
| `calendar` | der Saisonkalender des Teams am Schreibtisch, `from`/`until` (ISO, Vorgabe der laufende Monat): `days` (Datum, `seasonDay`, `today`, `eventKinds`: `league`, `cup:<n>`, `replay`, `indoor`, `special`, `national`, `friendly`; `fixtureIds`) und `fixtures` (die eigenen Ligaspiele: `fixture:league-<Liga>-<Runde>-<Nr.>`, Wettbewerb, Runde, `originalDate`, `scheduledDate`, Heim/Gast, `status` `scheduled`/`played`/`rescheduled`/`postponed`, `result`). Verlegte und im Winter ausgefallene Spiele stehen am Nachholtag. Pokalspiele nur als `eventKinds`; Fehler `invalid_range` |
| `scheduling` | die verlegbaren eigenen Ligaspiele (`move:<Tag>-<Liga>-<Runde>-<Nr.>`, Datum, Runde, Heim/Gast, mögliche Zieldaten) und die verlegten, die sich zurücknehmen lassen |
| `friendly` | mit `opponentId`, optional `home`: das Angebot für ein Freundschaftsspiel (Heim/Gast, Kosten, Zahler, ob der Gegner einen menschlichen Manager hat) und die freien Daten der Saison; kein Zufall. Am Schreibtisch des Bundestrainers ein Länderspiel (`national: true`, Gegner ein anderes Nationalteam, dazu `ratings` beider Teams): das Original zieht für die Bewertung Zufall; der Read rechnet auf einer Kopie des Generators, die Buchung zieht dieselben Zahlen |
+31
View File
@@ -138,6 +138,37 @@ void journal_advance(ModernState& g, const ModernState& before) {
note_press(g, "transfer.sold", id, O{{"team", me}, {"player", press_player(g, p)}, {"toClub", team_entity(next->second)}, {"fee", nullptr}});
}
}
// the month's result of each club manager: the change of his cash over the month just ended
// (everything booked: income, wages, transfers, loans), noted when the kickoff enters a new month
{
const AlmanacDate today = almanac_date(g.date, g.display_start_year);
const uint32_t month = uint32_t(today.year * 12 + today.month - 1);
const auto cash = [&](size_t m) -> int64_t {
// while coaching the national team the club's record waits in slot 4
size_t slot = m;
if (m == 0 && g.manager_teams.size() > 0 && g.manager_teams[0] == no_team() &&
g.memory.has(::bmh::layout::CoachActive) && g.memory.u8(::bmh::layout::CoachActive) != 0) slot = 4;
const size_t at = slot * 0xb0c + 0x314;
if (at + 3 >= g.manager_records.size()) return 0;
return int32_t(uint32_t(g.manager_records[at]) | uint32_t(g.manager_records[at + 1]) << 8 |
uint32_t(g.manager_records[at + 2]) << 16 | uint32_t(g.manager_records[at + 3]) << 24);
};
if (g.press_month != 0 && month != g.press_month)
for (size_t m = 0; m < g.manager_teams.size() && m < g.press_month_cash.size(); ++m) {
const int team = club_of_manager(g, m);
if (team < 0) continue;
const int64_t change = cash(m) - g.press_month_cash[m];
char label[16];
std::snprintf(label, sizeof label, "%04u-%02u", g.press_month / 12, g.press_month % 12 + 1);
note_press(g, change >= 0 ? "finance.profit" : "finance.loss", ui_team_id(g, team),
O{{"team", press_team(g, team)}, {"amount", ui_money(change >= 0 ? change : -change)}, {"month", label}});
}
if (month != g.press_month) {
g.press_month = month;
g.press_month_cash.clear();
for (size_t m = 0; m < g.manager_teams.size(); ++m) g.press_month_cash.push_back(cash(m));
}
}
// a new toto settlement of a club manager
for (size_t m = 0; m < g.pools.size() && m < before.pools.size() && m < g.manager_teams.size(); ++m) {
const auto& a = before.pools[m];
+6
View File
@@ -156,6 +156,8 @@ void save_world_career(const std::filesystem::path& path, const World& world, co
{"traffic_scale", int64_t(state.traffic_scale)},
{"press", press_json(state.press)},
{"press_serial", int64_t(state.press_serial)},
{"press_month", int64_t(state.press_month)},
{"press_month_cash", [&] { A a; for (int64_t v : state.press_month_cash) a.push_back(v); return J(std::move(a)); }()},
{"career_end_reason", state.career_end_reason},
{"career_end_date", int64_t(state.career_end_date)}});
// The almanac: finished seasons unchanged, the running one encoded now.
@@ -217,6 +219,10 @@ SavedWorldCareer load_world_career(const std::filesystem::path& path, const Worl
out.state.press = press_json(get(modern, "press"));
out.state.press_serial = uint32_t(num(get(modern, "press_serial")));
}
if (o->count("press_month")) {
out.state.press_month = uint32_t(num(get(modern, "press_month")));
for (const J& v : arr(get(modern, "press_month_cash"))) out.state.press_month_cash.push_back(int64_t(num(v)));
}
if (o->count("career_end_reason")) {
out.state.career_end_reason = str(get(modern, "career_end_reason"));
out.state.career_end_date = uint32_t(num(get(modern, "career_end_date")));
+4
View File
@@ -93,6 +93,10 @@ struct ModernState : GameState {
};
std::vector<PressEntry> press;
uint32_t press_serial = 0;
// The monthly result for the press: the month (year * 12 + month - 1, 0 = not yet started) and
// each manager's cash at its start; the change over a month is finance.profit / finance.loss.
uint32_t press_month = 0;
std::vector<int64_t> press_month_cash;
// How and when the career ended ("" while it runs; "career_completed" when the set duration ran
// out, "last_human_resigned" when the only or last human manager gave up): the interface's
// terminationReason and the end of the employments.
+1
View File
@@ -731,6 +731,7 @@ int main(int argc, char** argv) {
return false;
};
check(noted("advertising.signed") && noted("finance.loan_approved"), "journal: advertising and credit noted");
check(noted("finance.profit") || noted("finance.loss"), "journal: the months' results");
}
// the journal: the new season (noted at the kickoff that changed it)
check(types["career.season_started"] > 0, "business events from the journal");