Commit Graph
64 Commits
Author SHA1 Message Date
ClaudeandClaude 8a37be898a Split the window program into files by topic
struct App moves out of main.cpp into app/app.hpp (state and declarations;
the return types are spelled out now, taken from the compiler) and its 94
member functions into
  app_run.cpp         handle() and run(): wiring, title screen, event loop
  app_live.cpp        live match, interventions, event animations, reality mode
  app_transfer.cpp    offers, decisions, market sales, loan returns, poaching
  app_season.cpp      season end and start: tax, promotion, highscore, cup draw
  app_services.cpp    timers and deadlines served between inputs
  app_club.cpp        the club dialogs
  app_sportschau.cpp  the Sportschau
  app_notices.cpp     notices and questions over a screen
main.cpp keeps main(): game data, window, sound (238 lines instead of 4,550).
The function bodies moved unchanged. docs/DIFFERENCES.md is regenerated (a
marker moved to app_run.cpp).

Verified: 211 of 211 tests; careers, UI walk and robot (234 commands)
identical; long robot run (52 kick-offs to April of the season, indoor
tournament included): every desk picture identical.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-10 19:45:58 +01:00
ClaudeandClaude c8dee2c377 App::run: the hook presenters are named members
run() assigned 16 presenter lambdas to the hooks before it showed the title
screen. They are member functions now (present_sportschau_intro,
present_matchday_intro, present_sportschau_replay_step,
present_sportschau_scene, present_competition_winner, present_tax_event,
present_promotion, club_information_dialog, club_player_dialog,
player_detail_dialog, club_statistics_dialog, select_poach_player,
present_cup_draw, ...); run() assigns a forwarding lambda and keeps 437 of
1,240 lines: the wiring, the title screen, the event loop and the tear-down.
The bodies moved unchanged.

Verified: robot (234 commands), UI walk, 9 careers identical; 211 of 211
tests.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-10 18:09:02 +01:00
ClaudeandClaude 99200f1dc8 App::handle: the presenters passed to the controller are named members
handle() was 1,628 lines: the call of serve_flow_request with 22 presenter
lambdas written inline. They are member functions now (present_live_minute,
observe_live_minute, animate_ball / chance / shot / set_piece / booking /
shootout, present_reality, choose_transfer_offer, present_transfer_decision,
present_season_checkpoint, show_club_information, ask_advertising_renewal,
ask_national_friendly, ...), as are its two local helpers
(present_live_lineup, present_running_overview). handle() keeps 111 lines.

handle() is never re-entered (its callers are the service functions and
run(), none of which is reached from inside it), so its ten locals became
members that handle() resets where they were declared. The bodies moved
unchanged.

Verified: robot (234 commands, live match included), UI walk, 9 careers
identical; 211 of 211 tests.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-10 17:59:40 +01:00
ClaudeandClaude 71aeb7cc61 main.cpp: struct App with one member function per presenter
main() held the whole window program in one function of about 4,300 lines:
the state as locals and 53 presenters and services as lambdas capturing
them. Now main() only sets up the game data, the window and the sound (40
statements) and runs App:
- the objects main() created are reference members under their old names,
- the state between the former lambdas are members,
- every former top-level lambda is a member function, in the original order
  (present_season, show_tax, wait_sportschau_ack, present_live_lineup,
  service_family_table, ...),
- App::run() holds the statements that stood between them: wiring of the
  hooks, title screen, event loop, tear-down.
The code inside moved unchanged. Three hook variables that were initialised
with a lambda are assigned in run(); five presenters that are passed on as
values get a forwarding lambda.

This makes the presenters addressable: the next steps move them into files
of their own, which is also the seam for replacing screens one by one.

Verified: robot (234 commands: title, new career, season start, every desk
icon, two matchdays with the live match), UI walk, 9 careers identical;
211 of 211 tests.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-10 17:05:10 +01:00
ClaudeandClaude 2173915d20 app/canvas.hpp: Canvas::show replaces 24 copies of "picture to window"
main.cpp spelled out the same six statements wherever a presenter showed a
picture: convert with the palette, update the texture, clear, copy, present.
They are now canvas.show(image, palette), in the same order and with the
same handling of SDL errors. Presenters that check the SDL calls or update
only a part of the texture keep their own code.

