Skip to content

Improve yield icon manager#3

Draft
vaderkos wants to merge 70 commits into
masterfrom
imprv-yield-icon-manager
Draft

Improve yield icon manager#3
vaderkos wants to merge 70 commits into
masterfrom
imprv-yield-icon-manager

Conversation

@vaderkos
Copy link
Copy Markdown
Owner

No description provided.

@vaderkos vaderkos force-pushed the imprv-yield-icon-manager branch from 7adc61a to b2ae912 Compare April 27, 2026 12:25
@vaderkos vaderkos force-pushed the imprv-yield-icon-manager branch from 0ac756b to e67485a Compare May 15, 2026 10:29
@vaderkos vaderkos force-pushed the imprv-yield-icon-manager branch from e67485a to 701e64c Compare May 15, 2026 10:34
vaderkos and others added 26 commits May 15, 2026 12:34
Reduces GC pressure and visual popping. Adds grid_to_index and
intersect_edge, removes IDX_TO_WX/IDX_TO_WY and is_visible.
Archaeology choice logic is handled in changeBuildProgress so this ChoicePending code is no longer needed.

Fixes LoneGazebo#12948
Tactical AI:

Fix AI units not healing in some cases.

Allow suicide attacks if the units has no safe plots.

Stop AI from making suicidal moves for no reason in some cases.

Stop discarding tactical moves that move towards the target when there's nothing else we can do. Was causing the AI to discard many good positions, wasting time and making army moves outside of combat sometimes very bad.

Add some value for overkilling to make the AI more willing to be extra sure when killing units and cities.

Homeland AI:

Fix dead units (civilians building builds that kill them, like GPTIs) demanding defenders.

Increase weight for healing with scouts.

City AI:

Fix AI bombard evaluation. Should now target more sensible targets.

Danger evaluation:

Stop assuming units in cities will stay there, it was a failed experiment.
Generalize tooltips and clarify the code so it's clear what's actually going on.

Fix landmarks in ally territory giving double happiness.
* Include annexed CS yields in CvCity update method

I note this whole thing gives only the "ally" portion of the CS yields -- I don't think I changed this from before, but maybe it should be both ally+friend since that's what I would expect.

* typos

* Add friend yields to annexed

Gets recorded under CS ally because otherwise the city-level cache would need 2 separate values.

Formally should perhaps have separate bin, like the JFD method, but it doesn't seem to matter anywhere. Indeed even the tooltip named CS Ally is a collection of all sources (and just says "City-States" in game)

* Replace "Rome UA" comments with "Annexed CS"
* Update building flavors in BuildingFlavorSweeps.sql

* Fix Hagia Sofia
Fix RA yields scaling with game speed
City records max HP and damage.
So if it starves, max HP goes down but damage isn't updated. This means damage can exceed total HP, giving negative HP. This is bad LoneGazebo#13052
This clamps it at 1 HP left over
Convert to use doInstantYield, completing TODO
Will also change from boolean to integer, allowing modders to set higher conversion rates

facility is also possible to discriminate between scrap/upgrade and have different values, if desired, using bEvent flag

new TODO: allow any yield
Add notification text for disbanding or upgrading a unit
vaderkos and others added 30 commits May 30, 2026 17:58
…oneGazebo#13010)

* Add CPK.UI.Control.Instance.Manager with Queue and Inspect utilities

New files:
- CPK.UI.Control.Instance.Manager: full lifecycle manager for UI control
  instances with acquire/recycle/release, LIFO/FIFO ordering, lifecycle
  hooks (onCreated, onAcquire, onRecycle, onRelease), state tracking via
  a single boolean table, bulk RecycleAcquired/ReleaseRecycled, and rich
  error reporting with pool state and ControlInstance __tostring context
- CPK.Util.Queue: two-stack amortised O(1) FIFO queue matching Stack API,
  usable as a drop-in alternative to Stack inside InstanceManager
- CPK.UI.Control.Inspect: control string formatter appending GetID() where
  available; shared by Instance.Error, Instance.Make and Instance.Manager

Updated files:
- CPK.UI.Control.Instance.Move: promoted from feature branch to Kit
- CPK.UI.Control.Instance.Make: add __tostring to ControlInstanceMeta
  using ControlInspect for root and parent controls
- CPK.UI.Control.Instance.Error: use ControlInspect, improve template
  formatting with nested Instance/Current sections
- CPK.Util.Stack: add class description and public method field annotations

* Register new Kit files in Community Patch.civ5proj

Add Inspect, Manager, Move and Queue to the project file so they are
included in the VFS build.
- Fix a bug in peace evaluation when CS_OVERSEAS_TERRITORY option is enabled

