Skip to content

Options screen as the original's; player options kept in the profile - #87

Closed
MortenLyhr wants to merge 5 commits into
bssth:masterfrom
MortenLyhr:fix/options-screen
Closed

MortenLyhr wants to merge 5 commits into
bssth:masterfrom
MortenLyhr:fix/options-screen

Conversation

@MortenLyhr

@MortenLyhr MortenLyhr commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

What it changes

Player options are kept, as in the original. The original keeps the Game tab's options (Wait at End of Turn, Quick Combat, Automated Workers Leave Forests, …) in the player's profile (Profiles/<name>.pfl). The game core sends the profile's options to the active player at the first update of every game, new or loaded (CvGame::sendPlayerOptions; m_bPlayerOptionsSent isn't saved), and again at each hot-seat switch. So a save's own options are overwritten by the profile's.

OpenCiv4 gave the game core the XML defaults for a new game and the save's own options after a load (setProfileOptionsFromPlayer), and never wrote them to profile.ini, so every choice was lost at the next game.

  • Utility now holds the profile's player options (profile.ini player.N=, 0 = the XML default). getPlayerOption answers from them, and sendPlayerOption writes into them too, at the main menu as well.
  • oc4options gives them to the host when the profile is read, and writes the file after every control used on the options screen (the original writes its profile at each click). Restore Defaults on the Game tab resets them and sends the defaults to the player.
  • CyUserProfile.getPlayerOption reads the profile, not the active player.

The window looks like the original's (measured on a Wine picture of the same screen with BUG + BULL):

  • The theme's standard window and title bar, with the title at the left.
  • Tabs as wide as their words, from the left, drawn with the theme's tab skins (the chosen one lighter, a baseline under them). This is how oc4wb already draws the WorldBuilder's tool window.
  • Check boxes in the theme's GFC_Control_StandardCheckBox_Style, as the custom game screen draws them. Rows are 31 px (GFC's default control height) and the text is 16 px (the theme's size 3).
  • The boxes are laid out as GFC does it. A box's children are as wide as they need; the space left goes to children that expand (the two columns of player options), or in a column to its spacers (Language at the foot of the panel). Restore Defaults and Exit are centred and sized to their words, and empty panels take no room.
  • BUG's own options screen (14 tabs) uses the same code and looks better for it.
  • CyGTabCtrl.setActiveTab / getActiveTab work, so a script can open a tab.

OpenCiv4's own options get a tab of their own. Pan the map with W A S D, End idle turns automatically, and Scroll the map at the screen edge were on the Game tab, which the original doesn't have. They are now on a fifth tab, "OpenCiv4", after the original's four, so the Game tab is the original's.

Profiles the old screen wrote get the defaults it never showed (a4ea00b). Master's options screen showed every player option the profile lacked as off, and saved it so: those profiles have Wait at End of Turn, advisor pop-ups and Sid's tips off though never chosen. With Wait at End of Turn off the game core ends each turn by itself once a unit has moved (CvGame::updateTestEndTurn, as the original), which looked like turns ending on their own. The profile now has version=2; one without it gets, once, the XML's default for the options that are on by default; every other choice stays.

How it was checked

  • ctest passes: 14/14 (macOS, Release), with the new player_options test (oc4options.py with a stand-in host, run by Python 3). It checks:

    • a choice is in profile.ini at once, and the host has it after a restart
    • Restore Defaults resets the options and sends the defaults to the player
    • an older profile gives the defaults
    • a profile the old screen wrote (no version=2) gets the default-on options once, and keeps every other choice
    • the tabs are the original's four plus OpenCiv4, and the Game tab has only the game's options
  • Game results unchanged: --turns 100 --map Fractal --size STANDARD --seed 7 gives the same checksum as master on every turn, ending at D7D43800.

  • In the game (testgames/shots/options/oc4-check.sh, its own Documents folder):

    1. A new game: Wait at End of Turn off, Quick Moves and Quick Combat (Offense) on, then saved.
    2. The program again, a new game: the player has them as chosen. Quick Moves turned off.
    3. The save from step 1 (Quick Moves on) loads with Quick Moves off, the profile's.

    On master, none of this is kept.

  • Pictures: Wine | before | after for each tab in compare-options/.

  • Original saves still load: not affected (nothing in the saves changes).

Pictures (Wine | before | after, BUG + BULL)

Game

Graphics

Audio

Other

The OpenCiv4 tab

Before, a script could not open another tab (setActiveTab did nothing), so the before picture is the Game tab each time.

Left, seen but not done: the tab words are a shade heavier than Wine's; the Graphics tab's vertical divider and the Network panel's background (Other tab) aren't drawn; sliders and radio buttons are still OpenCiv4's simple stand-ins.

🤖 Generated with Claude Code

MortenLyhr and others added 5 commits November 20, 2026 13:50
… OpenCiv4's own options on their own tab

The original keeps the player options in its player profile and sends them to the
active player at the start of every game, new or loaded (CvGame::sendPlayerOptions);
OpenCiv4 used the XML's defaults for a new game and the save's own after a load, and
never wrote them to profile.ini. Now Utility holds the profile's (profile.ini player.N),
a choice sent from the options screen goes into it and is written at once.

The options screen's check boxes get the theme's GFC_Control_StandardCheckBox_Style, as
the custom game screen's; W A S D, idle turns and edge scrolling move to an OpenCiv4 tab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rges cleanly with bssth#85)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ly with bssth#85)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…abs, GFC's box layout

Measured on the original's options screen (Wine, BUG + BULL): the standard window's title bar
with the title at the left, tabs as wide as their words from the left (the theme's tab skins,
the chosen one lighter, a baseline under them), 31 px rows (GFC's default control height),
16 px text, a box's children as wide as they need with the rest to those that expand (the
two columns of player options) or to the spacers (Language at the panel's foot), Restore
Defaults and Exit centred under the panel. Empty panels take no room. CyGTabCtrl's
setActiveTab/getActiveTab work, so a script can open a tab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…owed

Before the player options were kept as choices, the options screen wrote
every player option it had shown, and it showed those the profile did not
have as off. Such a profile has Wait at End of Turn off (and advisor
pop-ups, Sid's tips) though the player never chose it; with Wait at End of
Turn off the game core ends each turn by itself once a unit has moved, so
turns seemed to end on their own.

The profile now has a version (2). One without it gets, once, the XML's
default for the options that are on by default and off there; every other
choice stays, and from then on off is the player's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MortenLyhr

Copy link
Copy Markdown
Contributor Author

One more commit (a4ea00b): profiles saved by the old options screen have Wait at End of Turn (and advisor pop-ups, Sid's tips) off, since that screen showed every player option the profile lacked as off and saved it so. With Wait at End of Turn off the game core ends each turn by itself once a unit has moved (CvGame::updateTestEndTurn, as the original), which looked like turns ending on their own. The profile now has version=2; one without it gets, once, the XML's default for the options that are on by default and off there; every other choice stays. player_options_test.py covers it. ctest 14/14, checksums equal master's (D7D43800).

🤖 Generated with Claude Code

@MortenLyhr

MortenLyhr commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor Author

Included in bundle 4/6, #148, merged there with its own commits and with its conflicts with the other open PRs resolved (the bundle PR lists them). Closing in favour of #148.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant