Skip to content

A click on a plot without one's units keeps the selected unit - #171

Open
MortenLyhr wants to merge 1 commit into
bssth:masterfrom
MortenLyhr:fix/click-keeps-unit
Open

MortenLyhr wants to merge 1 commit into
bssth:masterfrom
MortenLyhr:fix/click-keeps-unit

Conversation

@MortenLyhr

@MortenLyhr MortenLyhr commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Clean room (#181): checked on 2026-11-25 against #181's clean-room rules and guides (CONTRIBUTING.md "Clean room", AGENTS.md). This PR was written before #181; its sources are below, in #181's terms.

What it is based on: clicks with a unit selected in the original under Wine (BtS 3.19, BUG + BULL, batch 3, with the plot under the mouse logged).

  • clean room: neither I nor any tool or AI agent I used looked inside the original game's executables or libraries (no disassembly, decompiling, debugging, strings), and nothing here comes from someone else's (CONTRIBUTING)

The problem

With a unit selected, a left click on a plot with none of your units dropped the selection: a bare plot, your own empty city, or a foreign unit's plot. The next right click then did nothing.

What the original does (Wine, BUG + BULL)

Seen in Wine batch 3 (backlog #99). A lone warrior is selected at 81,65, and the plot under the mouse is logged to show where each click lands. One left click on each of these keeps the warrior selected (head WARRIOR n 1):

  • a bare plot (83,65);
  • our own empty city (79,65);
  • a Viking warrior's plot (81,63).

The camera glides to the bare plot and the Viking plot, but not to our city. The click on our city opens no city screen.

What it changes

main.cpp, the map's left click: when the plot has none of your units, the selection now stays as it is. The else ui.clearSelectionList() is gone. A click on your own units still selects them, and the camera rule is unchanged (it already matches).

On master, a single click on your own city still opens its city screen, before this code is reached. That is the original's double click, and #149 changes it (backlog #46). With #149, a single click on your own empty city reaches this code and keeps the unit, as in Wine (checked below).

How it was checked

OpenCiv4 (BUG + BULL, the test map, batch 3's setup testgames/shots/batch3/b3-setup.py with the lone warrior selected by o-lone.py, --keys "~...<x,y>...."):

Click Wine master this PR
bare plot 83,65 kept dropped (head - n 0) kept (head WARRIOR … n 1)
foreign unit 81,63 kept dropped kept
own empty city 79,65 kept, no city screen city screen opens city screen opens (master's single click); on #150 + this commit: kept, no city screen

ctest 15/15. Sync checksums equal master's on all 100 turns (D7D43800): interface only.

Pictures

Before: Wine | OpenCiv4 (from batch 3)

bare
foreign
city

After (OpenCiv4, this PR): the warrior stays selected.

bare after
foreign after

Own empty city, with #150 (which holds #149's double click) and this commit: the warrior stays selected, no city screen.

city after

🤖 Generated with Claude Code

With a unit selected, the original's left click on a bare plot, on one's
own empty city or on a foreign unit's plot keeps the unit selected (Wine,
BUG + BULL, backlog bssth#99); the camera still goes to the plot. OpenCiv4
dropped the selection. A click there now leaves the selection as it is;
one on one's own units still selects them.

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