- Include Great Diplomats in CS_OVERSEAS_TERRITORY fix to canEnterTerritory()

- Performance improvements

- Tweak TXT_KEY_WARMONGER_HATE_MAXIMAL to be more historically accurate to Gandhi

- Tweak victory pursuit hint weights:
  * When primary hint is for an enabled victory and secondary hint is for a disabled victory, the weight of the primary hint is boosted
  * When primary hint is for a disabled victory, the weight of the primary hint is reduced; if this is true *and* the secondary hint is for an enabled victory, the weight of the secondary hint is boosted too

- Revise DoContactPlayer() and many associated functions
  * Completely rewrite the priority order for statements the AI can send
  * Clean up a lot of diplo statement code
  * AI should be a bit more precise at identifying the target of its ire when it gets mad about City-State Influence competition
  * Fix missing checks causing the AI to spam Open Borders requests
  * Fix a bug causing certain AI ideological statements to never fire
  * Fix missing MOD_DIPLOAI_SHUT_UP checks in some functions
  * Fix a bug causing advisor messages about Influence competition with City-States to never display
  * Fix a bug where advisor messages can leak information about hidden City-State disputes (which was revealed by fixing the preceding bug)
  * Rewrite all functions that call the Chattiness flavor so that it can finally be customized properly
  * Add Chattiness checks to a few other functions
  * Slight reduction in memory consumption by dialogue system
  * Misc. small fixes and changes to how dialogue works

- Move trade screen text for Techs and Maps from (2) to (1)

- AI teammates of humans can no longer agree to demands
  * If a demand is attempted, they will rebuff it using the same dialogue as when protected by their master

- AI teammates of humans can no longer accept voluntary vassalage from other players

- VP only: AI teammates of humans can no longer accept Open Borders from other players (because of the Tourism modifier)

- Humans no longer show an opinion modifier for same/different policies
- Bump Gustavus Adolphus's VictoryCompetitiveness flavor up to 9 (was 8)

- Update Augustus Caesar's diplo flavors and victory pursuits
  * Primary Victory Pursuit: Domination -> Culture
  * Secondary Victory Pursuit: N/A -> Domination
  * MinorCivCompetitiveness raised to 5 (was 2)
  * DiploBalance raised to 5 (was 3)
  * WarmongerHate raised to 6 (was 5)
  * DoFWillingness raised to 6 (was 2)
  * DenounceWillingness raised to 5 (was 2)
  * Loyalty raised to 6 (was 3)
  * Neediness raised to 6 (was 4)
  * Meanness lowered to 6 (was 8)
  * War Bias lowered to 6 (was 9)
  * Hostile Bias raised to 6 (was 3)
  * Deceptive Bias raised to 5 (was 1)
  * Friendly Bias raised to 5 (was 2)
  * Friendly Bias (City-State) raised to 8 (was 2)
  * War Bias (City-State) lowered to 5 (was 12)
  * In addition, Rome also has WorkWith/AgainstWillingness/Chattiness changes (see below)

- Assign Chattiness flavors to all leaders and remove the override setting them all to 4

- Set properly thought-out WorkWithWillingness and WorkAgainstWillingness flavors for all leaders
  * Previously, they were just set to the DoFWillingness and DenounceWillingness values, respectively
  * Now each leader has a specific choice intended to synergize with their kit, leader personality, and other diplomacy flavors

