LoneGazebo / Community-Patch-DLL

Community Patch for Civilization V - Brave New World
Other
290 stars 160 forks source link

DLL - Improvements CreatesFeature an RemoveWhenComplete don't work #8789

Open gwennog opened 2 years ago

gwennog commented 2 years ago

1. Mod version, and DirectX version if reporting a graphical issue (X.Y.Z, e.g. 2.0.3, DX 10 & 11): V2.0.3

2. Mod list (if using Vox Populi only, leave blank):

3. Error description:

CreatesFeature and RemoveWhenComplete don't work despite the activation of IMPROVEMENTS_EXTENSIONS (I have not tested the others Columns)

<!-- 
Various new tables and logics for improvements. Currently, this is required to activate:
    - Column 'CreatesFeature' in 'Improvements'.
    - Column 'RandResourceChance' in 'Improvements'.
    - Column 'NewOwner' in 'Improvements'.
    - Column 'RemoveWhenComplete' in 'Improvements'.
    - Column 'QuantityRequirement' in 'Improvement_ResourceTypes'.
-->
<Row Class="4" Name="IMPROVEMENTS_EXTENSIONS" Value="0"/>

4. Steps to reproduce (optional):


Supporting information: Please note that you can attach .zip files by dragging-and-dropping them. If possible, zip up all supporting data and post that way.

  1. Log files (always attach your Logs folder, located at My Documents/My Games/Sid Meier's Civilization 5. For instructions, go to the repository's main page, under "To enable logging for bug reports"):

  2. Save game (always attach a save that was made a turn before the error; located at My Documents/My Games/Sid Meier's Civilization 5/ModdedSaves; you can change autosave frequency in the game's Options menu):

  3. CvMiniDump.dmp file (attach if experiencing a game crash. Located at Program Files/Steam/steamapps/common/Sid Meier's Civilization V):

  4. Screenshots (optional):

Padre19 commented 2 years ago

CreatesFeature works but RemoveWhenComplete not.

I use this to remove improvement and features appear instantly

function BuildMarsh(playerID, x, y, improvementID) if(improvementID == GameInfoTypes.IMPROVEMENT_MARSH) or (improvementID == GameInfoTypes.IMPROVEMENT_PLANT_FOREST) then local pPlot = Map.GetPlot( x, y ) pPlot:SetImprovementType(-1) end end GameEvents.BuildFinished.Add(BuildMarsh)

azum4roll commented 9 months ago

The whole thing

    if (eOldImprovement != eNewValue || bPillageStateChanged)
    {
        if (MOD_EVENTS_TILE_IMPROVEMENTS)
        {
            GAMEEVENTINVOKE_HOOK(GAMEEVENT_TileImprovementChanged, getX(), getY(), getOwner(), eOldImprovement, eNewValue, IsImprovementPillaged());
        }

        if (MOD_IMPROVEMENTS_EXTENSIONS && eNewValue != NO_IMPROVEMENT)
        {
            // this should be called last
            if (GC.getImprovementInfo(eNewValue)->IsRemovesSelf())
            {
                setImprovementType(NO_IMPROVEMENT);
            }
        }
    }

I don't see how this would not work.