Verified with the robot (234 commands, identical), the UI walk, the careers
and 211 of 211 tests.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-10 16:13:00 +01:00
ClaudeandClaude ff32ef1dbc Robot: play the window program from a script, for regression tests
A test hook for src/app/main.cpp, which the headless tools bypass. With
OPENBMH_ROBOT=<script> and OPENBMH_ROBOT_LOG=<file> (usually with the SDL
dummy video and audio drivers) the game reads clicks and keys from the script
instead of the mouse, waits after each command until the picture has settled
and writes its fingerprint; OPENBMH_ROBOT_SHOTS=<dir> also saves the pictures.
The events go through SDL's queue, so they take the path of real input.

Hooks: app::present() replaces the 31 SDL_RenderPresent calls of main.cpp,
QuitConfirmation::poll() lets the robot queue its next command when no input
is waiting, and a robot run answers the quit question itself. Without the
environment variables nothing changes.

Verified: a script of 234 commands (title, new career, season start
presentations, every desk icon, two matchdays with the live match) gives the
same file in three runs; 211 of 211 tests; careers and UI walk identical.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-10 15:36:08 +01:00
ClaudeandClaude b7f748688c Controller: one named handler per request instead of a 2,000 line function
serve_flow_request was one function of about 2,000 lines with 53 branches.
Its body now lives in FlowRequestServer: the arguments as reference members
under their parameter names and one member function per kind of request
(open_league_table, handle_bank_action, play_matchday, handle_savegame_file,
open_manager_join, ...). serve() asks the handlers in the original order and
keeps the guards between them. The code of every branch moved verbatim; six
lambdas that captured a parameter by name now use an init-capture of the same
object.

This is also the first step towards replacing screens one by one: a request
kind has a name and one place.

Verified: 211 of 211 tests; 9 headless careers and the UI walk (German and
English, about 5,460 steps each) identical.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-11-10 15:06:07 +01:00
ClaudeandClaude Sonnet 5.5 23201fa637 The confirmation of a transfer decision shows OK pressed while held
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 18:54:57 +01:00
ClaudeandClaude Sonnet 5.5 b6bc17a381 Team premiums and the manager confirmation show pressed buttons
The back, send and switch buttons below the contract offer and team premium
panels and JA/NEIN of the manager confirmation are drawn pressed while the
mouse button is held, using the shared frame of ui/button_frame.hpp.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 17:49:57 +01:00
ClaudeandClaude Sonnet 5.5 fb72de3895 Buttons without a lasting state look pressed while the mouse button is held
Bank (stocks, property, savings, credit), the offer editor footer, the lineup
bottom buttons and the pitch page buttons Daten and Kurz are drawn in the
pressed look from the mouse press until the release, like the friendly match
question. The frame drawing is shared in ui/button_frame.hpp.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 17:28:40 +01:00
ClaudeandClaude Sonnet 5.5 6aa7c4f4a2 Ask whether to take a listed player off the market when selling him
VERKAUFEN on a player who stands on the transfer list only showed a message
when no offer had arrived yet. The original first asks whether the player
should be taken off the transfer market: yes frees the list slot (the player
stays in the squad), no continues to the offers. Controller and UI tests cover
both answers.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 12:57:27 +01:00
ClaudeandClaude Sonnet 5.5 9286428a5a Remove an executable address from a comment (public tree check)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 10:16:25 +01:00
ClaudeandClaude Sonnet 5.5 fbb2ab66b0 Transfer market review fixes: pressed buttons, scouting message, poaching agreement notice, visible refusal reasons
- The notice dialog refused Source notices it did not know, which silently refused the whole action: the agreement of a
  poached player ("Ihr erstes Angebot wird angenommen!") made the Angebot button of the Abwerben dialog fail, and the new
  search boxes never appeared. Both text families are known now; the test turns every notice of the transfer routes into
  its dialog like the graphical client does.
