diff --git a/docs/COMPATIBILITY.md b/docs/COMPATIBILITY.md index ebada74..cedfbf0 100644 --- a/docs/COMPATIBILITY.md +++ b/docs/COMPATIBILITY.md @@ -61,20 +61,20 @@ The automatic lineup installs the supplied foreign-player rule switch alongside New careers correct the original all-zero EM qualification placeholders to the original national-team placeholders. Supplied nonzero seeds and restored savegame state are not rewritten by this initialization. -## Stadium extension in1.0.3 +## Stadium size: the edition's limits (extension of 1.0.3 withdrawn) -The user-requested stadium extension raises standard A–H maxima to14/24/14/20/ -14/24/14/20thousand places (144,000total), keeping larger supplied custom limits -where the saved byte fields can represent them. Original unit prices remain -edition-owned. Each stand's base build period is at least two weeks per1,000 -places of its expanded maximum and never shorter than the edition's original -period. Contractor shortening remains unchanged. +The stadium blocks A–H use the limits, unit prices and construction periods of +the supplied edition unchanged. Diamond 3.6/3.7 allows 8/18/8/14 thousand places +per block, twice, so 96,000 places in total; its 14k stands take 25 weeks, the 8k +stands 30 and the 18k stands 37 (original data, not a mistaken timer). Contractor +shortening remains unchanged. The UI validates quotes against the actual edition. -The original Diamond3.6/3.7 table's14k stands really used25weeks versus30weeks -for8k and37weeks for18k. That was original data, not a mistaken timer. Expanded -limits/time policy is an intentional improvement. The UI now validates quotes -against the actual edition and this shared policy rather than hardcoded Diamond -prices and sizes. Existing eight capacity/construction bytes and saves are retained. +Versions 1.0.3 to 1.0.12 raised the standard maxima to 14/24/14/20 thousand +(144,000 in total) with longer construction periods. That extension is withdrawn: +the match broadcast of the original has no room for attendances of 100,000 and +more and showed them wrongly. A savegame whose stadium is already larger than the +edition's limit keeps its places (the capacity bytes are unchanged), but such a +block cannot be extended any further. ## Daily interest at large native balances OpenBMH deviates from the original: daily debt and deposit interest uses 64-bit diff --git a/docs/DIFFERENCES.md b/docs/DIFFERENCES.md index 8f30ec2..b75b3e4 100644 --- a/docs/DIFFERENCES.md +++ b/docs/DIFFERENCES.md @@ -22,7 +22,6 @@ describe deliberate changes; they are not a list of every known compatibility li - [src/game/national.cpp](../src/game/national.cpp): a new arrival must not inherit the previous occupant's retirement/refusal/month-processing flags. - [src/game/season.cpp](../src/game/season.cpp): age/retire each player once, even when a temporary offer row references his club slot or regeneration moves him to a later free-agent slot. - [src/game/season.cpp](../src/game/season.cpp): initializes the empty EM qualifier seeds with national teams, preventing club zero from entering the EM. -- [src/game/stadium_blocks.cpp](../src/game/stadium_blocks.cpp): allow 144,000 standard places and size-aware construction times while retaining edition-owned unit prices. - [src/game/state.hpp](../src/game/state.hpp): retains designated set-piece selections in the supported manager-record extension. - [src/game/week.cpp](../src/game/week.cpp): widen products before annual-rate division so valid native account amounts do not overflow intermediate sums. - [src/game/week.cpp](../src/game/week.cpp): an unknown history receives a grace month; later losses occur at most once per source month. diff --git a/src/game/stadium_blocks.cpp b/src/game/stadium_blocks.cpp index 4974312..7f93996 100644 --- a/src/game/stadium_blocks.cpp +++ b/src/game/stadium_blocks.cpp @@ -70,25 +70,20 @@ bool valid_resolved_offer(const StandBlockOffer& offer, const StadiumBlockExpans } // namespace StadiumBlockExpansionConstants stadium_block_expansion_constants(const LeImage& image) { - // OpenBMH deviates from the original: allow 144,000 standard places and - // size-aware construction times while retaining edition-owned unit prices. - static constexpr std::array minima{ - 14000, 24000, 14000, 20000, 14000, 24000, 14000, 20000}; + // The limits, prices and construction periods of the edition, unchanged: Diamond 3.7 allows + // 8/18/8/14 thousand places per block (A-D and E-H), 96,000 in total. Versions 1.0.3 to 1.0.12 + // raised the limits to 144,000; that is withdrawn, because the match broadcast of the original + // has no room for attendances of 100,000 and more and showed them wrongly. StadiumBlockExpansionConstants out; uint32_t total = 0; - for (size_t i = 0; i < minima.size(); ++i) { + for (size_t i = 0; i < out.max_places.size(); ++i) { out.price_per_1000[i] = image.u32( layout::CareerSession_DispatchStadium_RuntimeField + uint32_t((i + 8) * 4)); - const auto original = uint32_t(image.u8( + out.max_places[i] = uint32_t(image.u8( layout::CareerSession_Invalid_RuntimeField + uint32_t(i))) * 1000; - out.max_places[i] = std::max(original, minima[i]); total += out.max_places[i]; - const auto source_weeks = image.u8( + out.weeks[i] = image.u8( layout::CareerSession_DispatchStadium_RuntimeField2 + uint32_t((i + 22) * 5)); - const auto weeks = std::max(source_weeks, 2 * (out.max_places[i] / 1000)); - if (weeks > 255) - throw FormatError("stadium: expanded construction period exceeds saved byte"); - out.weeks[i] = uint8_t(weeks); } if (total > 255000) throw FormatError("stadium: combined stand limits exceed saved capacity byte"); diff --git a/src/game/stadium_blocks.hpp b/src/game/stadium_blocks.hpp index bb37885..227ed35 100644 --- a/src/game/stadium_blocks.hpp +++ b/src/game/stadium_blocks.hpp @@ -23,8 +23,9 @@ struct StadiumBlockExpansionConstants { std::array max_places{}; }; -// OpenBMH1.0.3 expands standard A-H limits to at least144k total. Prices -// still come from the edition; larger blocks have at least2weeks per1000places. +// The edition's limits (thousands of places per block A-H), unit prices and construction weeks, +// exactly as supplied: Diamond 3.7 gives 8/18/8/14 twice = 96,000 places. (1.0.3 to 1.0.12 raised +// the limits to 144,000; withdrawn in 1.0.13, see stadium_blocks.cpp.) StadiumBlockExpansionConstants stadium_block_expansion_constants(const LeImage&); // An immutable quote binds the Source owner and every record/table value that diff --git a/src/ui/preparation_tests.cpp b/src/ui/preparation_tests.cpp index 65338f3..832e887 100644 --- a/src/ui/preparation_tests.cpp +++ b/src/ui/preparation_tests.cpp @@ -30,9 +30,9 @@ PreparationState fixture(const LeImage& exe) { PreparationState s; auto& d = s.desktop; d.source = "engine_projection"; d.revision = 7; - d.manager_slot = 0; d.runtime_club = 12; d.club_name = "UNITFC"; d.manager_name = "Nobody"; + d.manager_slot = 0; d.runtime_club = 12; d.club_name = "UNITFC"; d.manager_name = "OpenBMH"; // the default name the manager dialog offers d.manager_teams = {12}; - d.managers = {{12,12,0,0,0,"Nobody"}}; + d.managers = {{12,12,0,0,0,"OpenBMH"}}; d.league = 0; d.portrait = 0; d.date = desk_date(0, exe); d.strength = 80; d.options.managers = 1; d.options.world = false; d.options.league = true; d.automation[4] = 0x9f; diff --git a/tests/other_games_ui_tests.cpp b/tests/other_games_ui_tests.cpp index c981446..4ba3fde 100644 --- a/tests/other_games_ui_tests.cpp +++ b/tests/other_games_ui_tests.cpp @@ -397,8 +397,8 @@ PreparationState flow_fixture(const LeImage& exe) { PreparationState state; auto& d = state.desktop; d.source = "engine_projection"; d.revision = 7; - d.manager_slot = 0; d.runtime_club = 12; d.club_name = "BAYERN"; d.manager_name = "Nobody"; - d.manager_teams = {12}; d.managers = {{12,12,0,0,0,"Nobody"}}; + d.manager_slot = 0; d.runtime_club = 12; d.club_name = "BAYERN"; d.manager_name = "OpenBMH"; // the default name the manager dialog offers + d.manager_teams = {12}; d.managers = {{12,12,0,0,0,"OpenBMH"}}; d.league = 0; d.portrait = 0; d.date = desk_date(0, exe); d.strength = 80; d.options.managers = 1; d.options.world = false; d.options.league = true; d.automation[4] = 0x9f; diff --git a/tests/stadium_block_ui_tests.cpp b/tests/stadium_block_ui_tests.cpp index cc35bd5..2747bcb 100644 --- a/tests/stadium_block_ui_tests.cpp +++ b/tests/stadium_block_ui_tests.cpp @@ -139,10 +139,10 @@ void assert_key_source_cell(const StadiumScreen& screen, const std::filesystem:: constexpr std::array kPrices{300000, 375000, 300000, 350000, 300000, 375000, 300000, 350000}; -// Match the retained 144k expansion policy and size-aware construction periods. -constexpr std::array kMaxima{14000, 24000, 14000, 20000, - 14000, 24000, 14000, 20000}; -constexpr std::array kWeeks{30, 48, 30, 40, 30, 48, 30, 40}; +// The limits and construction periods of Diamond 3.7 (96,000 places in total). +constexpr std::array kMaxima{8000, 18000, 8000, 14000, + 8000, 18000, 8000, 14000}; +constexpr std::array kWeeks{30, 37, 30, 25, 30, 37, 30, 25}; StadiumBlockExpansionEditor editor_for(uint8_t slot = 1, uint32_t total = 8000, uint8_t features = 0, uint8_t raw_flags = 0) { @@ -293,7 +293,7 @@ void row_hit_tests(const std::filesystem::path& data) { StadiumScreen screen(data, state); const auto request = screen.click(250, 22 + slot * 24 + 3); check(request.kind == StadiumRequestKind::expansion_select && request.block_slot == slot, - "the eight Source block rows map to the eight A–H slots"); + "the eight Source block rows map to the eight A–H slots"); check(!request.expected_block_quote && request.block_total_places == 0 && request.block_features == 0, "Source entry carries only the selected slot before the App quote projection"); } @@ -304,7 +304,7 @@ void row_hit_tests(const std::filesystem::path& data) { check(screen.click(140, 219).kind == StadiumRequestKind::none, "the current/future footer control is a local presentation action"); check(screen.click(250, 22 + 2 * 24 + 3).kind == StadiumRequestKind::expansion_select, - "future-information view leaves idle A–H rows editable"); + "future-information view leaves idle A–H rows editable"); auto select_state = overview_state(); select_state.blocks[1].capacity_level = 8; select_state.blocks[1].capacity = 8; @@ -419,7 +419,7 @@ void source_textd_stadium_caption_tests(const std::filesystem::path& data) { assert_text_pixels(editor_image, font, 5, 130, text(::bmh::layout::Stadium_RenderBlockExpansion_TextPointer9), 0x6a, "block editor paints the Original TEXTD total-cost label"); - const std::string duration = format_number(GameState{}, 48, 0x82) + text(::bmh::layout::Stadium_FormatError_RuntimeField) + + const std::string duration = format_number(GameState{}, 37, 0x82) + text(::bmh::layout::Stadium_FormatError_RuntimeField) + exe.cstring(::bmh::layout::Stadium_FormatError_ExecutableField) + exe.cstring(::bmh::layout::CareerSession_FormatNumber_ExecutableField); const int duration_x = 148 - font.text_width(duration); assert_text_pixels(editor_image, font, duration_x, 54, duration, 0x6c, @@ -646,7 +646,7 @@ void source_table_and_ack_tests(const std::filesystem::path& data) { auto returned = cancelled.state(); next_identity(returned); returned.block_expansion.reset(); cancelled.acknowledge(returned); check(cancel.kind == StadiumRequestKind::expansion_cancel && !cancelled.state().block_expansion, - "a valid quote-bound cancel ACK returns to the A–H overview"); + "a valid quote-bound cancel ACK returns to the A–H overview"); } void calculator_tests(const std::filesystem::path& data) { @@ -690,7 +690,7 @@ void calculator_tests(const std::filesystem::path& data) { check(screen.calculator_open(), "host can query calculator visibility without reading or mutating Native"); assert_readout_source_text(screen, data, format_number(GameState{}, 0, 7), "initial calculator readout matches Original width-seven FNT3 glyphs"); - assert_preset_source_cell(screen, data, exe, 7, 24000); + assert_preset_source_cell(screen, data, exe, 7, 18000); const Image before = screen.render(); check(screen.pointer_down(116, 36), "the calculator header starts a Source drag"); screen.pointer_move(1000, 1000); @@ -760,7 +760,7 @@ void calculator_tests(const std::filesystem::path& data) { "preset selection changes the value without the keypad's invented pressed phase"); const auto preset_accept = keyboard_return_after_source_phase(preset); check(preset_accept.kind == StadiumRequestKind::expansion_set_total && - preset_accept.block_total_places == 24000, + preset_accept.block_total_places == 18000, "a preset value remains usable through the timed Source J action"); StadiumScreen low_total(data, detail_state()); @@ -775,7 +775,7 @@ void calculator_tests(const std::filesystem::path& data) { high_total.click(50, 80); check(high_total.text("999999"), "large typed input is accepted and clamped to Source maximum"); const auto maximum = keyboard_return_after_source_phase(high_total); - check(maximum.kind == StadiumRequestKind::expansion_set_total && maximum.block_total_places == 24000, + check(maximum.kind == StadiumRequestKind::expansion_set_total && maximum.block_total_places == 18000, "calculator input never exceeds the slot-B maximum"); StadiumScreen reopened(data, detail_state(1, 15333, 1)); @@ -783,7 +783,7 @@ void calculator_tests(const std::filesystem::path& data) { check(reopened.text("1"), "reopened calculator accepts another appended digit"); const auto appended = keyboard_return_after_source_phase(reopened); check(appended.kind == StadiumRequestKind::expansion_set_total && - appended.block_total_places == 24000, + appended.block_total_places == 18000, "reopening starts from D=7333 and appends instead of replacing it with the first digit"); StadiumScreen zeroes(data, detail_state()); @@ -904,12 +904,12 @@ void offer_ack_tests(const std::filesystem::path& data) { auto no_build = no_screen.state(); next_identity(no_build); const auto no_quote = no_build.block_expansion->quote; no_build.block_expansion.reset(); no_build.construction_tip_dialog.reset(); - no_build.blocks[1].construction_weeks = 48; + no_build.blocks[1].construction_weeks = 37; no_build.blocks[1].flags = uint8_t(no_build.blocks[1].flags | 0x10); no_build.blocks[1].capacity = 15; no_build.balance -= int32_t(no_quote.base_price); no_screen.acknowledge(no_build); - check(!no_screen.pending() && no_screen.state().blocks[1].construction_weeks == 48, + check(!no_screen.pending() && no_screen.state().blocks[1].construction_weeks == 37, "a valid NO decision constructs at the original base price and full duration"); auto poor = initial; @@ -1035,7 +1035,7 @@ void source_compensation_ack_tests(const std::filesystem::path& data) { "negative-week compensation path can take the ordinary NO construction"); const auto no_offer = *negative_weeks.state().block_expansion->offer; const int32_t negative_compensation = -66000; // 11,000 * (17-20) * rate 2. - negative_weeks.acknowledge(completed_build_state(negative_weeks, 48, + negative_weeks.acknowledge(completed_build_state(negative_weeks, 37, late.balance - int32_t(no_offer.base_price) - negative_compensation, 14000)); check(negative_weeks.state().balance == late.balance - int32_t(no_offer.base_price) + 66000, "negative Source weeks credit the account while the ticket cap still applies"); @@ -1047,7 +1047,7 @@ void source_compensation_ack_tests(const std::filesystem::path& data) { check(!no_account_booking.click(210, 171).accept_tip, "level-zero Source path can accept a normal NO construction"); const auto level_zero_offer = *no_account_booking.state().block_expansion->offer; - no_account_booking.acknowledge(completed_build_state(no_account_booking, 48, + no_account_booking.acknowledge(completed_build_state(no_account_booking, 37, level_zero.balance, 14000)); check(no_account_booking.state().balance == level_zero.balance && no_account_booking.state().season_tickets == 14000 && @@ -1213,7 +1213,7 @@ int main(int argc, char** argv) try { calculator_tests(data); offer_ack_tests(data); source_compensation_ack_tests(data); - std::cout << "Source-valid A–H tables, calculator phases, compensation ACKs, and plain-manager tip retry checks passed\n"; + std::cout << "Source-valid A–H tables, calculator phases, compensation ACKs, and plain-manager tip retry checks passed\n"; return 0; } catch (const std::exception& e) { std::cerr << "stadium_block_ui_tests: " << e.what() << '\n'; diff --git a/tests/stadium_extended_limits_tests.cpp b/tests/stadium_extended_limits_tests.cpp index d4d05df..c7ffa3e 100644 --- a/tests/stadium_extended_limits_tests.cpp +++ b/tests/stadium_extended_limits_tests.cpp @@ -1,4 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-only +// The stadium block limits come from the edition unchanged (Diamond 3.7: 96,000 places in total). +// The file keeps its historical name: until 1.0.12 it tested the withdrawn 144,000 place extension. #include "game/stadium_blocks.hpp" #include "formats/le.hpp" #include @@ -13,11 +15,12 @@ int main()try{ const uint8_t original_max[]={8,18,8,14,8,18,8,14},original_weeks[]={30,37,30,25,30,37,30,25}; for(uint32_t i=0;i<8;++i){image.patch(layout::CareerSession_Invalid_RuntimeField+i,original_max+i,1);image.patch(layout::CareerSession_DispatchStadium_RuntimeField2+(i+22)*5,original_weeks+i,1);const uint8_t price[]={0xe0,0x93,0x04,0};image.patch(layout::CareerSession_DispatchStadium_RuntimeField+(i+8)*4,price,4);} const auto constants=stadium_block_expansion_constants(image); - check(constants.max_places==std::array{14000,24000,14000,20000,14000,24000,14000,20000},"expanded block limits differ"); - check(std::accumulate(constants.max_places.begin(),constants.max_places.end(),0u)==144000,"full stadium does not reach144k"); - check(constants.weeks==std::array{30,48,30,40,30,48,30,40},"larger block duration is not scaled with size"); + check(constants.max_places==std::array{8000,18000,8000,14000,8000,18000,8000,14000},"block limits are not the edition's"); + check(std::accumulate(constants.max_places.begin(),constants.max_places.end(),0u)==96000,"a full Diamond 3.7 stadium does not have 96,000 places"); + check(constants.weeks==std::array{30,37,30,25,30,37,30,25},"construction weeks are not the edition's"); check(constants.price_per_1000[0]==300000&&constants.price_per_1000[7]==300000,"edition unit prices were replaced"); - const uint8_t custom=20;image.patch(layout::CareerSession_Invalid_RuntimeField,&custom,1);check(stadium_block_expansion_constants(image).max_places[0]==20000,"larger supplied custom stand was reduced"); - const uint8_t unsupported=255;image.patch(layout::CareerSession_Invalid_RuntimeField,&unsupported,1);bool rejected=false;try{stadium_block_expansion_constants(image);}catch(const FormatError&){rejected=true;}check(rejected,"unrepresentable capacity/duration accepted"); - std::cout<<"144k stadium policy, edition prices, capacity-based weeks, custom floors and saved byte limits passed\n"; + // an edition (or edited data) with other limits is taken as supplied + const uint8_t custom=20;image.patch(layout::CareerSession_Invalid_RuntimeField,&custom,1);check(stadium_block_expansion_constants(image).max_places[0]==20000,"a supplied custom limit was changed"); + const uint8_t unsupported=255;image.patch(layout::CareerSession_Invalid_RuntimeField,&unsupported,1);bool rejected=false;try{stadium_block_expansion_constants(image);}catch(const FormatError&){rejected=true;}check(rejected,"limits beyond the saved capacity byte accepted"); + std::cout<<"96,000 place stadium of the edition, edition prices and weeks, custom limits and saved byte limit passed\n"; }catch(const std::exception& error){std::cerr<