Skip to content

Options > Other: profiles, the clock and the alarm as the original's; network greyed - #118

Closed
MortenLyhr wants to merge 6 commits into
bssth:masterfrom
MortenLyhr:fix/options-other
Closed

MortenLyhr wants to merge 6 commits into
bssth:masterfrom
MortenLyhr:fix/options-other

Conversation

@MortenLyhr

Copy link
Copy Markdown
Contributor

Stacked on #87 (fix/options-screen): this branch holds its commits, so merge #87 first (or this merges both). Only the last commit (c4ef27a) is new.

The Other tab looked like the original's (#87), but most of it did nothing. Each control was measured in the original (Wine, BUG Mod) and made the same.

Profiles

Before: one profile, profile.ini. The drop-down listed only it, and Create New Profile and Delete Profile did nothing.

The original: one file per profile (Profiles\<name>.pfl), and CivilizationIV.ini's UserProfile names the one loaded at start.

  • Choosing a profile in the drop-down first saves the current one, then loads the chosen one: its player options, graphics, volumes and clock. A popup says "X Profile Loaded!", and UserProfile changes at once.
  • Create New Profile writes the current options under the typed name and makes it the loaded profile.
  • Delete Profile deletes the file. If it was the loaded profile, the first one in the list is loaded.

Now:

  • Profiles are My Games/openciv4/Profiles/<name>.ini, in the same key=value form as before, and profile.ini's UserProfile= names the loaded one.
  • A profile holds what the original's does: the Game, Graphics, Audio and Other tabs and the minimap toggles.
  • profile.ini keeps OpenCiv4's own options (the OpenCiv4 tab and the ini settings). They stay the same whichever profile is loaded, as the ini does in the original.
  • Loading a profile gives its options to the sounds, graphics, game core (player options), minimap toggles and clock.
  • An existing profile.ini becomes the profile openciv4 on first start, so nothing is lost.
  • A name that cannot be a file name is not written, and the last profile is not deleted.

Clock

  • Clock On:
    • setClockOn now marks the clock "just turned on", on every call as the original does, so BUG's NJAGC clock restarts its time/turn alternation. It always returned False before.
    • In the original, BUG's clock shows the time whether or not this is on; only the plain interface reads it. OpenCiv4 does the same, since it is the same Python.
  • getClockText: the original uses the user's Windows time format (06.52 on this Danish Mac in Wine). OpenCiv4 now uses the Mac's own short time format (CoreFoundation CFDateFormatter; 07.08). It was a fixed %H:%M before.
  • 24 Hour Clock: when the format is a 12-hour one, it is written in 24 hours.

Alarm

Before, the alarm only stored its numbers. Now it works as the original's:

  • toggleAlarm(on, h, m) sets it to go off h:m after the current minute.
  • An "Alarm" popup says "Alarm will go off at 7:06 AM." (6:53 with 24 Hour Clock), as in Wine.
  • The boxes show the time left; getAlarmHour / Min give -1 and 0:0 when no alarm is set.
  • The interface clock gets a * in front while the alarm is set (Wine: *06.52).
  • At that minute it plays AS2D_ALARM and shows "RIIIIIIIIING! Time is now …". The alarm is not stored in the profile.

Network

Broadband / Modem write the ini's Bandwidth, which only matters in multiplayer. They are now greyed out, with a tooltip saying OpenCiv4 has no multiplayer, and clicks are ignored. CyGTabCtrl.setEnabled now works.

Not checked in Wine

  • The ring popup itself. In both runs it was queued behind the earlier popup; the text and sound are the game's own (TXT_KEY_MISC_ALARM_GOES_OFF, AS2D_ALARM).
  • A 12-hour interface clock. The runs were in the morning, in a 24-hour locale.

Testing

  • tests/options_other_test.py (new) covers:
    • moving an older profile.ini into a profile, and creating, switching, restarting with and deleting profiles;
    • global options staying put when switching;
    • the clock's mark and formats;
    • setting the alarm, the *, the ring, and the time left;
    • the greyed connection speed.
  • tests/player_options_test.py reads the profile from its new place.
  • On the play branch with BUG + BULL and a copy of the user's profile:
    • the profile moved to Profiles/openciv4.ini with every value kept;
    • the Other tab shows the greyed network choice;
    • setting the alarm shows the popup and *07.10 on the clock.

🤖 Generated with Claude Code

MortenLyhr and others added 6 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>
… network greyed

Measured in the original (Wine, BUG Mod) and made the same:
- Profiles: one file each, Profiles/<name>.ini beside profile.ini (the original's
  Profiles\<name>.pfl), the loaded one named by profile.ini's UserProfile (CivilizationIV.ini's).
  The drop-down loads one (its options to the sounds, graphics, player options, minimap toggles
  and clock), Create New Profile writes the options under the typed name and loads it, Delete
  Profile deletes a file (the loaded one: the first is loaded; the last is kept). profile.ini
  keeps OpenCiv4's own options, the same whichever is loaded; an older profile.ini becomes the
  profile "openciv4".
- Clock: setClockOn marks the clock just turned on (BUG's NJAGC starts over); getClockText in
  the user's own short time format (CoreFoundation, as the original takes Windows'), in 24
  hours with 24 Hour Clock, with a * while the alarm is set.
- Alarm: toggleAlarm sets it hours and minutes from this minute with the "Alarm will go off
  at 7:06 AM." popup; the getters as the original's (time left in the boxes, -1 when off); at
  that minute AS2D_ALARM and the "RIIIIIIIIING!" popup.
- Broadband / Modem: greyed, with a tooltip saying why (no multiplayer); clicks do nothing.
  CyGTabCtrl.setEnabled works.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@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