- Suchen/Vorschlag/Abwerben and the other market buttons are drawn pressed while the mouse button is held.
- Confirming the search dialog first reports "Ihre Scouting-Abteilung ..." (text 0xAF25C) as in the original, then the matches.
- A refused transfer or offer action shows its reason, writes it to stderr and the debug log.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-08 10:10:42 +01:00
ClaudeandClaude Sonnet 5.5 0a95dbcba6 Transfer market: the search dialog behind Suchen and Vorschlag; asking fee display follows Diamond 3.7
TransferMarketScreen gets the dialog of the original (KB/69.VGA panel at 184,20, seven bar rows from the
EXE table, click rules of sub_19409, confirm button, price estimate). Suchen opens it with the stored
profile, Vorschlag with the suggestion the squad asks for (computed in the projection). Closing posts a
store_search_profile request; the controller stores it and announces the matching listings through the
notice presenter, like the original's message boxes. Right button or Esc leaves with the search switched
off. Controller test drives the whole route.

The market list showed the asking fee scaled by 0x30d4 (older Diamond); 3.7 rounds to 10000
(sub_3C940), now also in the projection. Four tests computed the old base and follow.

Fixes #79

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 22:04:33 +01:00
ClaudeandClaude Sonnet 5.5 b2484350d9 Search profile: session API and console commands (ShowSearchProfile, SuggestSearchProfile, SetSearchProfile)
CareerSession gets search_profile, suggest_search_profile and dispatch_search_profile (owner and
modal-state checks, revision only when the stored profile changed). The console replaces the
OpenSearch placeholder with three commands and documents them; with apply the matching listings
are reported with the original's "Spieler ... ist interessant!" message. search_profile_valid
separates a refused profile from a switched-off one.

Part of #79 (the dialog in the graphical client is still open)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 21:35:02 +01:00
ClaudeandClaude Sonnet 5.5 e9ba514a65 Graphical client: answer the poaching yes/no questions (ANGEBOT in the Abwerben dialog)
The engine asks the selling manager and the buyer a yes/no question when a poaching offer
is decided (hooks.confirm). The graphical client only supplied the notice presenter, so the
engine refused the offer, the controller swallowed the reason and the ANGEBOT button appeared
to do nothing. The client now shows the question with the existing yes/no dialog.

Fixes #80

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 21:22:00 +01:00
ClaudeandClaude Sonnet 5.5 93ca832c71 Hold back live chance statistics until the result of the chance
Prepare verified release / draft (push) Waiting to run
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 15:09:38 +01:00
ClaudeandClaude Sonnet 5.5 73af2a657d Explain the stadium, transfer, contract and application code in comments
Function and section comments for ui/stadium, ui/preparation_flow, the
transfer market, contract, outgoing and incoming transfer screens, and for
app/main, app/window_actions and app/desktop_actions. Comment lines only;
full build and runnable tests unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-06 11:21:31 +01:00
ClaudeandClaude Sonnet 5.5 e088704dff Explain the UI flow, controller and career session in comments
Function and group comments for ui/flow, app/controller and app/career_session:
the request/acknowledge model, the revision and identity checks, staged copies
that are committed on success, and the national-coach desk identity. Comment
lines only; full build and runnable tests unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-06 10:11:48 +01:00
ClaudeandClaude Sonnet 5.5 287b5a9251 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>
2026-11-06 09:15:23 +01:00
ClaudeandClaude Sonnet 5.5 8780d7b5a5 Show JA pushed in briefly when the manager selection is confirmed
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-05 21:11:01 +01:00
ClaudeandClaude Sonnet 5.5 7cc7c3a7ea Fix Other Games and Top Scorers on the national-coach desk
Both screens are identified by the home club in the session; the desktop
check compared against the desk's own runtime club identity after the earlier
Table/Strengths fix, so the national desk was rejected as stale.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-05 12:27:29 +01:00
ClaudeandClaude Sonnet 5.5 fcd6eb9204 Club information may enter the club on every redraw
The table's club information (TeamInfo) enters the club again on each
redraw: view toggle, statistics, player card. The session required
exactly one entry and discarded the whole visit otherwise, also the
Nein/Radio/Video setting made in it, so a computer match could not be
set to Video. One entry is now the minimum.

Checked with a probe on a real savegame: table, club, two entries and
Video leave the category set.

Refs #75, #77.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-05 10:25:44 +01:00
ClaudeandClaude Sonnet 5.5 16ae7df7f8 Joined manager sees his next opponent; club detail error names the access
- Joining a manager: the next opponent of every manager is captured per
  day for that day's manager count, so the joined manager's desk showed
  "Spielfrei" until the next day was prepared. It is captured again when
  the join is committed.
- The club player detail's atlas error now names the access and the
  atlas size, so the debug log shows what failed.

Refs #76, #77.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-05 10:10:34 +01:00
ClaudeandClaude Sonnet 5.5 b8a37353cc Opponent badge follows the day; Table and Stärken at the national desk
- Desktop: the opponent's badge sheet was loaded once when the screen
  was built and kept while the state advanced, so the index of the new
  opponent picked a badge from the old sheet (a foreign club's logo, the
  wrong club for RB Leipzig). It is reloaded with every new state.
- National desk: the desk keeps the home club's key per manager (for
  the hand-back), while Table, Stärken, Other games and the other pages
  carry the identity of the runtime club (the national team). The
  controller and flow compared the two and refused ("invalid Table
  dispatch manager identity", "stale desktop identity"). DeskState now
  gives session_identity_key() and the comparisons use it.

Refs #74.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-05 09:50:22 +01:00
ClaudeandClaude Sonnet 5.5 7cfc8267b6 Calendar and results-page Stärken work during a running career
Found with the debug log and savegames of a real session:

- Calendar: it read the memory copies of the season origin and day,
  which hold only the day the game was loaded or saved, and refused
  from the first kickoff on ("saved native season cursor disagrees").
  It now uses the live values, as the reschedule code does. This also
  fixes "Spiel verlegen".
- Stärken: the guard of dispatch_strengths required a desk stage, but
  the turn driver marks the running turn as Failed (replay guard) for
  its whole duration, so Stärken could never open from the live
  overview or the end-of-phase results page; the failed handover then
  left the other pages with stale owners and the match stuck. The
  guard now accepts the running turn while a live overview is open.
- Tests: calendar after a kickoff; live overview handovers on the
  phase results page.

Refs #71, #73.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-05 08:28:45 +01:00
ClaudeandClaude Sonnet 5.5 38f69fa37b Fix save loading at the national desk, calendar colours, pointer size; add -debug
- Loading: a single-manager desk saved with DeskPosition == ManagerCount
  (the completed loop) is read as the first desk again instead of being
  refused as "not a savegame".
- Calendar: text takes the original's six-row colour gradient (the flat
  colours were too dark next to the original).
- Pointer: sized in window points, so it is not doubled on Retina screens.
- Settings: the page names OpenBMH and shows the build version below.
- Desk: the opponent's badge is shown whenever the data has one
  (documented difference); cup-only teams keep the computer portrait.
- Live overview tests: Tabelle/Stärken/Spiele handovers, also with the
  Spiele page opened first.
- New command line option -debug: timestamped log, stderr captured in a
  file, and a savegame after every match day in <saves>/debug.

Refs #63, #65, #67, #68, #71, #73.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-04 22:22:30 +01:00
ClaudeandClaude Sonnet 5.5 1e7df751a0 Describe original routines in comments instead of naming them
The public-source check rejects decompiler symbol names.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-04 20:44:58 +01:00
ClaudeandClaude Sonnet 5.5 af634ae8ff Fix settings switches, training skill bars, editor placement and pointer
- Settings: every unlocked switch is stored, as in the original; the
  whitelist of cells with a consumer is gone (J9, O3, ... no longer
  refused). Locks and 0/1 / numeric limits still apply.
