// SPDX-License-Identifier: GPL-3.0-only // The controller: the one synchronous boundary between the UI flow (ui::StartupFlow) and // the engine session (CareerSession). The flow turns a click or key into a ui::FlowResult // that carries a request; serve_flow_request() validates it against the current revision, // calls the session, and acknowledges the outcome back to the flow. Everything the engine // needs from the front end (dialogs, live match presentation, notices) is passed in as // std::function "presenter" hooks, so tests can drive the same code without a window. // Pairs with controller.cpp; the real hooks are supplied by main.cpp. #pragma once #include "app/career_session.hpp" #include "audio/playback.hpp" #include namespace bmh::app { using SeasonPresenter = std::function; using TransferOfferPresenter = std::function; using TransferDecisionPresenter = std::function; using PoachNoticePresenter = std::function; using AdvertisingRenewalPresenter = std::function; using NationalFriendlyQuestionPresenter = std::function( const GameState&, ui::TaxDialogProjection, const Image&)>; using ContractExpiryPresenter = CareerSession::ContractExpiryPresenter; using LoanReturnPresenter = CareerSession::LoanReturnPresenter; using LoanReturnOfferPresenter = CareerSession::LoanReturnOfferPresenter; using LiveLineupDispatcher = std::function; using LiveTacticsDispatcher = std::function; using LivePitchDispatcher = std::function; enum class LiveInterventionBoundary { begin, finish, abort }; using LiveInterventionScopeDispatcher = std::function; using LiveInterventionPresenter = std::function&, GameState&, uint64_t&, const LiveLineupDispatcher&, const LiveTacticsDispatcher&, const LivePitchDispatcher&, const LiveInterventionScopeDispatcher&)>; using LiveMatchEventPresenter = std::function&, GameState&, uint64_t&, const LiveLineupDispatcher&, const LiveTacticsDispatcher&, const LivePitchDispatcher&, const LiveInterventionScopeDispatcher&)>; using EnvironmentNoticePresenter = std::function; using LiveRealityPresenter = decltype(TurnDriver::live_reality); using PhaseResultPresenter = decltype(TurnDriver::phase_results); using LiveBallPresenter = std::function&, const GameState&)>; using LiveChancePresenter = std::function&, const GameState&)>; using LiveShotPresenter = std::function&, const GameState&)>; using LiveSetPiecePresenter = std::function&, const GameState&)>; using LiveBookingPresenter = std::function&, const GameState&)>; using LiveShootoutPresenter = std::function&, const GameState&)>; // Shared, synchronous request boundary of the SDL app. Tests drive the same // controller without a window; rendering and navigation never advance the engine. std::string serve_flow_request(ui::StartupFlow&, const ui::FlowResult&, std::unique_ptr&, const std::filesystem::path& data, const std::filesystem::path& save_directory, uint32_t seed, uint64_t& revision, openbmh::audio::Playback&, std::optional& audio_session, bool music_enabled, std::function&, const GameState&)> live_presenter = {}, TransferOfferPresenter transfer_presenter = {}, TransferDecisionPresenter transfer_decision_presenter = {}, SeasonPresenter season_presenter = {}, SeasonTaxHooks tax_presenter = {}, SeasonHighscoreHook highscore_presenter = {}, SeasonPromotionHook promotion_presenter = {}, SeasonCupDrawHook cup_draw_presenter = {}, PendingOfferHooks pending_offer_presenter = {}, PendingOfferEntryPolicy pending_entry_policy = PendingOfferEntryPolicy::legacy_unpresented, HumanBuyerSaleHooks market_sale_presenter = {}, HumanBuyerMarketEntryPolicy market_entry_policy = HumanBuyerMarketEntryPolicy::legacy_unpresented, TransferOfferTeamInfoPresenter team_info_presenter = {}, TransferOfferPlayerInfoPresenter player_info_presenter = {}, ConstructionNoticeHook construction_notice_presenter = {}, SeasonTicketCompensationNoticeHook compensation_notice_presenter = {}, SportschauPresentationHooks sportschau_presenter = {}, AdvertisingRenewalPresenter advertising_renewal_presenter = {}, CareerSession::PoachPlayerSelector poach_player_selector = {}, PoachNoticePresenter poach_notice_presenter = {}, ContractExpiryPresenter contract_expiry_presenter = {}, NationalFriendlyQuestionPresenter national_friendly_question_presenter = {}, LoanReturnPresenter loan_return_presenter = {}, LoanReturnOfferPresenter loan_return_offer_presenter = {}, LiveInterventionPresenter live_intervention_presenter = {}, EnvironmentNoticePresenter environment_notice_presenter = {}, LiveMatchEventPresenter live_match_event_presenter = {}, LiveBallPresenter live_ball_presenter = {}, LiveChancePresenter live_chance_presenter = {}, LiveShotPresenter live_shot_presenter = {}, LiveSetPiecePresenter live_set_piece_presenter = {}, LiveBookingPresenter live_booking_presenter = {}, LiveShootoutPresenter live_shootout_presenter = {}, LiveRealityPresenter live_reality_presenter = {}, PhaseResultPresenter phase_result_presenter = {}, bool enable_autosave = false); // Focused controller entry for callers that only need to inject the original // yes/no question presenter; all unrelated synchronous hooks keep defaults. std::string serve_flow_request(ui::StartupFlow&, const ui::FlowResult&, std::unique_ptr&, const std::filesystem::path& data, const std::filesystem::path& save_directory, uint32_t seed, uint64_t& revision, openbmh::audio::Playback&, std::optional& audio_session, bool music_enabled, NationalFriendlyQuestionPresenter national_friendly_question_presenter); } // namespace bmh::app