Skip to content

Leave Go To (and every interface mode) when the selection changes, as the original - #156

Merged
bssth merged 1 commit into
bssth:masterfrom
MortenLyhr:fix/goto-clear-on-select
Nov 23, 2026
Merged

bssth merged 1 commit into
bssth:masterfrom
MortenLyhr:fix/goto-clear-on-select

Conversation

@MortenLyhr

Copy link
Copy Markdown
Contributor

Pressing G puts the interface in Go To mode (INTERFACEMODE_GO_TO). If another unit was then selected, with W, the unit bar or a click, OpenCiv4 stayed in Go To, and the next click sent the new unit there.

In the original BtS, the interface goes back to selection mode as soon as the selection list is cleared or changed. That holds for Go To, Route To, Ping, and a mode set by a script. It was checked in the original game under Wine by logging CyInterface().getInterfaceMode() on every game update:

After Go To (G) or another mode Original OpenCiv4 before OpenCiv4 after
W (the next unit) selection mode Go To selection mode
another unit selected (unit bar / plot click) selection mode Go To selection mode
the same unit selected again selection mode Go To selection mode
a city selected selection mode Go To selection mode
Route To (Alt+R), then W selection mode Route To selection mode
Ping, then another unit selected selection mode Ping selection mode
a unit from another plot added (refused, the selection unchanged) Go To Go To Go To
the unit's moves taken away (no new selection) Go To Go To Go To

The change is in the host's Interface. A new leaveInterfaceMode() is called from clearSelectionList, from insertIntoSelectionList (when a unit is inserted or the list was cleared), from removeFromSelectionList, from selectAll and from selectCity. CvGame::handleAction selects the group before it sets the mode, so G and Shift/Alt modes that select the stack first still work.

Checked: ctest; the 100-turn checksums (--turns 100 --map Fractal --size STANDARD --seed 7) match master's D7D43800. OpenCiv4 with --keys "~GW[66,47]" and OC4_PLAY_LOG=1: before, INTERFACEMODE_GO_TO at 66,47: done (the new unit sent off); after, the click selects instead.

Related: #97 (Route To path), #108 (Go To path look). Conflicts with neither.

🤖 Generated with Claude Code

The interface mode (Go To, Route To, Ping, ...) stayed on when W, the unit
bar or a click selected another unit, so the next click sent the new unit
there. The original (Wine) goes back to selection mode whenever the
selection list is cleared or changed, even when the same unit is selected
again, and when a city is selected. Interface::leaveInterfaceMode() is
called from clearSelectionList, insertIntoSelectionList, removeFromSelectionList,
selectAll and selectCity.

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