Repository navigation
Bundle 6/6: screens and advisors - #150
MortenLyhr wants to merge 119 commits into
Conversation
With a city's screen up, a click on the map now goes to the game core's city screen handlers, as the original engine hands them over, instead of selecting units: - a click: CvGame::handleCityScreenPlotPicked (a plot of the city's is worked or let go; the city's own plot gives the citizens back to the governor; a plot outside closes the screen, CITY_SCREEN_CLICK_WILL_EXIT) - a right click: handleCityScreenPlotRightPicked (the forced choice taken away) - a double click: handleCityScreenPlotDoublePicked (on the city: the screen closes) Plot clicks now say whether they are the second of a double click (SDL's click count). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The city screen's top panel (Panel_City_Top_Style) spans the whole map area, but its skin is a frame with an empty middle (GFC_BITMAPSKIN_CENTER_EMPTY): only its top and sides are drawn. The interface took every click inside its rectangle, so the city's tiles could not be clicked. A themed panel now takes a click only where its skin draws something (Theme::covers, the same pieces Theme::draw puts down). The main interface's panels take the same clicks as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Selecting a city (its screen) now lets go of the selected units, as the game core's CvGame::selectUnit lets go of the cities: a unit selected before stayed selected under the city screen, showed its way on a right click and could be ordered there. When the screen closes, the game core selects the next unit that waits (CvGame::updateSelectionList). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…urs and beat
The original draws the button's style (HUD_EndTurn_btn.tga, a brass ring) as it is, and over
it the theme's glass dot (SF_CtrlTheme_Civ4_Control_Button_EndTurn_Skin: HUD_EndTurn.tga at
its size in the middle) with the state's colour added less half (AddSigned). OpenCiv4 tinted
the whole ring instead.
The states were the wrong way round: END_TURN_GO, a steady green dot (EndTurnDot_Green), is
the original's while units can still move; once the turn is over and the end of turn message
is up, the dot is red, sinking from EndTurnDot_Red to EndTurnDot_DarkRed and back. While the
other civilizations move the button is hidden (shouldDisplayEndTurnButton).
The beat, measured in Wine at 120 frames a second: every 1.5 s the red rises over 0.5 s, holds
0.5 s and sinks over 0.5 s; the end of turn message ("Press <ENTER> to end turn...",
"Waiting for other Civilizations...") blinks with it, gone around the darkest red.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…off Windows) Points gamecore at the openciv4-dll commit that passes L"+"/L"" for %s in six wide Format calls (backlog: the city bar's defence, building and religion/corporation help lost their whole text on macOS and Linux). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The options screen asks both; they were unimplemented stubs that logged each call. There is no debug menu and no dial-up connection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The engine works in the Beyond the Sword folder, so a relative scenario
path no longer pointed at the file ("cannot read the scenario"). A --map
that names an existing file is made absolute with the other command line
paths; a map script's name (Fractal, ...) stays as it is.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… a serif stand-in
The theme (Resource/Themes/Civ4/Civ4Theme_Common.thm) asks for Sylfaen at 12, 14, 16 and 22
for all the interface's text. macOS and Linux lack it, so every text fell back to a sans face.
The game ships it (Resource/Civ4/sylfaen{,b,i,bi}.ttf, Resource/Fonts, Assets/res/Fonts), and a
game in a Wine prefix has the Windows fonts beside it (drive_c/windows/Fonts): Theme::fontFolders
names them and Fonts::addFolders (FreeType) looks there too. No font is copied.
A missing serif family (Sylfaen, Georgia, Times New Roman...) now gets a serif stand-in
(Georgia, Noto Serif, DejaVu Serif, Liberation Serif, Times) before the sans defaults. macOS's
symbol and CJK faces join the per-character fallbacks: the capital's star (U+2605) was a box.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ginal draws it addMultilineText took a label's rule (the game font: size 2, 14 px); the original draws it in the GFC control's normal font, Civ4Theme_Common.thm's .Normal = Size3_Normal, as it does setText. Measured on Dawn of Man's body against the original: word spacing and line breaks now match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BUG's city cycle arrows by the minimap (MainCityScrollMinus/Plus, WIDGET_CITY_SCROLL) and the Home/End keys run CONTROL_NEXTCITY/PREVCITY. With no city selected the game core asks the interface's selectLookAtCity, which was a stub, so they did nothing on the map. Now it selects the active player's city nearest the plot the camera looks at (as a selection, not the city screen); later presses cycle on from it (CvGame::cycleCities). getLookAtPlot gives that plot, and getSelectionPlot is the selected city's plot while cities are selected, so lookAtSelectionPlot moves the camera there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The original keeps four of the toggles by the minimap in its player profile (Profiles/<name>.pfl, named by CivilizationIV.ini's UserProfile): the plot grid, the bare map, the yields and the scores, as CyUserProfile's getGrid, getMap, getYields and getScores. It writes the file at each click, and every game takes them from there: after a restart, a new game, and a loaded save (a save made with the grid on loads with the profile's grid). The unit and resource icon layers are not kept. (Watched in Wine.) OpenCiv4 now keeps them in its own profile (Documents/My Games/openciv4/ profile.ini) as grid=, map=, yields=, scores=: oc4options gives them to the host when the profile is read, and Screens::frame tells it when one is switched, by its button or its key. The scores toggle works (it did nothing, and the scores showed always), and CyUserProfile / CyInterface read the toggles as they are. New test minimap_toggles (oc4options with a stand-in host): a switched toggle is in profile.ini at once and comes back after a restart and with readFromFile; an older profile gives the defaults. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… 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>
…first The original shows the game's messages in a see-through black box under the top bar (606 wide in the middle, a line of 18 for each), newest at the top, at most six; each line has a bullet and is drawn in the message's flash colour (BUG's foreign city founded in magenta, losses in red, white when it has none), colours in its text kept. A line shows at once and goes at once when its time is up; one pushed out by newer ones does not come back. Measured in Wine (BUG + BULL) from a film of the window at 1600 x 900. OpenCiv4 drew centred lines without a box, all white, oldest first, fading over their last second, up to twelve. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hown Three pieces, found with BUG's tech advisor in Wine (BUG + BULL): - A panel's colour from setPanelColor tints the layers its theme style tints by the panel's own inner colour (FactorColor GFC_Control_Panel_Color_Inner, Modulate): Panel_Tech_Style's tech_panel01. Known techs are green, the one researched and the queued cyan, the others blue, as in the original; they were all blue. - The tech advisor is told when the active player's research changes (a tech clicked, Shift-clicked into the queue, learnt, a new turn), as the original engine calls CvScreensInterface.forceScreenUpdate for it, and redrawn when it comes up (the turns left show at once). A click did choose the tech, but the screen never showed it. - addScrollPanel draws no panel: the engine's GScrollPanel is transparent (Civ4Theme_ScrollPanel.thm, GFC_CF_TRANSPARENT). The techs lie on the advisor's parchment, not the external style's blue; the city screen's right column loses a blue block Wine does not have. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the border Measured against the original (BUG + BULL, the new civic popup, 1600 x 900): - Each choice (popupAddGenericButton) is the theme's standard stone button across the window, its text dark with the button's light shadow, 9 in; a line's button is 25 high, 6 apart; the first has the focus rim until the keys choose another. They were plain white text lines. - The theme's GFC_BITMAPSKIN_SIDES_FILL is read: a window border's sides are filled with its colour round the glass, which is drawn inside the border's margin (12, 13, 12, 15). The glass's light top now follows on from the border's, as in the original; it was a hard light band with a darker step. (A pull down's open list keeps its look: its inner skin is drawn under the whole border.) - The window sits where the original's does (rim at 1182, 79). 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>
The city screen lets go of the selected units (so a right click on it orders nothing), and when it closed the game core picked the next unit that waited, or none: the unit the player had before was gone. The units selected when the screen opened are now kept and selected again when it closes (those still there and the player's), as the original keeps them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Esc cancels
With a unit selected and the right button held on another plot, the
original shows the way there and the unit's action buttons for that plot,
those recommended there glowing (a worker: the farm, road, cottage it
should build there; CvUnit::isActionRecommended and
CvGame::canHandleAction read the interface's goto plot). Esc lets go of
the way, and the button's release then orders nothing.
- The goto plot changing marks the action buttons for redrawing, so the
main interface asks again for that plot.
- enableMultiListPulse works: a pulsing button has the original's blue
rim and tint, a little brighter and dimmer a second a beat (measured
in Wine). It shows for the unit's own plot too, as the original's.
- Esc with the right button held cancels the way and the order.
- --keys can move the mouse ("?<x,y>") and hold the right button
("/<x,y>", "\<x,y>"), to test drags through the window's own input.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…link) oc4core links the game core through its import library on Windows, where only its exported functions can be called; CvTeam::isHasTech, getResearchProgress, CvPlayer::getQueuePosition, calculateResearchRate and CvGlobals::getNumTechInfos are not (LNK1120 on windows-x64). The research state the tech advisor is told about is now read by oc4screens.researchState through the scripts' CyPlayer and CyTeam, as a string compared each frame. The same values, the same behaviour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…75's where GameFont has none BUG draws its attitude faces, war and peace icons as font cells by their offset from a symbol the DLL names (init.xml, FontUtil.addOffsetSymbol), and only BUG's GameFont_75.tga holds them. The original shows them (BUG's foreign advisor GLANCE tab, its INFO attitudes, the espionage screen, the scoreboard); OpenCiv4 mapped only the DLL's own codes and read GameFont.tga only, so they were blank. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l's height, lines under buttons
Measured against the original (BUG's foreign advisor, Wine at 1600x900):
- A panel's title is drawn over its box, 11 px in, the box 28 px down ("Surplus Resources",
the ACTIVE tab's leaders' names); it was not drawn at all.
- The panels in a vertical panel's flow share its free height (GLANCE, ACTIVE, INFO rows).
- In a row, attachTextGFC texts and 46 px buttons sit in cells at least 46 wide, 18 apart,
in the row's middle (INFO's columns under their headers); BUTTON_SIZE_CUSTOM is as high as
the row (ACTIVE's leaders).
- A label of spaces is as wide as they are, and labels never take the rest of a row (ACTIVE's
" " pushed the leader and the deals out of the row).
- addLineGFC lines are a pixel wide and drawn on their draw control, under the widgets made
after it (RELATIONS: the lines run under the leaders' buttons).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s it As the original (Wine, BUG + BULL): a double click on one's city or its name bar opens the city screen, a single click on the bar selects the city (what it builds in the bottom panel), and a single click on the city's plot is any plot's (its units, else nothing). OpenCiv4 opened the screen on any single click. The single click stays as an OpenCiv4 option, "Open a city with a single click" on the options' OpenCiv4 tab (off; cityOneClick in profile.ini). Clicks carry whether they hit a city's bar, and --keys has "*<x,y>" for a double click. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sabled, pulse The unit's actions and the city's builds (GFC multi lists) were bare pictures with a gold square under the mouse. The original lays the theme's MultiList_Item skins (Civ4/Custom/MultiListItem.tga) over each: a rounded ring in the HUDBorder colour; under the mouse the fill glow added (+57 of 255, with a soft edge just outside the ring); pressed, a blue fill half over it; disabled, everything inside the ring half way to black (not the theme's ItemDisable, a white wash); the recommended action's pulse a ring going from a deep to a light blue every 0.6 s, a blue halo outside and a little blue inside. The buttons are 48 wide, one every 50 (2 apart, across and down). All measured in Wine (BUG + BULL, 1600x900). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… FactorCombine The military advisor (BUG) keeps the DEPLOYMENT tab's map and its panel when it switches to SIT-REP or STRATEGIC ADVANTAGES; in the original the tab's panel, made after them, covers both. OpenCiv4 drew a screen's own minimap over all its widgets: it is now drawn where initMinimap / bringMinimapToFront placed it among them, and left out (with its clicks) when a later panel covers it whole. The covering panel is PANEL_STYLE_MAIN, whose theme layers say FactorCombine = GColorCombine(Modulate, Source): the colour tints, the alpha is the image's own. The theme took the tint's alpha too, so the panel let the map's box and the background show through; it is opaque now, as in Wine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The original draws a help area with no art of its own (CvMainInterface's setHelpTextArea(350, ..., "", ..., 300)) in PANEL_STYLE_HUD_HELP: help_panel.tga tinted HelpBG (69,93,156) at 35 %, the map seen through it, a dark line and a faint blue one at its top and bottom, the text 4 in from its sides, wrapped at the area's minimum width (300). The city screen's area has art (POPUPS_BACKGROUND_TRANSPARENT) and keeps the framed tooltip. The plot's help sits in the same box. Measured in Wine (BUG + BULL, 1600x900): out = 0.65 map + (8,13,19), as the panel gives. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the script's As the original's (Wine, BUG Mod, with a worker selected; backlog bssth#68): - CyEngine's Alt forms (fillAreaBorderPlotAlt, addColoredPlotAlt) draw the named colour at the alpha given, in place of the colour's own. BUG draws a city not yet given a colour in COLOR_CLEAR (white, alpha 0) at alpha 1; it was multiplied to nothing. - In Python's pick plot mode (INTERFACEMODE_PYTHON_PICK_PLOT, BUG's editor) a left click keeps the mode and the selected units get no order; a right click leaves the mode, as before. The click used to end the mode, so the next right click moved the selected units. - An interface mode whose info has bHighlightPlot outlines the plot under the mouse in the game core's colour (CvGame::getNewHighlightPlot, getPlotHighlightColor; both DllExport), as the WorldBuilder's brush: green under BUG's editor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In INTERFACEMODE_PYTHON_PICK_PLOT the right button takes a city away in BUG's editor; the original shows no Go To path for it, neither while the button is held nor for a press begun in that mode and still held after it ends (seen in Wine, backlog bssth#68). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The folder comes from profile.ini as UTF-8, but path(std::string) reads it in the system's code page on Windows: a folder named in what that page can't hold played nothing, and a file such as 東京.mp3 made path::string() throw. The folder now goes through pathFromUtf8, the files' paths come back through utf8Path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hole Python 2's str(u'...') raised on a profile name or a music folder that isn't ASCII (the error only printed). They are kept as UTF-8 now, and the files are opened by their unicode names (Windows' wide calls, not the code page). A profile file and profile.ini are written beside themselves first and then moved over the old one, so a crash while writing leaves the old file. Tested with such a name and folder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…k; one in 25 turns kept - No Documents folder found: no autosave. Before, the path was relative to the working directory, and autoSavesBeyond deleted the AutoSave_ files there. - The settings are set by the options' script and read on the game's thread: now through SharedAutoSaveSettings, behind a mutex. - OpenCiv4's own autosaves kept the turn-25 save only when the interval divided 25; now the first save in each 25 turns is kept (openciv4KeepsForGood, tested). - AutoSaves.h's comment without the date. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pt per game They were static locals in runPlay and so outlived the game: a game loaded from the menu began with the last one's. Now they live with runPlay's other state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and ends the mode In INTERFACEMODE_PYTHON_PICK_PLOT a left click did nothing, so a mod other than BUG's dot map stayed in the mode for good. A left click on a plot the scripts can pick (the game core's highlight colour: revealed, canPickPlot) now ends the mode and reports the plot (CvEventReporter::plotPicked, the scripts' onPlotPicked); a right click ends it, as before. Why the original ends it: the shipped mod Gods of Old sets the mode for its prophets and never ends it itself (its CvMainInterface.py, CvEventManager.py onPlotPicked). BUG's dot map editor reads the mouse itself and sets the mode again after each click (CvDotMapOverlayScreen.resetInterfaceMode), later in the same frame, so it stays in the mode as in Wine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
526750f to
990e5ef
Compare
…original's Seen in Wine at 1600 x 900 (BUG, map mode): clicking the cut-off Terrains tab selects it and moves the strip one tab, so Bonuses, Terrains and Territory show whole and > turns grey. One click on > or < moves the strip one tab, as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the review. #150 is rebased on master and on the new #148 and #149. Item by item:
Also fixed during the rebase: two merges in the bundle had a bad automatic conflict resolution. Checked on macOS: ctest 23/23, and the 100-turn checksum is 🤖 Generated with Claude Code |
|
Thanks, you're right. After #128 the map mode left Terrains and Territory out of the strip. You could only reach them through two small Fixed in 5ae664a3 and fe326216 (in the bundle as 6510608). The map mode's tab strip now works like the original's:
Checked in OpenCiv4: 🤖 Generated with Claude Code |
…de page On Windows, Python 3's text-mode open() uses cp1252, so writing a profile named 東京 raised UnicodeEncodeError (windows-x64 CI, options_other). The files are now opened in binary mode with the text encoded as UTF-8, and read back the same way, under the game's Python 2.7 and the tests' Python 3 alike. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Merge after bundle 5, #149 (this branch holds it; once it is merged, this PR shows only its own changes).
Rebased on master (2026-11-23): bundles 1–3 are merged, so this branch is based on master now; the changes they held are gone from its diff. It holds #148 and #149.
Clean room (2026-11-23): #128's history is rewritten. The commit that took the World Builder buttons' help keys from the executable and the commit that re-checked them in Wine are now one commit, whose message gives only what was seen in Wine. No commit in this bundle carries knowledge from the exe any more.
fix/worldbuilder-help(#128's branch) is force-pushed with the same history, and the committed.pycfiles are gone from the history.This PR replaces 13 open PRs, merged here one by one with their own commits (each description stays on its PR, which links here once closed); the conflicts between them are resolved as on the branch we play daily. Merging it closes nothing automatically: each replaced PR will be closed with a link here.
Checks: macOS build (Release), ctest 21/21 passed; sync checksums
--turns 100 --map Fractal --size STANDARD --seed 7at turn 100 equal master's (D7D43800). Windows: this PR's CI.World Builder buttons' help: re-checked in the running game (2026-11-22,
806a82e7)#128 had taken each World Builder button's help key from the original's exe, against CONTRIBUTING. All 15 buttons were hovered in the running game under Wine instead (see #128's added section); every shown text is the key we had. No code change; the docstrings name the new source. ctest 22/22, sync checksum
D7D43800, as before.🤖 Generated with Claude Code