diff --git a/src/app/career_session.cpp b/src/app/career_session.cpp index c3c62dd..6fd79a0 100644 --- a/src/app/career_session.cpp +++ b/src/app/career_session.cpp @@ -539,12 +539,7 @@ static void install_league_sizes(const LeImage& exe) { kNewcomerFirst = exe.u16(::bmh::layout::CareerSession_DispatchLineup_RuntimeField); kNewcomerCount = exe.u16(::bmh::layout::CareerSession_InstallLeagueSizes_RuntimeField6); // EXE strings the engine posts (messages.hpp) - kContractEndsSoonText = exe.cstring(kEnglishCompetitions ? ::bmh::layout::EnglishContractExpiryWarningText : ::bmh::layout::ContractExpiryWarningText); - kMastersQualificationText = kEnglishCompetitions ? "Masters entry confirmed. Your participation bonus has been credited." : exe.cstring(::bmh::layout::MastersQualificationText); - kMastersWinnerText = kEnglishCompetitions ? "Masters title won. Your prize money has been credited." : exe.cstring(::bmh::layout::MastersWinnerText); - kIndoorInvitationText = kEnglishCompetitions ? "Indoor event entry bonus credited for " : exe.cstring(::bmh::layout::IndoorInvitationText); - kChampionshipBonusText = kEnglishCompetitions ? "League title bonus credited." : exe.cstring(::bmh::layout::ChampionshipBonusText); - kFriendlyPayerPrefixText = kEnglishCompetitions ? "Your share: " : exe.cstring(::bmh::layout::NationalFriendlyPayerPrefixText); + install_message_texts(exe); } CareerSession::CareerSession(const std::filesystem::path& data, uint32_t watcom_seed) diff --git a/src/game/messages.cpp b/src/game/messages.cpp index ea4813f..66b4315 100644 --- a/src/game/messages.cpp +++ b/src/game/messages.cpp @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only #include "formats/executable_layout.hpp" #include "game/messages.hpp" +#include "game/schedule.hpp" #include #include @@ -150,4 +151,13 @@ std::string format_number(const GameState& g, int32_t value, int flags) { std::string format_amount(const GameState& g, int32_t value) { return format_number(g, value, 0x101); } +void install_message_texts(const LeImage& exe) { + kContractEndsSoonText = exe.cstring(kEnglishCompetitions ? ::bmh::layout::EnglishContractExpiryWarningText : ::bmh::layout::ContractExpiryWarningText); + kMastersQualificationText = kEnglishCompetitions ? "Masters entry confirmed. Your participation bonus has been credited." : exe.cstring(::bmh::layout::MastersQualificationText); + kMastersWinnerText = kEnglishCompetitions ? "Masters title won. Your prize money has been credited." : exe.cstring(::bmh::layout::MastersWinnerText); + kIndoorInvitationText = kEnglishCompetitions ? "Indoor event entry bonus credited for " : exe.cstring(::bmh::layout::IndoorInvitationText); + kChampionshipBonusText = kEnglishCompetitions ? "League title bonus credited." : exe.cstring(::bmh::layout::ChampionshipBonusText); + kFriendlyPayerPrefixText = kEnglishCompetitions ? "Your share: " : exe.cstring(::bmh::layout::NationalFriendlyPayerPrefixText); +} + } // namespace bmh diff --git a/src/game/messages.hpp b/src/game/messages.hpp index 9606a82..ca0f607 100644 --- a/src/game/messages.hpp +++ b/src/game/messages.hpp @@ -16,6 +16,7 @@ #include #include +#include "formats/le.hpp" #include "game/state.hpp" namespace bmh { @@ -59,6 +60,11 @@ inline std::string kIndoorInvitationText; inline std::string kChampionshipBonusText; inline std::string kFriendlyPayerPrefixText; +// Installs the six texts above from the game image (the English game uses its own wording). +// Both career sessions call it at start; standalone engine tools (week_check, the season sims) +// must call it too, or these messages lose their text (#14: the indoor entry bonus mail). +void install_message_texts(const LeImage& exe); + // FormatNumber(buf, value, 0x101, ""): an amount of money as the messages show it: the // value converted with CurrencyMultiplier / CurrencyDivisor, digits grouped by dots, then " EU". std::string format_amount(const GameState& g, int32_t value); diff --git a/tests/runtime_fixture_tables.hpp b/tests/runtime_fixture_tables.hpp index 110b066..eafe3d0 100644 --- a/tests/runtime_fixture_tables.hpp +++ b/tests/runtime_fixture_tables.hpp @@ -1,14 +1,17 @@ // SPDX-License-Identifier: GPL-3.0-only #pragma once #include "formats/le.hpp" +#include "game/messages.hpp" #include "game/schedule.hpp" namespace bmh::test { // Standalone engine tests explicitly install the supplied edition's scheduling -// content. CareerSession performs the same installation for normal app callers. +// content and the message texts. CareerSession performs the same installation for +// normal app callers. inline LeImage load_executable(const std::filesystem::path& path) { auto executable = bmh::load_le(path); install_fixture_tables(executable); + install_message_texts(executable); return executable; } }