Extend edition-aware stadium blocks to 144k with scaled build periods (by Codex)
This commit is contained in:
1 parent
c8ae7a31d2
commit
7b5cd6988e
8 files changed
+76
-25
No files matched your search
@@ -230,8 +230,8 @@ void test_preview_cancel_zero_and_cross_family(const std::filesystem::path& data
|
||||
page.block_expansion->quote.current_capacity_thousands==10&&
|
||||
page.block_expansion->header_text_variant==expected_header_value,
|
||||
"accepted B editor binds the live capacity and draws its header variant once");
|
||||
check(page.block_expansion->quote.price_per_1000==375000&&page.block_expansion->quote.base_weeks==37,
|
||||
"B uses the literal Source A-H table entries 9 and 23");
|
||||
check(page.block_expansion->quote.price_per_1000==375000&&page.block_expansion->quote.base_weeks==48,
|
||||
"B retains the edition price and uses the expanded24k construction period");
|
||||
const auto& initial_block=*page.block_expansion;
|
||||
const auto amount_text=[&](uint32_t amount) {
|
||||
return format_number(session->state(),int32_t(amount),0x181)+source_exe.cstring(::bmh::layout::CareerSession_FormatNumber_ExecutableField);
|
||||
@@ -385,8 +385,8 @@ void test_literal_eight_block_tables(const std::filesystem::path& data) {
|
||||
page=stadium_state(*session,revision);
|
||||
const auto& quote=page.block_expansion->quote;
|
||||
check(quote.price_per_1000==executable.u32(layout::CareerSession_DispatchStadium_RuntimeField + (size_t(slot)+8)*4)&&
|
||||
quote.base_weeks==executable.u8(layout::CareerSession_DispatchStadium_RuntimeField2 + (size_t(slot)+22)*5),
|
||||
"each A-H slot matches its externally supplied executable table");
|
||||
quote.base_weeks==stadium_block_expansion_constants(executable).weeks[size_t(slot)],
|
||||
"each A-H slot matches edition prices and expanded construction policy");
|
||||
auto cancel=request_from(page,ui::StadiumRequestKind::expansion_cancel,slot,
|
||||
quote.total_target_places,quote.desired_features);
|
||||
check(session->dispatch_stadium(cancel,revision,error)&&error.empty(),"each table quote cancels cleanly");
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#include "game/stadium_blocks.hpp"
|
||||
#include "formats/le.hpp"
|
||||
#include <iostream>
|
||||
#include <numeric>
|
||||
#include <stdexcept>
|
||||
namespace {
|
||||
void check(bool value,const char* message){if(!value)throw std::runtime_error(message);}
|
||||
}
|
||||
int main()try{
|
||||
using namespace bmh;
|
||||
auto image=LeImage::from_bytes(0xa3600,Bytes(0x1000));
|
||||
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<uint32_t,8>{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<uint8_t,8>{30,48,30,40,30,48,30,40},"larger block duration is not scaled with size");
|
||||
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";
|
||||
}catch(const std::exception& error){std::cerr<<error.what()<<'\n';return 1;}
|
||||
Reference in new issue
Block a user