- List of changes to WorkWithWillingness, WorkAgainstWillingness and Chattiness:
  * Ahmad al-Mansur
    - WorkWithWillingness raised to 8 (was 7)
    - WorkAgainstWillingness lowered to 5 (was 6)
    - Chattiness set to 4

  * Alexander
    - WorkWithWillingness remains at 5
    - WorkAgainstWillingness raised to 9 (was 7)
    - Chattiness set to 7

  * Ashurbanipal
    - WorkWithWillingness lowered to 1 (was 3)
    - WorkAgainstWillingness raised to 8 (was 6)
    - Chattiness set to 5

  * Askia
    - WorkWithWillingness lowered to 2 (was 4)
    - WorkAgainstWillingness raised to 8 (was 7)
    - Chattiness set to 4

  * Attila
    - WorkWithWillingness remains at 3
    - WorkAgainstWillingness raised to 9 (was 5)
    - Chattiness set to 7

  * Augustus Caesar
    - WorkWithWillingness raised to 5 (was 2)
    - WorkAgainstWillingness raised to 4 (was 2)
    - Chattiness set to 2

  * Bismarck
    - WorkWithWillingness raised to 10 (was 8)
    - WorkAgainstWillingness raised to 10 (was 5)
    - Chattiness set to 6

  * Boudicca
    - WorkWithWillingness remains at 6
    - WorkAgainstWillingness raised to 9 (was 6)
    - Chattiness set to 4

  * Casimir III
    - WorkWithWillingness raised to 9 (was 5)
    - WorkAgainstWillingness lowered to 6 (was 7)
    - Chattiness set to 6

  * Catherine
    - WorkWithWillingness lowered to 5 (was 6)
    - WorkAgainstWillingness lowered to 8 (was 9)
    - Chattiness set to 7

  * Darius I
    - WorkWithWillingness remains at 5
    - WorkAgainstWillingness lowered to 5 (was 6)
    - Chattiness set to 2

  * Dido
    - WorkWithWillingness raised to 8 (was 6)
    - WorkAgainstWillingness raised to 7 (was 4)
    - Chattiness set to 5

  * Elizabeth I
    - WorkWithWillingness lowered to 4 (was 6)
    - WorkAgainstWillingness raised to 9 (was 8)
    - Chattiness set to 5

  * Enrico Dandolo
    - WorkWithWillingness remains at 10
    - WorkAgainstWillingness raised to 10 (was 7)
    - Chattiness set to 8

  * Gajah Mada
    - WorkWithWillingness remains at 7
    - WorkAgainstWillingness lowered to 4 (was 6)
    - Chattiness set to 4

  * Gandhi
    - WorkWithWillingness raised to 12 (was 10)
    - WorkAgainstWillingness lowered to 7 (was 8)
    - Chattiness set to 7

  * Genghis Khan
    - WorkWithWillingness lowered to 6 (was 7)
    - WorkAgainstWillingness raised to 5 (was 4)
    - Chattiness set to 6

  * Gustavus Adolphus
    - WorkWithWillingness lowered to 1 (was 2)
    - WorkAgainstWillingness lowered to 5 (was 6)
    - Chattiness set to 5

  * Haile Selassie
    - WorkWithWillingness lowered to 5 (was 6)
    - WorkAgainstWillingness lowered to 5 (was 6)
    - Chattiness set to 3

  * Harald Bluetooth
    - WorkWithWillingness lowered to 3 (was 8)
    - WorkAgainstWillingness lowered to 3 (was 5)
    - Chattiness set to 5

  * Harun al-Rashid
    - WorkWithWillingness raised to 9 (was 8)
    - WorkAgainstWillingness remains at 8
    - Chattiness set to 8

  * Hiawatha
    - WorkWithWillingness remains at 8
    - WorkAgainstWillingness remains at 7
    - Chattiness set to 3

  * Isabella
    - WorkWithWillingness remains at 4
    - WorkAgainstWillingness lowered to 6 (was 8)
    - Chattiness set to 6

  * Kamehameha
    - WorkWithWillingness remains at 9
    - WorkAgainstWillingness remains at 4
    - Chattiness set to 3

  * Maria I
    - WorkWithWillingness remains at 8
    - WorkAgainstWillingness lowered to 3 (was 8)
    - Chattiness set to 4

  * Maria Theresa
    - WorkWithWillingness raised to 9 (was 7)
    - WorkAgainstWillingness remains at 9
    - Chattiness set to 8

  * Montezuma
    - WorkWithWillingness lowered to 2 (was 5)
    - WorkAgainstWillingness lowered to 4 (was 7)
    - Chattiness set to 9

  * Napoleon
    - WorkWithWillingness remains at 7
    - WorkAgainstWillingness lowered to 5 (was 8)
    - Chattiness set to 7

  * Nebuchadnezzar II
    - WorkWithWillingness raised to 7 (was 3)
    - WorkAgainstWillingness lowered to 4 (was 5)
    - Chattiness set to 2

  * Oda Nobunaga
    - WorkWithWillingness lowered to 3 (was 6)
    - WorkAgainstWillingness remains at 6
    - Chattiness set to 5

  * Pacal
    - WorkWithWillingness remains at 7
    - WorkAgainstWillingness lowered to 3 (was 6)
    - Chattiness set to 3

  * Pachacuti
    - WorkWithWillingness raised to 5 (was 4)
    - WorkAgainstWillingness lowered to 5 (was 6)
    - Chattiness set to 4

  * Pedro II
    - WorkWithWillingness remains at 10
    - WorkAgainstWillingness remains at 8
    - Chattiness set to 8

  * Pocatello
    - WorkWithWillingness raised to 7 (was 5)
    - WorkAgainstWillingness lowered to 6 (was 7)
    - Chattiness set to 4

  * Ramesses II
    - WorkWithWillingness raised to 5 (was 3)
    - WorkAgainstWillingness lowered to 1 (was 8)
    - Chattiness set to 4

  * Ramkhamhaeng
    - WorkWithWillingness raised to 10 (was 9)
    - WorkAgainstWillingness raised to 8 (was 6)
    - Chattiness set to 8

  * Sejong
    - WorkWithWillingness raised to 10 (was 9)
    - WorkAgainstWillingness lowered to 2 (was 4)
    - Chattiness set to 1

  * Shaka
    - WorkWithWillingness lowered to 2 (was 5)
    - WorkAgainstWillingness lowered to 3 (was 7)
    - Chattiness set to 9

  * Suleiman
    - WorkWithWillingness raised to 8 (was 7)
    - WorkAgainstWillingness raised to 6 (was 2)
    - Chattiness set to 4

  * Theodora
    - WorkWithWillingness lowered to 9 (was 10)
    - WorkAgainstWillingness raised to 10 (was 8)
    - Chattiness set to 10

  * Washington
    - WorkWithWillingness remains at 8
    - WorkAgainstWillingness remains at 9
    - Chattiness set to 7

  * William
    - WorkWithWillingness remains at 10
    - WorkAgainstWillingness raised to 4 (was 3)
    - Chattiness set to 6

  * Wu Zetian
    - WorkWithWillingness remains at 5
    - WorkAgainstWillingness raised to 12 (was 10)
    - Chattiness set to 5
