Files
Dreierpack-Manager/src/modern/ui/demo_stadium.hpp
T

43 lines
2.6 KiB
C++

// SPDX-License-Identifier: GPL-3.0-only
#pragma once
#include "modern/ui/catalog.hpp"
namespace bmh::modern_ui {
// Presentation-only construction ledger. Only state.stadium is owned here:
// {club,budget,blocks:[{places,seats,roof,job}],facilities:[{level,job}]}.
// All money is currency minor units. No periphery, ticket, navigation, engine,
// random stream, world edit, legacy initialization, or completion timer.
Json demo_stadium(const Catalog &, const std::string &club = {});
bool valid_demo_stadium(const Json &state, const Catalog &,
const std::string &club = {});
// Initialize only an entirely absent stadium object. Existing invalid data is
// rejected unchanged; budget plus all correctly priced pending jobs is 50M.
bool migrate_demo_stadium(Json &state, const Catalog &,
const std::string &club = {});
// Only {kind:"build",request:{kind:"block",index,places,seats,roof}} or
// {kind:"build",request:{kind:"facility",index,level}}. Recompute the quote,
// atomically debit only local stadium budget and stage a pending job.
std::string edit_demo_stadium(Json &state, const Json &action, const Catalog &,
const std::string &club = {});
// {ok,can_build,error,request,kind,index,cost,weeks,budget,remaining,
// placesCost,seatsCost,roofCost}. All monetary values are raw minor units.
// Invalid input/downgrades => ok=false; no-op, pending target or insufficient
// budget => ok=true,can_build=false with a precise error and usable quote.
// Explicit club wins; otherwise full state.managers[0].club, then legacy first
// manageable club, or "" for a catalogue without manageable clubs.
Json demo_stadium_quote(const Json &state, const Json &request, const Catalog &,
const std::string &club = {});
// {budget_cap,blocks:[index,letter,name,max_places,rate,weeks],
// facilities:[index,name,max_level,rate,weeks,levels]}. Rates are raw; level
// labels are 1-based with an empty entry at index 0. No artwork is required.
Json demo_stadium_rules(const Catalog &);
// {ok,club,club_name,name,stadium,budget,budget_cap,pending_cost,
// available_capacity,planned_capacity,capacity,blocks,facilities}.
// Rule rows above are augmented with unchanged base values/job/building plus
// display_places/seats/roof or display_level/label for the requested view.
// Current capacity excludes a block with any pending job; future uses its target.
// Stadium identity comes from the catalogue, not its initialization policies.
Json demo_stadium_view(const Json &state, const Catalog &, bool future = false,
const std::string &club = {});
} // namespace bmh::modern_ui