Modern's own rules keep the books and write to the mailbox

Naming rights, marketing, the further properties and the stages now fill
items of the balance sheet (other income, public relations, rents,
periphery, other expenses). The manager gets a note in his mailbox when he
sells the stadium's name, when that contract ends, when a stage is
finished, after the annual general meeting and after a change of club.

The live demo QA driver is marked as not yet ported to the notebook.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Fable 5.2 committed 2026-11-17 19:23:34 +01:00
1 parent dfe8a43440
commit af677a735d
12 files changed
+120 -15

No files matched your search

+2 -1
View File
@@ -56,5 +56,6 @@ Fertigstellung, letzte Stufe, Einnahme nach Liga, Lounge im Bau zählt nicht als
- Die Wirkung der Lounge auf Zuschauer und Preise bleibt die des Originals; die weiteren
Stufen bringen nur die monatliche Einnahme.
- Einnahmen und Baukosten sind einfache Buchungen ohne eigenen Bilanzposten.
- In der Bilanz stehen die Einnahmen unter „Stadionperipherie“, die Baukosten wie beim
übrigen Bauen unter „Sonstiges“ der Ausgaben.
- Sätze nicht in einem Langlauf gemessen.
-1
View File
@@ -135,7 +135,6 @@ Feld `assembly` von `session.advance`.
## Offen
- Schalter für Rauswürfe in den Optionen.
- Nachrichten zum Wechsel und zur Abstimmung im Posteingang.
- Aufgeben bei mehreren Menschen ist weiter nicht unterstützt; der Wechsel braucht es nicht,
weil der Manager seinen Platz behält.
- Wechselt ein Manager an einem Spieltag, spielt der alte Verein die schon angesetzte Partie
+2 -1
View File
@@ -44,5 +44,6 @@ Preisgrenzen über fünfzig Jahre.
- Die Highscore-Wertung zählt die vier Immobilien nicht mit.
- `accounts.investments` des Reads `bank` nennt weiter nur die Anlagen des Originals.
- Miete und Kauf sind einfache Buchungen ohne eigenen Bilanzposten.
- Die Miete steht in der Bilanz unter „Mieten, Zinsen+Tilgung“; Kauf und Verkauf sind wie
bei den übrigen Anlagen keine Bilanzposten.
- Die Sätze sind ein erster Ansatz und nicht in einem Langlauf gemessen.
+2 -3
View File
@@ -59,9 +59,8 @@ und `stadium.namingRights`, Feld `stadiumName` des Live-Reads.
## Offen
- Die Zahlung wird wie eine einfache Buchung geführt und erscheint in der Bilanz unter keinem
eigenen Posten.
- Die Zahlung steht in der Bilanz unter „Sonstiges“ der Einnahmen; einen eigenen Posten gibt
es nicht.
- Auf der leichtesten Stufe bucht das Spiel grundsätzlich kein Geld; dort ändert der Verkauf
nur den Namen.
- Keine Nachricht im Posteingang bei Verkauf und Vertragsende.
- Die Saisonwirkung auf die Wirtschaft ist nicht in einem Langlauf gemessen.
+2 -2
View File
@@ -45,8 +45,8 @@ unbezahlter Monat.
## Offen
- Die Zahlungen sind einfache Buchungen ohne eigenen Bilanzposten; die Monatsprognose der
Werbeseite enthält sie nicht.
- In der Bilanz steht das Budget unter „PR-Arbeit“, die Einnahme unter „Sonstiges“. Die
Monatsprognose der Werbeseite enthält beides noch nicht.
- Die Wirkung auf die Wirtschaft über mehrere Saisons ist nicht in einem Langlauf gemessen;
die Sätze sind ein erster Ansatz.
- Auf der leichtesten Stufe bucht das Spiel kein Geld; die Reichweite wächst dort trotzdem.
+5
View File
@@ -161,6 +161,11 @@ wurden tatsächlich gesichtet. Private GUI-Ressourcen und Bildschirmbelege
bleiben außerhalb dieses öffentlichen Repositories. Windows und macOS sind
nicht interaktiv geprüft; dies ist kein Engine- oder Plattformrelease.
> **Stand 17. November 2026:** Der Treiber unten zielt noch auf den früheren Schreibtisch und den
> alten Ticker (`#object-app-kickoff`, `#window-close`, `.live-*`). Seit dem Notizbuch und dem
> Spielbogen (`mv-*`) gibt es diese Elemente nicht mehr; der Treiber muss vor dem nächsten Lauf
> auf die neuen Kennungen umgestellt werden. Er ist bis dahin nicht lauffähig.
Der wiederholbare native Eingabelauf liegt in
`tools/modern_ui/live_demo_qa.py`. Beispiel mit selbst erzeugten Fixtures:
+6
View File
@@ -10015,6 +10015,8 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
return false;
}
modern::assembly_baseline(g_, manager);
// a note in his mailbox, in the form of the original's messages
try { post_composed(g_, manager, ui::utf8_to_original("Vereinswechsel: Sie führen jetzt ") + g_.club_name(offer->team) + "."); } catch (const std::exception&) {}
int master = -1;
for (size_t m = 0; m * 2 + 1 < db_.raw_club_name_offsets.size() && master < 0; ++m)
if (uint16_t(db_.raw_club_name_offsets[m * 2] | db_.raw_club_name_offsets[m * 2 + 1] << 8) == g_.club_ids.at(size_t(offer->team))) master = int(m);
@@ -10054,6 +10056,10 @@ cli::Json ModernSession::ui_command(const cli::Json& request, uint64_t& revision
return ask("Die Mitglieder haben den Manager abgewählt: Er muss den Verein wechseln.");
}
modern::assembly_remember(g_, manager, vote);
try {
post_composed(g_, manager, ui::utf8_to_original("Jahreshauptversammlung: " + std::to_string(vote.yes) + " % der Mitglieder stimmen für Sie. " +
(vote.confirmed ? "Sie bleiben im Amt." : must_leave ? "Sie sind abgewählt." : "Das bleibt ohne Folgen.")));
} catch (const std::exception&) {}
if (!new_club.empty() && !move_manager(new_club)) { restore(); managers_ = managers_before; return refuse("club_change_refused", error); }
}
}
+5 -1
View File
@@ -5,6 +5,7 @@
#include "game/random.hpp"
#include "modern/game/matchday.hpp"
#include "modern/game/modern_notes.hpp"
namespace bmh::modern {
namespace {
@@ -65,7 +66,10 @@ void estates_month(ModernState& g) {
if (!league_manager(g, int(m))) continue;
int64_t rent = 0;
for (int k = 0; k < kEstates; ++k) rent += int64_t(g.estates[m][size_t(k)]) * estate_rent(g, k);
if (rent > 0) modern::book_money(g, int(m), -int32_t(rent), true);
if (rent > 0) {
modern::book_money(g, int(m), -int32_t(rent), true);
add_balance_item(g, int(m), BalanceItem::RentAndInterest, rent); // rents on the balance sheet
}
}
}
+13 -3
View File
@@ -5,6 +5,7 @@
#include "game/schedule.hpp"
#include "modern/game/matchday.hpp"
#include "modern/game/modern_notes.hpp"
namespace bmh::modern {
namespace {
@@ -66,7 +67,7 @@ bool start_expansion(ModernState& g, int manager, Expansion item) {
const int32_t price = expansion_price(g, manager, item);
if (!expansion_base_built(g, manager, item) || price == 0 || expansion_months_left(g, manager, item) != 0) return false;
const int months = expansion_build_months(g, manager, item);
if (!modern::book_money(g, manager, price, false)) return false;
if (!modern::book_money(g, manager, price, false, true)) return false; // as the original books building: other expenses
if (g.expansions.size() <= size_t(manager)) g.expansions.resize(size_t(manager) + 1);
g.expansions[size_t(manager)].months[size_t(item)] = uint8_t(months);
return true;
@@ -78,10 +79,19 @@ void expansions_month(ModernState& g) {
auto& entry = g.expansions[m];
int64_t income = 0;
for (int k = 0; k < kExpansions; ++k) {
if (entry.months[size_t(k)] > 0 && --entry.months[size_t(k)] == 0 && entry.stage[size_t(k)] + 1 < kExpansionStages[size_t(k)]) ++entry.stage[size_t(k)];
if (entry.months[size_t(k)] > 0 && --entry.months[size_t(k)] == 0 && entry.stage[size_t(k)] + 1 < kExpansionStages[size_t(k)]) {
++entry.stage[size_t(k)];
// the building's name of the texts: the lounge is facility 3 (text 737), the others periphery objects (720 + object)
const size_t text = k == 0 ? 737 : 720 + size_t(kObject[size_t(k)]);
if (g.texts && text < g.texts->strings.size())
post_note(g, int(m), g.texts->strings[text] + original_german(": Ausbaustufe ") + std::to_string(entry.stage[size_t(k)] + 1) + original_german(" ist fertig."));
}
income += expansion_income(g, int(m), Expansion(k));
}
if (income > 0) modern::book_money(g, int(m), -int32_t(income), true);
if (income > 0) {
modern::book_money(g, int(m), -int32_t(income), true);
add_balance_item(g, int(m), BalanceItem::Periphery, income); // with the periphery on the balance sheet
}
}
}
+3 -1
View File
@@ -5,6 +5,7 @@
#include "game/schedule.hpp"
#include "modern/game/matchday.hpp"
#include "modern/game/modern_notes.hpp"
namespace bmh::modern {
namespace {
@@ -46,10 +47,11 @@ void marketing_month(ModernState& g) {
auto& entry = g.marketing[m];
if (league_club(g, int(m)) < 0 || (entry.budget == 0 && entry.reach == 0)) continue;
const bool paid = entry.budget > 0 && modern::book_money(g, int(m), entry.budget, false);
if (paid) add_balance_item(g, int(m), BalanceItem::PublicRelations, entry.budget); // the budget is public relations on the balance sheet
const int target = paid ? marketing_target(entry.budget) : 0;
if (target > entry.reach) entry.reach = uint16_t(entry.reach + std::max(1, (target - entry.reach) / 6));
else if (target < entry.reach) entry.reach = uint16_t(entry.reach - std::max(1, (entry.reach - target) / 4));
if (const int32_t income = marketing_income(g, int(m), entry.reach); income > 0) modern::book_money(g, int(m), -income, true);
if (const int32_t income = marketing_income(g, int(m), entry.reach); income > 0) modern::book_money(g, int(m), -income, true, true); // other income on the balance sheet
}
}
+60
View File
@@ -0,0 +1,60 @@
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
// What Modern's own rules (naming rights, marketing, properties, stages) share with the
// original's bookkeeping: the items of the balance sheet and notes in the manager's mailbox.
#include <cstdint>
#include <string>
#include <string_view>
#include "game/messages.hpp"
#include "modern/game/modern_state.hpp"
namespace bmh::modern {
// The 18 items of a manager's balance sheet (record +0x85c, a dword each): seven kinds of
// income, then the expenses. book_money with its statistics flag fills OtherIncome and
// OtherExpense itself.
enum class BalanceItem : uint8_t {
ShirtAdvertising, BoardAdvertising, Television, Crowd, Periphery, RentAndInterest, OtherIncome,
Salaries, StadiumCosts, Academy, AssistantCoach, Doctor, Physio, TrainingCamps, Supporters, PublicRelations,
InterestAndRepayment, OtherExpense
};
// Adds an amount to an item of the manager's balance sheet. As in the original, the easiest
// level, which books no money, keeps no figures either.
inline void add_balance_item(ModernState& g, int manager, BalanceItem item, int64_t amount) {
if (g.level == 0 || manager < 0 || amount <= 0) return;
const size_t at = size_t(manager) * 0xb0c + 0x85c + size_t(item) * 4;
if (at + 4 > g.manager_records.size()) return;
uint32_t value = 0;
for (int i = 0; i < 4; ++i) value |= uint32_t(g.manager_records[at + size_t(i)]) << (8 * i);
value += uint32_t(amount);
for (int i = 0; i < 4; ++i) g.manager_records[at + size_t(i)] = uint8_t(value >> (8 * i));
}
// German text of the source code (UTF-8) in the single-byte form of the original's texts.
inline std::string original_german(std::string_view utf8) {
static constexpr std::pair<std::string_view, char> kLetters[] = {{"ä", '{'}, {"ö", '|'}, {"ü", '}'}, {"ß", '~'}, {"Ä", '['}, {"Ö", '\\'}, {"Ü", ']'}};
std::string out;
for (size_t i = 0; i < utf8.size();) {
bool found = false;
for (const auto& [letter, byte] : kLetters)
if (utf8.substr(i, letter.size()) == letter) {
out += byte, i += letter.size(), found = true;
break;
}
if (found) continue;
const unsigned char c = static_cast<unsigned char>(utf8[i++]);
out += c < 128 ? char(c) : '?';
}
return out;
}
// A note in the manager's mailbox. `text` is already in the original's form (original_german,
// names and amounts of the engine); the mailbox keeps its first 149 bytes.
inline void post_note(ModernState& g, int manager, const std::string& text) {
if (manager >= 0) post_composed(g, manager, text.substr(0, 149));
}
} // namespace bmh::modern
+20 -2
View File
@@ -5,7 +5,9 @@
#include "game/random.hpp"
#include "game/schedule.hpp"
#include "formats/executable_layout.hpp"
#include "modern/game/matchday.hpp"
#include "modern/game/modern_notes.hpp"
namespace bmh::modern {
namespace {
@@ -18,6 +20,13 @@ int league_club(const ModernState& g, int manager) {
return team >= 0 && team < league_clubs() ? team : -1;
}
// The sponsor's name as the advertising list has it ("" where the texts are not loaded).
std::string sponsor_name(const ModernState& g, int sponsor) {
try {
return message_text(g, ::bmh::layout::Advertising_FormatError_ExecutableField3 + uint32_t(sponsor) * 4);
} catch (const std::exception&) { return {}; }
}
} // namespace
const ModernState::StadiumName* stadium_entry(const ModernState& g, int manager) {
@@ -78,6 +87,10 @@ bool sell_naming_rights(ModernState& g, int manager, int index) {
if (g.stadiums.size() <= size_t(manager)) g.stadiums.resize(size_t(manager) + 1);
auto& entry = g.stadiums[size_t(manager)];
entry.sponsor = offers[size_t(index)].sponsor, entry.monthly = offers[size_t(index)].monthly, entry.months = offers[size_t(index)].months;
if (const std::string sponsor = sponsor_name(g, entry.sponsor); !sponsor.empty()) try {
post_note(g, manager, original_german("Namensrecht: Das Stadion heißt jetzt ") + sponsor + original_german("-Arena. ") + sponsor + original_german(" zahlt ") +
format_amount(g, int32_t(entry.monthly)) + original_german(" im Monat, ") + std::to_string(entry.months) + " Monate lang.");
} catch (const std::exception&) {} // (a state without the texts: no note)
return true;
}
@@ -85,8 +98,13 @@ void naming_rights_month(ModernState& g) {
for (size_t m = 0; m < g.stadiums.size() && m < g.manager_teams.size(); ++m) {
auto& entry = g.stadiums[m];
if (entry.months == 0) continue;
if (league_club(g, int(m)) >= 0) modern::book_money(g, int(m), -int32_t(entry.monthly), true);
if (--entry.months == 0) entry.sponsor = 0xff, entry.monthly = 0;
// the payment counts as other income on the balance sheet
if (league_club(g, int(m)) >= 0) modern::book_money(g, int(m), -int32_t(entry.monthly), true, true);
if (--entry.months == 0) {
if (const std::string sponsor = sponsor_name(g, entry.sponsor); !sponsor.empty())
post_note(g, int(m), original_german("Der Namensvertrag mit ") + sponsor + original_german(" ist ausgelaufen. Das Stadion trägt wieder seinen eigenen Namen."));
entry.sponsor = 0xff, entry.monthly = 0;
}
}
}