- Training: the seven skill bars show the player row under the pointer
  (FUN_00049399).
- Line-up: the field stays editable inside the set-piece editor while no
  taker kind is chosen.
- Pointer: the original 11x11 bitmap is the default pointer on every
  page, not only on the pitch page.

Refs #57, #59, #60, #62.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-04 19:44:46 +01:00
Codex d661ec5eb0 Honor Original visible league counts for fresh Classic managers (by Codex) 2026-11-02 23:28:05 +01:00
Codex fcb6ac14bb Refuse malformed widget formation before desktop projection (by Codex) 2026-11-02 17:47:49 +01:00
Codex f44de65e22 Handle unframed desktop admission and automation controls (by Codex) 2026-11-02 17:37:26 +01:00
Codex 8b1dc16233 Fix unframed desktop date and folder input (by Codex) 2026-11-02 16:14:11 +01:00
Codex 6f33f9c155 Fix safe save overwrite activation by double-click (by Codex) 2026-11-02 16:13:01 +01:00
Codex 9c82cb16b5 Embed supplied high-resolution Classic start artwork (by Codex) 2026-11-02 02:24:56 +01:00
Codex c6341aa4f9 (by Codex) Import verified Diamond 3.7 native save containers 2026-11-01 19:39:08 +01:00
Codex 8862bd4f89 Require an owned mouse release in transfer modals (by Codex)
Late or repeated releases from a post-match table cannot decline the immediately following transfer or acknowledge its confirmation. Track presses within each release-driven modal; keep semantic Source DOWN actions and fresh left/right gestures. Reproduced and verified through the real post-match table-to-transfer GUI flow.

Refs: #44
2026-11-01 19:19:21 +01:00
Codex 540178b264 Synchronize match reveals and restore pitch input feedback (by Codex)
Hold scoreboard digits through chance animations, retain overview gesture ownership through moved releases, and restore original affinity swatches and colored pointer from each edition. Preserve simulation and RNG boundaries; cover source observer and UI projections.

Refs: #43, #44, #45
2026-11-01 18:03:53 +01:00
Codex 8baf80564a (by Codex) Fix seller transfer review and fresh-arrival contract flags 2026-11-01 17:57:55 +01:00
Codex 70082ef825 (by Codex) Keep static title responsive to window redraw and Escape 2026-11-01 17:55:16 +01:00
Codex 777039832d (by Codex) Wait for a complete mouse click on the static title 2026-11-01 17:55:16 +01:00
Codex fc07e45bbc (by Codex) Render opening artwork with its supplied embedded palette 2026-11-01 17:55:16 +01:00
Codex 7482697248 (by Codex) Preserve exit confirmation during original opening screens 2026-11-01 17:55:16 +01:00
Codex 7b5cd6988e Extend edition-aware stadium blocks to 144k with scaled build periods (by Codex) 2026-11-01 17:55:16 +01:00
Codex c8ae7a31d2 (by Codex) Restore original startup screens and edition runtime defaults 2026-11-01 17:37:48 +01:00
Codex 184a421512 Fix automation preview, desktop drag highlight and macOS keyboard startup (by Codex) 2026-10-30 23:13:44 +01:00
Codex d43d09a378 Read the original edition calendar for gameplay, desktop and saves (by Codex)
Prepare verified release / draft (push) Waiting to run
2026-10-30 18:02:52 +01:00
Codex e432f20ae7 Focus the community repository and documentation on the original game (by Codex) 2026-10-30 16:18:00 +01:00
Codex 8ee062ea46 Prepare Classic 1.0 edition rules and Diamond 3.7 foreign crests (by Codex) 2026-10-30 15:39:56 +01:00
Codex c293a35f56 Backport original message installation for Classic standalone tools (by Codex) 2026-10-30 14:22:18 +01:00