1) Flat unhappy reduction had quadratic modifier scaling. Seems inappropriate, the value does not change no matter how far below the threshold you are.

2) Happiness boolean divided total score even if the project had non-happiness related effects. Refactor to enter into each effect individually

3) The new CitySupplyFlat and Event-starting columns were not scored. The latter needs something heuristic or AI won't know about special effects in modmods.
The old code called ImagehlpApiVersion through a typedef with the wrong
return type (DWORD instead of LPAPI_VERSION), producing garbage version
numbers in both the debug output and the minidump user stream.

The API version itself (4.0.5) is identical across all dbghelp.dll
versions from v6.11 to v10.x, so even a correct call would not help an
analyst distinguish which DLL was loaded.  The minidump module stream
already captures file versions for all loaded modules automatically.

Replace the entire ImagehlpApiVersion pipeline with GetModuleFileNameA
on the loaded dbghelp handle.  The DLL path in the user stream answers
the one question that matters for triage: did LoadBestDbgHelp load the
system version (SysWOW64) or fall back to the game-bundled one.

Removes: PFN_ImagehlpApiVersion typedef, g_dbgHelpMajor/Minor/Revision
    globals, GetProcAddress("ImagehlpApiVersion") call.
Adds: g_szDbgHelpPath (MAX_PATH), one GetModuleFileNameA call.
No new library dependencies.
Replace sprintf_s string interpolation with parameter binding (?/Bind)
for all SQL value parameters in C++ and Lua code.

C++ (6 files, 11 queries):
- CvInfos.cpp: HandicapInfo_Goodies, GameSpeed_Turns (count+select),
  Resource_QuantityTypes, BuildFeatures
- CvProjectClasses.cpp: Project_VictoryThresholds
- CvPromotionClasses.cpp: UnitPromotions_UnitName
- CvDllDatabaseUtility.cpp: PostDefines ROWID lookup, DatabaseRemapper UPDATE
  (converted to prepare-once with Bind/Execute/Reset per row)
- CustomMods.cpp: CustomModPostDefines ROWID lookup

GameSpeed_Turns count query changed from SingleResult to Results because
SingleResult auto-steps in SetCommand() before Bind() can be called.

Lua (1 file, 2 queries):
- CivilopediaScreen.lua (x2): Leader_Traits JOIN query

Add DB.Analyze() call in CvDllDatabaseUtility::CacheGameDatabaseData()
after ClearCountCache() to refresh query planner statistics for the 60+
indexes added by mod SQL files.
* Add new diplomatic unit art definitions

* Update UnitArtChanges.sql

* New diplo models

Emissary (Incan scout: stick and cloak, with gold chest), Envoy (tabard and fluffy hat), Diplomat (jacket and powder wig)
With edited .dds so the cloak, tabard, and jacket display player color

* Update Vox Populi.civ5proj

* delete sql

we do xml, here
you can't sit with us

* Upload black-suit Archaeologist

* Upload modern great diplomat

* new assets and reorganized folders

* Add GreatDiplomat models and update Envoy paths

Added new GreatDiplomat unit models and updated Envoy references.

* Add Ambassador unit

* Add ambassador and great diplomat 3 unit definitions

* Add ambassador unit art and update models

Added new ambassador unit art and updated existing unit models.

* DXT5 compression and mipmaps for all edited textures

* final assignments, includes new female diplomat

* new icons, including new "uncompressed" xcf (ofc this has been compressed once, now...)

* Update art Credits

---------

Co-authored-by: axatin <95587882+axatin@users.noreply.github.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.

10 participants