Add header comments to the source files
Every source file in ui, app, game, formats, cli, audio and launch that had none now starts with a short English comment: what it implements, what state it owns and how it relates to its neighbours (request/acknowledge flow, pairs of files, random generator use). Comment lines only; the full build and the runnable tests are unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
aa6ec96305
commit
287b5a9251
324 files changed
+1186
No files matched your search
@@ -1,4 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// All-or-nothing wrapper for one UI window action on a CareerSession (used by
|
||||
// desktop_actions.cpp and window_actions.cpp). It snapshots the game state, the RNG and the
|
||||
// revision counter, runs the action and, if the action returns false or throws, restores
|
||||
// all three, so a rejected action leaves no half-applied change behind.
|
||||
// apply_native() is the variant for owners that keep their state in CareerSession::state().
|
||||
// Header-only; owns no state of its own.
|
||||
#pragma once
|
||||
|
||||
#include "app/career_session.hpp"
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Glue between the original-audio engine (src/audio/playback.hpp) and the app: builds the
|
||||
// asset set from the game's sound containers and the frequency/operator tables read from the
|
||||
// executable, derives the music/click/match-sound options from the saved settings bytes of
|
||||
// the GameState, and sends sound commands only when the original sound path is ready.
|
||||
// OriginalMouseSound is an SDL event watch that plays the click sound on each real mouse
|
||||
// button press; it touches only the Playback object, never the GameState, because the
|
||||
// watch can run on SDL's event thread. Header-only.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#pragma once
|
||||
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Implementation of CareerSession (career_session.hpp): the engine side of the career. It
|
||||
// owns the GameState, the two random generators, the turn driver and every "owner" of an
|
||||
// open modal window (transfer editor, league table, bank, contracts, ...), and it is the
|
||||
// only code the UI flow reaches into for game logic, through the controller.
|
||||
// Request/acknowledge model: the UI sends a typed request that carries the revision it
|
||||
// observed; the session checks that revision, applies the change (or rejects it with an
|
||||
// error text), bumps the revision only when something changed and returns a projection or
|
||||
// dispatch result. The front end then acknowledges that result (controller.cpp and the
|
||||
// *Actions facades roll the session back if the acknowledgement fails). Live match events and
|
||||
// notices flow the other way: the session calls presenter hooks synchronously and waits.
|
||||
// This file also contains the checkpoint/restore code used by those rollbacks, the career
|
||||
// start (options, manager join), save/load through the .FBM container and autosave.
|
||||
#include "formats/native_save_version.hpp"
|
||||
#include "formats/badge_policy.hpp"
|
||||
#include "game/calendar.hpp"
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Implementation of the controller (controller.hpp): the request/acknowledge model between
|
||||
// the UI flow, the controller and the session.
|
||||
// 1. The SDL loop in main.cpp feeds input to ui::StartupFlow, which returns a FlowResult
|
||||
// with a FlowRequest (desk action, transfer, friendly match, load game, ...).
|
||||
// 2. serve_flow_request() is the single entry for that request. It rejects requests whose
|
||||
// revision no longer matches (stale UI), or that are blocked by an open owner.
|
||||
// 3. It forwards the request to the matching *Actions facade (desktop_actions.*,
|
||||
// window_actions.*), which runs it on the CareerSession inside a rollback transaction.
|
||||
// 4. The result is acknowledged back to the flow (for example flow.acknowledge_*,
|
||||
// show_*), which then changes what is drawn; rendering alone never advances the engine.
|
||||
// 5. A non-empty return string is an error message (main.cpp prints it); "career_complete"
|
||||
// ends the program. The shared revision counter grows only when state really changed.
|
||||
// Presenters (dialogs, live match frames) are optional hooks; an empty hook means the
|
||||
// headless default. The anonymous namespace holds friendly-match and national-friendly helpers.
|
||||
#include "formats/badge_policy.hpp"
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "app/controller.hpp"
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
// 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"
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Debug mode (command line -debug): a process-wide, mutex-protected log file plus numbered
|
||||
// automatic savegames, both kept in one folder. State is a function-local static; every
|
||||
// function is a no-op until init() has succeeded, so callers may log unconditionally.
|
||||
// init() also redirects stderr into the same folder. Header-only.
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Implementation of the desk-level action facades declared in desktop_actions.hpp. Each
|
||||
// method checkpoints the relevant session owner, runs the request through CareerSession,
|
||||
// lets the accept callback acknowledge the result to the UI, and rolls everything back via
|
||||
// detail::apply_window if the callback returns false or throws. Errors are returned through
|
||||
// the std::string& error parameter. The request/acknowledge flow as a whole is described
|
||||
// at the top of controller.cpp.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "app/desktop_actions.hpp"
|
||||
#include "app/action_transaction.hpp"
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Application-boundary facades for desk-level windows: one small class per owner (desk
|
||||
// settings, balance plan, other games, top scorers, opportunities, manager join, mailbox,
|
||||
// menu layout, environment, reschedule, contracts, friendly matches). Each wraps a
|
||||
// CareerSession reference; its apply() runs an action under a rollback transaction (see
|
||||
// action_transaction.hpp), and open()/dispatch() take the UI request plus the shared
|
||||
// revision counter and an optional "accept" callback that carries the front end's
|
||||
// acknowledgement. Implemented in desktop_actions.cpp; window_actions.hpp holds the club windows.
|
||||
#pragma once
|
||||
|
||||
#include "app/career_session.hpp"
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// SDL event helpers for the live match-day presentation, which runs while the engine is
|
||||
// synchronously paused in its observer hook. live_matchday_board_side() turns a mouse press
|
||||
// into a side (0 or 1) of the board only at the allowed minutes and screen intervals;
|
||||
// pump_live_matchday_events() drains the SDL queue, reports a quit request and an ESC skip
|
||||
// through its return value / out-parameter, and re-queues only non-interactive system events.
|
||||
// Header-only; owns no state.
|
||||
#pragma once
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
@@ -1,4 +1,19 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Entry point of the SDL front end (openbmh_play) and the owner of everything the player
|
||||
// sees and hears: window, renderer, 320x240 indexed canvas, audio Playback, quit handling.
|
||||
// It parses the command line, resolves the game data (src/launch), builds ui::StartupFlow and
|
||||
// then runs the event loops. The request/acknowledge model works like this:
|
||||
// - Input events go to the StartupFlow; a click or key may return a FlowResult carrying a
|
||||
// FlowRequest (kickoff, desk action, transfer, save/load, ...).
|
||||
// - main.cpp's handle() passes that result to app::serve_flow_request() (controller.cpp),
|
||||
// together with the shared revision counter and a large set of presenter lambdas.
|
||||
// - The controller asks the CareerSession (career_session.cpp, the engine side) to do the
|
||||
// work and acknowledges the outcome to the flow; the engine may call a presenter lambda
|
||||
// back, synchronously, to show a modal dialog or a live match frame, which runs its own
|
||||
// nested event loop here until the player answers.
|
||||
// - A non-empty message from the controller is printed to stderr; "career_complete" ends
|
||||
// the program; the screen is redrawn only when the flow marks it dirty.
|
||||
// The engine never draws and the UI never advances the engine on its own.
|
||||
#include "formats/badge_policy.hpp"
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "app/start_screen.hpp"
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Mouse pointer for the pitch page. SDL owns the pointer position; the UI only hands over
|
||||
// the original 11x11 pixel bitmap (121 ARGB values). PitchPointer builds an SDL colour
|
||||
// cursor from it, enlarged by an integer scale derived from the window size in points, and
|
||||
// caches it until the pixels or the scale change. set_default() sets the bitmap used on all
|
||||
// other pages. Header-only; the cursor is freed in clear() / the destructor.
|
||||
#pragma once
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Quit confirmation (a deliberate deviation from the original): a native message box in
|
||||
// German or English whose default button is "Cancel". poll() and peep() wrap
|
||||
// SDL_PollEvent / SDL_PeepEvents and drop SDL_QUIT events the user does not confirm. The
|
||||
// dialog is shown from the UI thread only, and a dialog that fails to open counts as "not
|
||||
// confirmed". The presenter is injectable (defaults to SDL_ShowMessageBox). Header-only.
|
||||
#pragma once
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Implementation of StartScreen (start_screen.hpp): decodes the embedded JPEG
|
||||
// (start_screen_data.hpp) with stb_image into an RGB24 texture, switches the renderer's
|
||||
// logical size to the image size while presenting and restores the previous logical size in
|
||||
// the destructor. Errors are reported as std::runtime_error; the stb_image implementation
|
||||
// is compiled into this file only (JPEG decoding, no stdio).
|
||||
#include "app/start_screen.hpp"
|
||||
#include "app/start_screen_data.hpp"
|
||||
#include <SDL.h>
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Start screen shown before the game data is loaded: one embedded picture drawn with its
|
||||
// own renderer logical size, independent of the indexed game canvas. Owns the SDL
|
||||
// texture; non-copyable. Implemented in start_screen.cpp, the image bytes come from
|
||||
// start_screen_data.hpp.
|
||||
#pragma once
|
||||
struct SDL_Renderer;
|
||||
struct SDL_Texture;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Declares the embedded start screen artwork (JPEG bytes and their size); the definitions
|
||||
// live in a separate data translation unit. Consumed only by start_screen.cpp.
|
||||
#pragma once
|
||||
#include <cstddef>
|
||||
namespace bmh::app {
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// RAII guard for SDL video: SDL_Init(SDL_INIT_VIDEO) in the constructor (throws
|
||||
// std::runtime_error on failure) and SDL_Quit in the destructor. It must exist before any
|
||||
// native file picker is opened (see the comment on the class). Non-copyable, header-only.
|
||||
#pragma once
|
||||
#include <SDL.h>
|
||||
#include <stdexcept>
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Implementation of the club and league window facades declared in window_actions.hpp. Each
|
||||
// method validates the UI request against the session state, runs it on the CareerSession
|
||||
// inside an apply() transaction (state, RNG and revision are restored on rejection or an
|
||||
// exception) and hands the result to the front end's acknowledgement callback. Errors come
|
||||
// back through the std::string& error parameter; see controller.cpp for the overall model.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "app/window_actions.hpp"
|
||||
#include "app/action_transaction.hpp"
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Application-boundary facades for the club and league windows: league table/pairings/
|
||||
// strengths, transfer market and offers, bank, stadium, desk actions and lineup. Same pattern
|
||||
// as desktop_actions.hpp: a class per owner that wraps a CareerSession, offers apply() as a
|
||||
// rollback transaction and takes the shared revision counter plus an acknowledgement
|
||||
// callback from the front end. Implemented in window_actions.cpp, called from controller.cpp.
|
||||
#pragma once
|
||||
|
||||
#include "app/career_session.hpp"
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Implementation of container.hpp: parse_container() checks the FORM/ALPTRAUM header and
|
||||
// walks the adjacent little-endian chunks (no alignment byte) with bounds checks, filling
|
||||
// a Container of offsets; decode_sample() and decode_original_cue() convert the bounded
|
||||
// sample data to PCM. Pure functions on byte spans, no state; failures are reported through
|
||||
// the std::string& error argument and a false result.
|
||||
#include "container.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Reader for the original sound container (a FORM/ALPTRAUM chunk wrapper) and for the PCM
|
||||
// samples inside it. A Container only lists chunk ids and payload offsets; the payload bytes
|
||||
// stay in the caller's buffer, which must outlive any use of the offsets. decode_sample()
|
||||
// turns unsigned 8-bit samples into signed 16-bit mono PCM; decode_original_cue() resolves
|
||||
// only the PCM-backed effects (original ids 17..22). Pairs with container.cpp; the PCM types
|
||||
// are shared by mixer, playback, semantic cues and the music fallback.
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Implementation of Mixer (mixer.hpp). Incoming PCM is resampled to the output rate with
|
||||
// range and overflow checks and a total/per-voice byte ceiling (2 MiB overall, an eighth of
|
||||
// that per voice); mix_block() sums music and active voices into the output block, applies
|
||||
// the volume and advances the cursors (the music loops).
|
||||
#include "mixer.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Small PCM mixer used by the software (non-original) playback path: one looping music
|
||||
// buffer plus up to 8 one-shot voices, all converted to the output rate when added.
|
||||
// start_music_loop()/add_voice() may allocate; mix_block() only reads the prepared buffers
|
||||
// and writes into caller-owned storage, so it is safe to call from the audio path. Owned
|
||||
// by Playback (playback.hpp); the byte limits are in mixer.cpp.
|
||||
#pragma once
|
||||
|
||||
#include "container.hpp"
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Implementation of the synthetic matchday loop (music_fallback.hpp): a fixed 22050 Hz,
|
||||
// 108 bpm, 8-bar sequence of bass, chord and lead notes defined by constant MIDI tables,
|
||||
// rendered to mono PCM16. No game state or randomness is involved, so the output is the
|
||||
// same on every run.
|
||||
#include "music_fallback.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Synthetic fallback matchday music: a deterministic 8-bar loop generated in code. It is
|
||||
// presentation filler, not decoded original music and not tied to any original sound id.
|
||||
// The result is a PcmSample that Playback::start_music_loop() can play; implemented in
|
||||
// music_fallback.cpp.
|
||||
#pragma once
|
||||
|
||||
#include "container.hpp"
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Implementation of OriginalSynth (original.hpp). The hidden State holds the parsed
|
||||
// songs, tracks, channels, sample banks and the Nuked-OPL3 chip core (src/audio/third_party);
|
||||
// tick() runs one sequencer step of the original timer interrupt, render() produces output
|
||||
// samples from the chip and the PCM channel. load() validates every input and fails
|
||||
// cleanly on malformed data; the register and sample observers exist only for offline
|
||||
// validation (original_validation.cpp, sound_driver.cpp).
|
||||
#include "original.hpp"
|
||||
#include "container.hpp"
|
||||
#include "third_party/nuked-opl3/opl3.h"
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Emulation of the original game's sound system (MIDI-style sequencer, OPL FM instruments
|
||||
// and one Sound Blaster PCM channel) as OriginalSynth. The application reads the sound
|
||||
// containers (S/2000..2003) and the frequency/operator tables from the user's executable
|
||||
// and hands them in as OriginalAssets; this module knows nothing about game state, file
|
||||
// layout, the simulation clock or random generators. command() takes the original sound ids
|
||||
// (0 title, 1 desk, 2 intro, 3 crowd, 8 stop, 10..22 effects); render() fills PCM blocks
|
||||
// without allocating. Implemented in original.cpp, driven by Playback and the audio tools.
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Validation executable for the original-sound emulation (original.hpp, playback.hpp). It
|
||||
// needs the user's game data directory as its single argument, loads the executable tables
|
||||
// and sound containers from it, and runs oracle checks on song/effect output, transitions,
|
||||
// malformed input, option and mute handling, effect priorities and the audio callback
|
||||
// lifecycle. With an empty argument it prints SKIP and exits with 77 (test skipped).
|
||||
// Contains no game assets itself.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "original.hpp"
|
||||
#include "playback.hpp"
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Implementation of Playback (playback.hpp): opens the SDL audio device, feeds either the
|
||||
// OriginalSynth from the SDL callback (original mode) or bounded blocks from the Mixer via
|
||||
// pump() (software mode), and maps original ids and semantic cues to sound played on the
|
||||
// device. Duplicate or out-of-order event ids are rejected before anything is played;
|
||||
// shutdown() releases the device.
|
||||
#include "playback.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Audio output device wrapper (SDL) and the single audio object the application uses.
|
||||
// Playback owns the SDL device, a software Mixer (PCM effects, optional music loop) and the
|
||||
// OriginalSynth (the full original driver, streamed from SDL's audio callback so modal
|
||||
// windows cannot starve it). Cue requests carry a session id and an increasing event id
|
||||
// chosen by the controller; submit() consumes each event once and returns a CueStatus.
|
||||
// Mute and volume apply to both paths. Pairs with playback.cpp and app/audio.hpp.
|
||||
#pragma once
|
||||
|
||||
#include "container.hpp"
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Implementation of synthesize_semantic_cue() (semantic_cues.hpp): builds each cue in code
|
||||
// (the whistles from frequency sweeps with attack and release shaping) at 22050 Hz and
|
||||
// clamps the result to 16-bit PCM. Pure and deterministic.
|
||||
#include "semantic_cues.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Semantic sound cues (kickoff whistle, goal, full-time whistle) synthesized in code for
|
||||
// use when no verified original effect is available. They are labels of intent, never
|
||||
// original sound ids. The generator is deterministic mono PCM16 at 22050 Hz and has no
|
||||
// dependency on game state, randomness or rendering; implemented in semantic_cues.cpp.
|
||||
#pragma once
|
||||
|
||||
#include "container.hpp"
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Command line tool openbmh_sound for the audio module. It works either on one sound
|
||||
// container file (play or export a sample, a test tone, or an original effect id as WAV) or,
|
||||
// with --original DATA_DIR, on the user's game data through OriginalSynth (export a song or
|
||||
// effect to WAV, or play ids through the real device). It also plays or exports the
|
||||
// synthetic semantic cues and the fallback music loop. Own state only: parsed arguments.
|
||||
// Bounds on seconds, loops and ids are checked before anything runs.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "container.hpp"
|
||||
#include "music_fallback.hpp"
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Self-contained checks for the audio module that need no game data: container parsing
|
||||
// against authored fixtures, sample and cue decoding, the mixer, the playback request
|
||||
// rules and the synthetic music fallback. The fixtures are built in code and are not
|
||||
// copied from any game asset. Returns non-zero on the first failed CHECK; companion of
|
||||
// original_validation.cpp, which covers the original-driver emulation.
|
||||
#include "container.hpp"
|
||||
#include "music_fallback.hpp"
|
||||
#include "playback.hpp"
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Implementation of the console line parser (parser.hpp): trimming, top-level splitting of
|
||||
// the argument list (commas inside quotes or brackets do not split), parsing of one
|
||||
// argument (positional or name=value), canonical name comparison that ignores case, '.' and
|
||||
// '_', line classification, and the integer/bool converters for arguments. Pure functions;
|
||||
// no console state. The console (console.cpp, windows_*.cpp) checks the argument types.
|
||||
#include "cli/console/parser.hpp"
|
||||
|
||||
#include <cctype>
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Implementation of parse_json()/dump_json() (json.hpp): a small recursive-descent Parser
|
||||
// over a string_view that reports the byte position in JsonError messages, UTF-8 handling
|
||||
// for string escapes, and a serializer for the Json variant. No state beyond the parser's
|
||||
// position in the input.
|
||||
#include "cli/json.hpp"
|
||||
|
||||
#include <charconv>
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Minimal JSON value type for the CLI protocol (no external library). A Json holds null,
|
||||
// bool, a 64-bit integer, string, array or object (std::map) in one std::variant; the
|
||||
// accessors return null pointers when the type does not match, so callers must check.
|
||||
// Numbers are integers only. parse_json() throws JsonError on bad input; dump_json() writes
|
||||
// compact text. Used by protocol.*, seat_hub.cpp and main.cpp; implemented in json.cpp.
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Entry point of openbmh_cli, the headless front end without a window. Besides parsing the
|
||||
// command line (Arguments) it offers several modes on top of the same engine: the JSON
|
||||
// protocol on stdin/stdout (protocol.hpp) with --log/--replay, the console language
|
||||
// (docs/CLI_CONCEPT) as plain session, replay, mailbox server (--serve), multi-seat server
|
||||
// (--seats, SeatHub), TCP listener on 127.0.0.1 (--listen), and --send to hand one block to
|
||||
// a running mailbox session. --data may be a game directory, the game's EXE or an archive
|
||||
// (src/launch resolves it). All game logic stays in the engine; this file only moves lines.
|
||||
#include "cli/protocol.hpp"
|
||||
#include "cli/console/console.hpp"
|
||||
#include "cli/seat_hub.hpp"
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Implementation of the JSON protocol (protocol.hpp). Protocol::handle() validates the
|
||||
// request keys per command (check_keys / check_command_keys), then calls the CareerSession
|
||||
// and the same projection functions the SDL front end uses (desk, table, mail, tactics,
|
||||
// training, camp, bank, stadium, kickoff, save/load, ...), and wraps the result with the
|
||||
// current revision. Errors are returned as {"ok": false, "error": ...}, never thrown to the
|
||||
// caller. The "replay" flag lets a logged session be played again (saves may overwrite).
|
||||
// text_request()/text_response() implement the one-line text form of the protocol.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "cli/protocol.hpp"
|
||||
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// The JSON line protocol of openbmh_cli (the non-console mode): one request object with a
|
||||
// "cmd" field in, one response object ("ok", "revision", result or error) out. Protocol owns
|
||||
// one app::CareerSession (created by "new" or "load") and the revision counter that every
|
||||
// state-changing command must echo back, so stale requests are refused like in the UI
|
||||
// flow. text_request()/text_response() translate a simple one-line text form to and from the
|
||||
// same JSON. Implemented in protocol.cpp; Protocol::help() lists the commands.
|
||||
#pragma once
|
||||
|
||||
#include "cli/json.hpp"
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Implementation of SeatHub (seat_hub.hpp): routes the blocks of several clients into one
|
||||
// console::Console. It runs a block as the seat's manager ("@k"), classifies each output
|
||||
// line with Console::LineInfo, queues lines that concern other seats as their "meanwhile"
|
||||
// feed, holds WaitTurn blocks until they can be answered, and holds the Run/Step of a live
|
||||
// match until every seat has sent one. State per seat is a small Seat record; the game
|
||||
// itself lives in the console.
|
||||
#include "cli/seat_hub.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Decides which club badge tokens the original draws as a fallback instead of an individual
|
||||
// crest. The cut-off for foreign clubs differs between game editions, so it is read from one
|
||||
// instruction in the loaded executable (layout::ForeignBadgeGateInstruction) and stored in the
|
||||
// process-wide original_foreign_badge_end by install_original_badge_policy(). An executable
|
||||
// that does not match the verified pattern falls back to 138. Header-only; the club
|
||||
// selectors themselves stay in the database and savegame data.
|
||||
#pragma once
|
||||
|
||||
#include "formats/executable_layout.hpp"
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Implementation of the basic file helpers declared in binary.hpp: read_file() loads a whole
|
||||
// file into a Bytes vector (FormatError if it cannot be opened) and iso646de_to_utf8()
|
||||
// converts the game's ISO 646-DE strings ([ \ ] { | } ~ stand for the umlauts and the sharp s)
|
||||
// to UTF-8. No state.
|
||||
#include "formats/binary.hpp"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Implementation of the .FBM savegame container (fbm.hpp): fbm_encrypt()/fbm_decrypt() are the
|
||||
// stream cipher whose key changes by 0x29 per byte, and load_savegame() finds the "KRON_FBM"
|
||||
// magic, splits the plain header from the encrypted stream, decrypts it and verifies the
|
||||
// one-byte checksum, which is reported in Savegame::checksum_ok (not thrown). The decrypted
|
||||
// stream is interpreted by savestate.cpp. Pure functions, no state.
|
||||
#include "formats/fbm.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Implementation of the .FNT bitmap font loader and renderer (font.hpp): load_font() reads
|
||||
// the header, the 1-bit glyph bitmap and the per-character location (and spacing) tables and
|
||||
// checks that the file size matches exactly; Font::glyph(), text_width() and draw() look up
|
||||
// glyphs (out-of-range characters use the last glyph) and draw them into an indexed Image.
|
||||
// No state beyond the Font object.
|
||||
#include "formats/font.hpp"
|
||||
|
||||
namespace bmh {
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Implementation of the executable image loader (le.hpp): load_le() reads the original
|
||||
// DOS/4GW LE executable, places its objects at their link addresses and applies the internal
|
||||
// fixups (FormatError for other files or external fixups). It also accepts the OpenBMH image
|
||||
// format written by save_image(), so a translated image can replace the executable.
|
||||
// LeImage::cstring() reads NUL-terminated strings from the image. No global state.
|
||||
#include "formats/le.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Reads from the loaded executable how many league levels a player can see; the original
|
||||
// separates internal domestic league slots from these visible levels. Throws
|
||||
// std::invalid_argument when the stored constants fail the sanity check. Header-only,
|
||||
// stateless; the address comes from executable_layout.hpp and the image from le.hpp.
|
||||
#pragma once
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "formats/le.hpp"
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Implementation of the M3D.MAN master database loader (m3d.hpp). load_database() reads the
|
||||
// file sequentially with a bounds-checked Reader: first the lengths of the four string pools
|
||||
// (clubs, players, referees, stadiums), then the pools, the name offset tables and the raw
|
||||
// record blocks, whose sizes depend on the DbCounts passed in. Several blocks are kept as raw
|
||||
// bytes in the Database (raw_* fields). Throws FormatError on a truncated file.
|
||||
#include "formats/m3d.hpp"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Accepted savegame version markers for the native (original-layout) save format. The FBM
|
||||
// container (fbm.hpp) carries a version string; V2.24 and V3.7 share the same block order,
|
||||
// while expanded careers use their own marker (O1.1) and layout. require_native_savegame()
|
||||
// throws FormatError on a bad checksum or an unsupported marker; callers still validate the
|
||||
// full state layout afterwards (savestate.hpp). Header-only.
|
||||
#pragma once
|
||||
#include "formats/fbm.hpp"
|
||||
#include <string_view>
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Implementation of the palette loader (palette.hpp). load_palette() reads a 256-entry,
|
||||
// 6 bits per channel RGB file and converts it to 32-bit ARGB via vga_dac_rgb8();
|
||||
// load_optional_embedded_palette() reads the palette that may follow the RLE data of a VGA
|
||||
// image file (std::nullopt if there is none); Palette::nearest() returns the index of the
|
||||
// closest colour by squared RGB distance. FormatError on short or inconsistent files.
|
||||
#include "formats/palette.hpp"
|
||||
|
||||
#include "formats/binary.hpp"
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Implementation of the savegame stream layout (savestate.hpp). save_layout() lists the
|
||||
// blocks in the exact order the original wrote them, with sizes that are constants or depend
|
||||
// on DbCounts; the SaveState constructor splits a decrypted stream along that list, reads
|
||||
// the four string-pool trailer blocks and the optional OpenBMH extension, and throws
|
||||
// FormatError if the sizes do not add up. append_save_extension() writes that extension.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "formats/savestate.hpp"
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Implementation of the TEXTD.BLK loader (textd.hpp): skips the 7-byte header, keeps the whole
|
||||
// blob and splits it into NUL-terminated strings, recording each string's offset. Exactly
|
||||
// TEXT_COUNT strings must be found, otherwise FormatError. No state.
|
||||
#include "formats/textd.hpp"
|
||||
|
||||
#include "formats/binary.hpp"
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Implementation of the .VGA image support (vga.hpp): Image::blit() copies one indexed image
|
||||
// into another with clipping, decode_vga() unpacks the run-length data (a byte of 0x80 or
|
||||
// more is a run, below that a literal block) and checks the length fields and the single
|
||||
// trailing byte, and load_vga() reads a file and decodes it. FormatError on malformed data.
|
||||
#include "formats/vga.hpp"
|
||||
|
||||
namespace bmh {
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Business plan (balance plan) screen of a human manager: builds a draft of the plan rows
|
||||
// (income, running costs, shares and loans, catering, ticket price), checks per-row maxima when
|
||||
// the player edits a row and writes the accepted plan back on close.
|
||||
// Reads and writes the manager records in GameState (manager_records); reads schedule, table and
|
||||
// prediction data for the forecast. Draws no random numbers.
|
||||
// Interface in balance_plan.hpp; monthly bookings of similar figures live in month.cpp / week.cpp.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/environment.hpp"
|
||||
#include "game/balance_plan.hpp"
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Bank credit dialog: loans from the bank or from another manager, held in the per-manager loan
|
||||
// matrix of the manager records. Implements the amount/fee/monthly-payment arithmetic (with the
|
||||
// original's extended-precision rounding emulated in integers), draft editing with bounds, and
|
||||
// the interest-rate change. Reads the manager records and executable tables via BankCreditContext;
|
||||
// only change_bank_credit_interest writes GameState here. Draws no random numbers.
|
||||
// Types are declared in bank_credit.hpp.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/bank_credit.hpp"
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Interface of the bank credit dialog: context (rate table, liquidity, saved loan row), draft,
|
||||
// edit and bounds types plus the projection/edit functions implemented in bank_credit.cpp.
|
||||
// Case "bank" and case "another manager lends" share these types; projection and draft editing
|
||||
// are read-only with respect to GameState. No random numbers are drawn.
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Per-manager guard against repeated bank robbery events: one blocked month key per manager,
|
||||
// stored in an OpenBMH-owned extension block of the static memory in GameState (not in the
|
||||
// original save fields). The month key function is implemented in week.cpp.
|
||||
// Header-only accessors; no random numbers are drawn.
|
||||
#pragma once
|
||||
#include "game/state.hpp"
|
||||
#include <limits>
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Calendar epoch (start year and weekday of the season calendar), read from the date setup code
|
||||
// of the loaded executable image. Unknown or unverified setups are rejected with FormatError.
|
||||
// Holds one process-wide installed epoch; reads no GameState and draws no random numbers.
|
||||
// Declared in calendar.hpp.
|
||||
#include "game/calendar.hpp"
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "formats/le.hpp"
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Interface for the calendar epoch (start year and weekday) used for date calculations.
|
||||
// calendar_epoch_from_executable validates the loaded executable, install_calendar_rules makes it
|
||||
// active, calendar_epoch returns it (a synthetic default for isolated test states).
|
||||
// Implemented in calendar.cpp; no GameState access and no random numbers.
|
||||
#pragma once
|
||||
namespace bmh {
|
||||
class LeImage;
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Start of a new career: league strength ranges read from the executable, generation of players
|
||||
// (startup squads, the extra and market players), initial club moods and markets, the starting
|
||||
// state built from the data files, plus new-manager setup (stadium, sponsors, competition blocks).
|
||||
// Writes most of GameState (players, squad_slots, memory, manager records).
|
||||
// Draws from both generators: WatcomRandom for attributes and levels, GameRandom for the
|
||||
// reseeding done by stir_random and the mood reset.
|
||||
// Interface in career.hpp; the season-wide steps follow in season.cpp.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/career.hpp"
|
||||
#include "game/lineup.hpp"
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Club information screen preparation: sets the line-up markers (first eleven / bench) in the
|
||||
// club's squad_slots, clears markers of injured players and applies the chosen player category.
|
||||
// Reads players and squad ranges, writes squad_slots in GameState. Draws no random numbers.
|
||||
// Interface in club_info.hpp; line-up rules themselves are in lineup.cpp.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/club_info.hpp"
|
||||
#include <stdexcept>
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Player detail screen opened from a club squad or the market pool: resolves the selection to a
|
||||
// squad slot, builds the context (loans, national nomination mode, pending offers) and runs the
|
||||
// actions the screen offers (market value, add to national squad, offers).
|
||||
// Reads and writes players, squad_slots and manager data in GameState.
|
||||
// Draws from WatcomRandom (market value, adding to a squad) and reseeds both generators via
|
||||
// stir_random. Interface in club_player_detail.hpp; related code in national.cpp and weekly.cpp.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/club_player_detail.hpp"
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Interface of the player detail screen: selection and context types (squad vs market pool row,
|
||||
// loan data, national mode) and the functions implemented in club_player_detail.cpp.
|
||||
// Context building is read-only; actions take both generators (GameRandom, WatcomRandom) and
|
||||
// a MinuteReport, as documented at each declaration below.
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Cup competitions: Masters qualification, replay lists, group tables and qualifiers, friendly
|
||||
// preparation, national tournament end and the draw/advance step advance_cup for each round.
|
||||
// Works on the cup entries in the static memory of GameState and on MatchGroup results.
|
||||
// Draws from WatcomRandom (tie ordering) and GameRandom (shuffling the Masters field).
|
||||
// Interface in cup.hpp; matchday_setup.cpp creates the matches, driver.cpp and season.cpp are neighbours.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/cup.hpp"
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Entering a human manager's desk: desk button table per game mode, the random stir, the table
|
||||
// prediction messages, the autosave hook and the manager's prestige (weighted sum of ratings and
|
||||
// money). Reads and writes manager records and the mailbox in GameState.
|
||||
// Draws from WatcomRandom (the four save draws) and reseeds both generators via stir_random.
|
||||
// Interface in desk.hpp; called from turn.cpp before each desk.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/desk.hpp"
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Interface for entering a human manager's desk (the part before the desk screen appears):
|
||||
// enter_desk, the draws made when saving, and the prestige update.
|
||||
// Implemented in desk.cpp; uses both generators (GameRandom, WatcomRandom) as documented below.
|
||||
#pragma once
|
||||
// Entering a human manager's desk (DeskDate, the part before the desk screen).
|
||||
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Actions a human manager can take at the desk: friendly match quotes and booking (including
|
||||
// the national team variant), training camp configuration, and the transfer offer editor
|
||||
// with bids and market previews.
|
||||
// Reads and writes manager records, memory (friendly plan, calendar), players and squad_slots.
|
||||
// Quotes draw from WatcomRandom on a staged copy that is committed only when accepted; booking
|
||||
// also handles GameRandom. Interface in desk_actions.hpp; bids are settled in weekly.cpp.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/desk_actions.hpp"
|
||||
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Match day driver: plays the minutes of all match groups of a matchday in phases (first half,
|
||||
// second half, extra phases), shows or hides screens per button table and handles the phase end
|
||||
// (cup tie decisions, results, reseeding via stir_random).
|
||||
// Works on MatchGroup lists, GameState and the MatchEngine of match_engine.cpp.
|
||||
// Passes both generators on to the engine; itself only reseeds them at phase end.
|
||||
// Interface in driver.hpp; neighbours are matchday_setup.cpp and season.cpp.
|
||||
#include "game/driver.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Club environment budgets of a human manager (youth teams, academy, co-trainer, doctor,
|
||||
// physiotherapist): monthly cost per level, setting a level, and the youth team results and
|
||||
// season handover. Reads and writes the budget and youth blocks in the static memory of GameState.
|
||||
// advance_youth_teams draws from WatcomRandom; setting levels draws nothing.
|
||||
// Interface in environment.hpp.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/environment.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Interface for the club environment budgets (youth teams, academy, co-trainer, doctor,
|
||||
// physiotherapist): item enum, monthly cost steps, state view and the functions implemented in
|
||||
// environment.cpp. Setting a level draws no random number; youth match results use WatcomRandom.
|
||||
#pragma once
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// High-score table of the game: computes a manager's score from his record (assets, history,
|
||||
// titles), builds projections of the ranked table and reads/writes the five-row score file bytes.
|
||||
// Reads manager records in GameState; the file images are passed in and out as bytes.
|
||||
// Draws no random numbers. Interface in highscore.hpp.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/highscore.hpp"
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Interface of the high-score table: row/table/projection types and the scoring and file
|
||||
// functions implemented in highscore.cpp. Names keep the original text encoding.
|
||||
// Reads GameState only; no random numbers are drawn.
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Types for completing the sale of a player to a human buyer (allocator gate, direct mode,
|
||||
// result status). The unsaved observations named here are supplied by the caller; missing
|
||||
// evidence means "unsupported", never an implicit default.
|
||||
// The matching settle_human_buyer_sale function is implemented in weekly.cpp and takes WatcomRandom.
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// League pairings screen: the fixture view of a league round (filtered, postponed and per team),
|
||||
// paging preferences and the computer tip (predicted results) for the shown round.
|
||||
// Reads and writes GameState (memory preferences, squad data) through the screen owner struct.
|
||||
// Computer tips use the game generator; closing the screen reseeds both generators via
|
||||
// stir_random. Interface in league_pairings.hpp; the tip arithmetic is shared with source_tip.cpp.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/league_pairings.hpp"
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Interface of the league pairings screen: constants, owner state, tip result and view types
|
||||
// and the open/move/close functions implemented in league_pairings.cpp. No mutator here calls a
|
||||
// presenter, advances a day or saves; generators are passed in by the caller where needed.
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Line-up rules: position types per formation depth, player suitability values, automatic
|
||||
// line-up for computer teams and the optimizer for human boards, plus preparing the line-up
|
||||
// entry of a team. Reads players, formations and tactics boards; writes squad_slots and boards.
|
||||
// Draws from WatcomRandom in two places of the automatic selection (see the rand calls below).
|
||||
// Interface in lineup.hpp.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/lineup.hpp"
|
||||
#include "formats/le.hpp"
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Long-career extension: per-club player statistics (appearances, goals, assists) and title
|
||||
// history archives kept in an OpenBMH extension block outside the original save fields, with
|
||||
// encoding to and decoding from bytes for saving.
|
||||
// Reads and writes GameState (memory extension, manager records). Draws no random numbers.
|
||||
// Interface in long_career.hpp.
|
||||
#include "game/long_career.hpp"
|
||||
#include "game/state.hpp"
|
||||
#include "formats/executable_layout.hpp"
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Interface of the long-career extension block (extension id, statistics and title history
|
||||
// archive types, record/reset/swap functions and encode/decode) implemented in long_career.cpp.
|
||||
// No random numbers are drawn.
|
||||
#pragma once
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Per-match environment values of the match engine: weather and temperature by month and region,
|
||||
// crowd bonus for the home side, and the start-of-match tactics choice for computer teams.
|
||||
// Reads GameState (clubs, month, spectators); the match state is filled by the caller.
|
||||
// Draws from WatcomRandom (weather, crowd, substitution mode); the minute simulation itself is
|
||||
// match_engine.cpp. Interface in match.hpp.
|
||||
#include "game/match.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Minute-by-minute match simulation: chances and goals, shooter/assistant/taker picking,
|
||||
// fouls, cards, injuries, substitutions and tactics changes, producing a MinuteReport per minute.
|
||||
// Reads and writes the match state in GameState and the MatchGroup fixtures it was built with.
|
||||
// Draws from both generators (WatcomRandom and GameRandom); the draw counts are compared with
|
||||
// recordings in regression tests.
|
||||
// MatchEngine is declared in match_engine.hpp; driver.cpp calls it.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/match_engine.hpp"
|
||||
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Matchday processing shared by all competitions: match results into club tables, cards and
|
||||
// statistics, bonus payments, morale and player development after a match, league screens
|
||||
// and rating of the manager, plus stir_random (reseeding both generators).
|
||||
// Reads and writes GameState (players, tables, manager records, memory).
|
||||
// Draws from GameRandom and WatcomRandom as named at each use below.
|
||||
// Interface in matchday.hpp; the matches are set up in matchday_setup.cpp and played in driver.cpp.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/environment.hpp"
|
||||
#include "game/matchday.hpp"
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Matchday setup: builds the match groups of a calendar day (descriptors, teams, weather,
|
||||
// attendance and catering income, winter postponements, indoor tournament, live match choice,
|
||||
// kick-off) and the football pools coupon.
|
||||
// Reads and writes GameState (memory descriptors, squad_slots, manager records).
|
||||
// Draws heavily from WatcomRandom and also from GameRandom (see the calls below).
|
||||
// Interface in matchday_setup.hpp; results are handled in matchday.cpp and driver.cpp.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/matchday_setup.hpp"
|
||||
#include "game/trace.hpp"
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Mailbox and text helpers: posting messages to managers, looking up message texts and
|
||||
// formatting numbers with the original's flag conventions.
|
||||
// Reads and writes the mailbox of GameState and reads the text tables installed from the
|
||||
// executable. Draws no random numbers. Interface in messages.hpp.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/messages.hpp"
|
||||
#include "game/schedule.hpp"
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Monthly processing: new transfer list entries and free agents, return of loans, monthly expenses
|
||||
// and income, shares and loans, market value and contract demands/offers/bonuses, and the
|
||||
// month change itself.
|
||||
// Reads and writes GameState (transfer list in memory, squad_slots, players, manager records).
|
||||
// Draws from WatcomRandom (list generation, demands); no GameRandom draws are made here.
|
||||
// Interface in month.hpp; called from turn.cpp, weekly steps are in weekly.cpp.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/environment.hpp"
|
||||
#include "game/month.hpp"
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// National team: nomination of players, swapping the national coach record into the spare
|
||||
// manager slot on international days, adding players to a squad and creating board entries.
|
||||
// Reads and writes GameState (manager records, tactics boards, squad_slots, static bytes).
|
||||
// Draws from WatcomRandom when creating board entries and values. Interface in national.hpp;
|
||||
// called from turn.cpp.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/national.hpp"
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// "Other games" desk view: rows of the results and fixtures of a competition round (group or
|
||||
// knockout), linked pages and club metadata for display. A read-only projection of GameState
|
||||
// and the loaded texts; the parameter named game is the GameState, not a random generator.
|
||||
// Draws no random numbers. Interface in other_games.hpp.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/other_games.hpp"
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Interface of the "other games" view: row, club metadata and page types and the const
|
||||
// projection functions implemented in other_games.cpp. Read-only; no random numbers are drawn.
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Types for answering pending transfer offers manually (yes / no / unsupported answers, the
|
||||
// question and dispatch context, allocator gate). Absence of an answer never means "no".
|
||||
// Declarations only; the generators are passed in by the caller as shown below.
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Poaching a player from another club: asking percentage of the club, remaining attempts per
|
||||
// manager and the start and finish of a poach attempt.
|
||||
// Reads and writes GameState (manager records attempt list, transfer list in memory, squad_slots).
|
||||
// Draws from WatcomRandom. Interface in poach.hpp.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/poach.hpp"
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Table prediction and season bonus: predicted final league position of a team, the season
|
||||
// bonus paid to a manager and the expected bonus for players.
|
||||
// Reads GameState (tables, tactics boards, manager records); season_bonus can book the payment.
|
||||
// Draws no random numbers. Interface in prediction.hpp; included by desk.cpp and balance_plan.cpp.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/prediction.hpp"
|
||||
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Player and team ratings: player_value weighs selected attributes (condition, technique,
|
||||
// skills, form) and team_rating adds corrections for human managers' players and per-position terms.
|
||||
// Reads players and tactics boards in GameState; the generators come from the RatingContext.
|
||||
// Draws from WatcomRandom through that context in the human-board corrections and for teams
|
||||
// without squads. Interface in rating.hpp.
|
||||
#include "game/rating.hpp"
|
||||
|
||||
#include <array>
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Reality scene, ball decisions: shot or pass choice and scoring, blockers on a path, duel and
|
||||
// dribble outcomes and applying the result to the scene.
|
||||
// Reads GameState (players, tactics) and the RealitySetup; mutates the owned scene structures.
|
||||
// Draws from WatcomRandom (and takes GameRandom as a parameter). Interface in reality_ball.hpp;
|
||||
// driven by reality_scene.cpp.
|
||||
#include "game/reality_ball.hpp"
|
||||
#include "game/reality_duel.hpp"
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Interface of the Reality scene ball logic: ball history, decision and outcome types and the
|
||||
// decide/apply functions implemented in reality_ball.cpp. The functions take WatcomRandom (and
|
||||
// GameRandom where declared).
|
||||
#pragma once
|
||||
|
||||
#include "game/rating.hpp"
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Reality scene, fouls and duels: decides whether a duel ends in a foul, whistle, card or
|
||||
// injury, and the follow-up steps of the scene. Executes the forced event callback supplied by the
|
||||
// caller instead of substituting a default.
|
||||
// Reads GameState and the RealitySetup; draws from WatcomRandom. Interface in reality_duel.hpp.
|
||||
#include "game/reality_duel.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Interface of the Reality scene foul/duel logic: forced-event and sound callbacks, foul cue and
|
||||
// result types, implemented in reality_duel.cpp. Draws use WatcomRandom as declared below.
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Bridge between one real match of the match engine and the Reality scene: validates that the
|
||||
// engine, generators and fixture still own the scene, advances the scene and settles deferred
|
||||
// substitution requests when it ends.
|
||||
// Works on the MatchEngine state and its two generators; the draws are made by the scene code
|
||||
// it calls (reality_scene.cpp). Interface in reality_match.hpp.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/reality_match.hpp"
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Interface of the Reality match bridge: deferred request and RealityMatchScene types and the
|
||||
// settle function implemented in reality_match.cpp. Requests survive scene end and run later.
|
||||
#pragma once
|
||||
|
||||
#include "game/match_engine.hpp"
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Reality scene geometry and motion: direction quantisation on the pitch grid, projection to
|
||||
// screen positions from the executable's tables, per-figure motion, paths and grid placement.
|
||||
// Independent of GameState and draws no random numbers. Interface in reality_motion.hpp.
|
||||
#include "formats/executable_layout.hpp"
|
||||
#include "game/reality_motion.hpp"
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Interface of the Reality scene motion layer: figure motion and path types, grid and the
|
||||
// functions of reality_motion.cpp. Deliberately independent of GameState and both generators.
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Reality scene, player movement: speed of a figure, movement context for the ball decision,
|
||||
// attacker and defender moves and the defensive push.
|
||||
// Reads GameState (players) and the RealitySetup; draws from WatcomRandom.
|
||||
// Interface in reality_movement.hpp; driven by reality_scene.cpp.
|
||||
#include "game/reality_movement.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
// Interface of the Reality scene movement layer: per-iteration move context and the attacker/
|
||||
// defender move functions implemented in reality_movement.cpp (WatcomRandom as declared below).
|
||||
#pragma once
|
||||
|
||||
#include "game/reality_space.hpp"
|
||||
|
||||
Loaded 100 of 324 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user