Repository navigation
Fix Philosophy's free tech being auto-spent, and the Science Advisor picker - #1038
Open
Billytifft wants to merge 3 commits into
Open
Billytifft wants to merge 3 commits into
Billytifft wants to merge 3 commits into
Conversation
…picker Spending a free advance is now a separate action from setting the research target, so MaybePickTechToResearch no longer consumes it. Completing a bonus tech (e.g. Philosophy) now prompts the player to choose, and the counter is persisted in the save. Selecting a tech in the Science Advisor now sets it as the current research target, and the 'Ask which tech to research next' preference is honoured for the turn-start prompt. Fixes C7-Game#1003.
Billytifft
commented
Oct 11, 2026
| button.Pressed += () => { | ||
| action(); | ||
| ReleaseFocus(); | ||
| action(); |
Contributor
Author
There was a problem hiding this comment.
this is to fix a crash when selecting Whats the Big Picture from Science Advisor popup.
Billytifft
commented
Oct 11, 2026
| knownTechs = player.knownTechs; | ||
| currentlyResearchedTech = player.currentlyResearchedTech; | ||
| researchQueue = new List<ID>(player.ResearchQueue.Select(t => t.id)); | ||
| freeTechsRemaining = player.freeTechsRemaining; |
Contributor
Author
There was a problem hiding this comment.
Im not sure if this is necessary as you cant really save between gaining philosophy and spending the free tech. Would love your input though
The free-advance spend moved out of SetCurrentlyResearchedTech into ClaimFreeTech, which only the human UI reaches. AI players research bonus techs (e.g. Philosophy first) and accumulate freeTechsRemaining without ever spending it. Spend it in MaybePickTechToResearch, the shared choke point for AI research decisions, before picking the next tech.
Contributor
Author
|
I know this will likely have to have a slight refactor after #1018 is merged |
Billytifft
marked this pull request as ready for review
October 11, 2026 18:54
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.
What was wrong
Philosophy awards a free tech to the first civ that researches it (#1003), but the advance was spent automatically — completing the tech ran straight into
MaybePickTechToResearch, which spent the counter before the player ever saw it. There was no prompt and no indication it happened, and the counter wasn't saved, so a pending advance vanished on save/load.Separately, picking a tech in the Science Advisor via "What's the big picture?" didn't start researching it. The tech landed in the queue but nothing was set as the current research target, so the bottom-bar indicator kept reading "Not selected".
What changed
freeTechsRemainingis persisted in the save.Two separate popups
Worth not conflating these — they share the same Science Advisor selection popup but are different flows:
In-game testing
Played a normal game out to Philosophy as the first civ to research it:
AI free-advance spending is covered by a unit test; the AI path was not exercised in-game.
Build 0 errors / tests pass /
dotnet format --verify-no-changesclean.Fixes #1003.