Skip to content

One advisor at a time; advisors open over a talk and leave it as it was - #158

Merged
bssth merged 1 commit into
bssth:masterfrom
MortenLyhr:fix/advisor-one-at-a-time
Nov 23, 2026
Merged

bssth merged 1 commit into
bssth:masterfrom
MortenLyhr:fix/advisor-one-at-a-time

Conversation

@MortenLyhr

Copy link
Copy Markdown
Contributor

Opening a second advisor left the first one up underneath it. The screens were drawn by their file id, not by the order they opened. So opening the Domestic Advisor (id 0) while the Military Advisor (id 14) was up put it behind the Military Advisor. In a talk with an AI, every key went to the talk, so F1–F12 did nothing. An advisor opened with the interface's button was drawn under the talk.

What the original does

All of this was seen in Wine with BUG + BULL: the test-map scenario, real key presses, and a logger listing the screens that are up.

  • B replaces A. F5 over the Domestic Advisor leaves only the Military Advisor up. F9 over Victory, F3 over Info, F4 over Religion and F2 over the Sevopedia do the same.
  • The same key again does not toggle. After F1 then F1, the Domestic Advisor is still up; the same holds for F6 then F6.
  • The Sevopedia opens over the tech advisor. F6 then F12 leaves both up, and Esc closes the Sevopedia back to the tech advisor. BUG's Sevopedia (and BtS's CvPediaMain) calls setScreenGroup(1).
  • Esc closes the advisor that is up. With nothing else up, the next Esc opens the game's menu, which is unchanged here.
  • In an AI's talk (first contact): F1, F5, F6, F8, F9 and F12 open their screens over the talk. Their EXIT button leaves the talk exactly as it was. Esc still goes to the talk, even under an advisor. Under the Military Advisor, Esc answered the greeting with peace and the talk moved on to its menu. Under the Sevopedia, Esc chose "Farewell" and the talk ended, while the Sevopedia stayed up.

The change

  • showScreen of a screen of its own closes the screens that were up before it (hide + CvScreensInterface.onClose, as Esc does). It never closes the main interface, a screen shown with bPassInput (the World Builder, BUG's dot map), or the talk. It also leaves a screen of a lower group open: a group-1 screen (the Sevopedia) opens over an advisor, and an advisor (group 0) replaces the Sevopedia. setScreenGroup and getScreenGroup now keep the group.
  • Screens are drawn in the order they were shown, so the newest is on top; the screen's own minimap follows the same order. Esc closes the newest screen that closes on Esc. In a talk, Esc still goes to the talk first.
  • In a talk, the keys that open a game screen (the advisors, the Civilopedia, Victory, Info, Espionage) open it over the talk. Every other key stays with the talk, as before.
  • --keys: %1 … %9, %0, %= type F1 … F10 and F12 (used for the tests).

Not observed and left as they were: Enter under an advisor in a talk (it still goes to the talk), and an advisor key over Dawn of Man, a tech's splash or a wonder movie (the new rule closes those, the same as any other screen of its own).

Merge note: this conflicts on one line with #148 (and so with #149/#150): #148 adds _sliders.clear() directly above the draw-order line in display(). The fix is to keep both lines.

Checks: ctest passes, and the checksum at turn 100 (--turns 100 --map Fractal --size STANDARD --seed 7) is unchanged at D7D43800.

Pictures

In each picture the panels are, left to right, Wine | before | after.

The Domestic Advisor, then the Military Advisor (before: the Domestic Advisor's header shows behind it):
b replaces a

The Domestic Advisor opened in a first-contact talk (before: drawn under the talk):
advisor over talk

Wine | after: the advisor's EXIT leaves the talk as it was:
exit back to talk

Wine | after: Esc on the Sevopedia goes back to the tech advisor:
pedia esc

🤖 Generated with Claude Code

As the original does (seen in Wine, BUG + BULL, testgames/shots/advisors):
- A screen of its own shown closes the ones up before it (F5 over F1, F9
  over F8, F3 over F9, F4 over F7, F2 over the Sevopedia). Not the main
  interface, not a screen that passes the map's input through, not the
  talk, and not a lower group: the Sevopedia (setScreenGroup 1) opens over
  the tech advisor and Esc closes it back to it.
- The same key again keeps the screen up (no toggle): unchanged.
- Screens are drawn in the order they were shown, so the newest is on
  top (an advisor over the talk), and Esc closes the newest.
- In an AI's talk the advisors' and the Civilopedia's keys open them over
  it; their EXIT leaves the talk as it was. Esc still goes to the talk,
  even under an advisor, as the original's.
- --keys: "%1" ... "%9", "%0", "%=" type F1 ... F10, F12.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bssth
bssth merged commit 8b7d855 into bssth:master Nov 23, 2026
3 checks passed
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.

2 participants