Repository navigation
Scenarios: no free starting units for players the scenario gives units - #63
Open
MortenLyhr wants to merge 1 commit into
Open
MortenLyhr wants to merge 1 commit into
MortenLyhr wants to merge 1 commit into
Conversation
This was referenced Nov 19, 2026
…ithout units startScenario called CvGame::setInitialItems before the scenario's own units were placed, so CvGame::initFreeUnits (which skips players with units or cities) found every player empty and gave each the era's and difficulty's free units on top of the scenario's. Run the steps one by one, as the original does for a World Builder scenario: free state (techs, gold), starting plots, then the scenario's items (its units, cities and gold), and only then initFreeUnits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MortenLyhr
force-pushed
the
fix/scenario-free-units
branch
from
November 23, 2026 08:59
a803d93 to
4af271a
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.
When OpenCiv4 opens a World Builder scenario, every player got the free starting units on top of the scenario's own:
startScenariocalledCvGame::setInitialItemsbeforeapplyInitialItemsplaced the scenario's units, soCvGame::initFreeUnits(which skips players that have units or cities) found every player empty.The original game gives none to a player the scenario gives units or cities.
startScenarionow runs the steps one by one:assignStartingPlots,normalizeStartingPlots, then the scenario'sapplyInitialItems(its techs, units, cities and gold), and only theninitFreeUnitsand the AI's found values. (Since #142 there is noinitFreeStatefor a scenario.) A player the scenario leaves with only a starting plot still gets the free units.A test scenario (Rome with 119 units and 4 cities, Ragnar with 2 units and a city), units at the start:
The same at Settler, Noble, Emperor and Deity (on master the extras grow with the difficulty: Ragnar 4 at Settler, 11 at Deity). With Ragnar's units and city taken out of the file, he gets the difficulty's free units as before (Noble 2, Emperor 5, Deity 9).
Checked:
ctest15/15 (rebased on master8b7d8557).--turns 100 --map Fractal --size STANDARD --seed 7checksums match master on every turn (random maps don't take this path).🤖 Generated with Claude Code