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

+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;
}
}
}