Repository navigation
Hurt units show only the figures still alive - #157
Open
MortenLyhr wants to merge 1 commit into
Open
MortenLyhr wants to merge 1 commit into
MortenLyhr wants to merge 1 commit into
Conversation
The original draws a hurt unit with fewer figures: as many as CvUnit::getSubUnitsAlive gives (the game core's own rule, exported for the engine). Measured in Wine on 2-, 3- and 4-figure units at damage 0-90: a warrior or archer shows 3 up to 4 damage, 2 up to 38, then 1; a chariot, catapult or worker 2 up to 10, then 1; a settler 4, 3 up to 27, 2 up to 52. A change of damage (healing) shows at once. In a battle all the figures stay, as before: the battle's rounds fell those dead before it and in it. The last figure alive is drawn as large as its fellows were (Wine), not with the larger scale of a one-figure unit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MortenLyhr
force-pushed
the
fix/damaged-figures
branch
from
November 23, 2026 09:00
dcb1830 to
7b46953
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The original draws a hurt unit with fewer figures. OpenCiv4 always drew the whole formation.
What the original does (measured in Wine, BtS 3.19, plain game): the number of figures is the game core's own
CvUnit::getSubUnitsAlive(exported for the engine):max(1, (G·(HP−damage) + HP/(2G+1)) / HP)for a formation of G figures. Rows of units at damage 0, 3, 10, 11, 27, 28, 38, 39, 52, 53 and 90:A change in damage (healing, or a hurt unit) shows at once. In a battle a hurt unit fights with the figures it has (an axeman attacking a warrior at 39 damage: one warrior figure), and the figures killed in the battle fall. The last figure alive is drawn as large as the others were, not at the larger scale of a one-figure unit.
The change:
MapCapture: outside a battle, the unit's figures are cut togetSubUnitsAlive(). The required art definitions stay first, so a settler loses its children before the adults. In a battle all figures stay, as before: the battle's rounds already hide the figures dead before it and those killed in it.UnitView::formation(the formation's full size) decides the one-figure scale (SINGLE_UNIT_GFX_EXTRA_SCALE), instead of the number of figures drawn.Checks: ctest 15/15 (rebased on master
8b7d8557); sync checksums--turns 100 --map Fractal --size STANDARD --seed 7equal master's (D7D43800).Pictures (Wine left, OpenCiv4 right; rows: chariots, archers, warriors; damage rising to the right):
After:

Before:

More damage levels (left to right 27…90):

Settlers, workers, catapults (OpenCiv4's tighter grid hides a settler's children behind the adults; the count is the same):

Healing: the first warrior hurt to 53 (one figure), the one at 39 healed to 0 (three):

Wine, a battle: the warrior at 39 damage defends with its one figure:

Not changed: how the figures stand (OpenCiv4 puts them in a tight grid where the original spreads them out).
🤖 Generated with Claude Code