Skip to content

unify(common-ini): Move shared INI loaders to Core#2863

Open
githubawn wants to merge 2 commits into
TheSuperHackers:mainfrom
githubawn:unify/ini-multiplayer
Open

unify(common-ini): Move shared INI loaders to Core#2863
githubawn wants to merge 2 commits into
TheSuperHackers:mainfrom
githubawn:unify/ini-multiplayer

Conversation

@githubawn

Copy link
Copy Markdown

Generals gains "MultiplayerSettings::addStartingMoneyChoice", doesn't affect user facing UI.

Move 24 files from GeneralsMD/Code/GameEngine/Source/Common/INI/* to Core/GameEngine/Source/Common/INI/*

@greptile-apps

greptile-apps Bot commented Jul 8, 2026

Copy link
Copy Markdown

Greptile Summary

This PR unifies 24 shared INI loader files by moving them from GeneralsMD/Code/GameEngine/Source/Common/INI/ to Core/GameEngine/Source/Common/INI/, updating all three CMakeLists.txt files accordingly, and adding MultiplayerSettings::addStartingMoneyChoice to the Generals build (already present in GeneralsMD) so the shared Core/INIMultiplayer.cpp links correctly for both targets.

  • File movement: 24 .cpp INI loaders are deleted from Generals/ and compiled from Core/ instead; GeneralsMD follows the same pattern by commenting out its local copies.
  • New feature: addStartingMoneyChoice and m_gotDefaultStartingMoney initialisation are added to Generals/Code/GameEngine/Source/Common/MultiplayerSettings.cpp, bringing it in sync with the GeneralsMD counterpart that already carried these before this PR.
  • Script tracking: Completed unify_file calls are recorded as commented-out entries in scripts/cpp/unify_move_files.py for historical reference.

Confidence Score: 4/5

Safe to merge; the file movement is mechanical and the new Generals addStartingMoneyChoice logic exactly mirrors the already-working GeneralsMD implementation.

The only new logic is addStartingMoneyChoice in Generals MultiplayerSettings.cpp, which is a direct copy of the GeneralsMD version that was already in production. The 24 INI file moves carry no content changes. The sole finding is a 2-space vs. tab indentation mismatch in the new function body.

Generals/Code/GameEngine/Source/Common/MultiplayerSettings.cpp — indentation style of the new function differs from the rest of the file.

Important Files Changed

Filename Overview
Core/GameEngine/CMakeLists.txt Uncomments 24 INI source files now living in Core/; mirrors the inverse changes in Generals and GeneralsMD CMakeLists.
Generals/Code/GameEngine/CMakeLists.txt Comments out 24 INI source files that are now compiled from Core/ instead of the Generals-local copies.
GeneralsMD/Code/GameEngine/CMakeLists.txt Comments out the same 24 INI source files that were formerly compiled from GeneralsMD-local copies; now delegated to Core/.
Generals/Code/GameEngine/Source/Common/MultiplayerSettings.cpp Adds addStartingMoneyChoice and initialises m_gotDefaultStartingMoney in the constructor to match GeneralsMD; new function body uses 2-space indentation inconsistent with the tab-indented rest of the file.
Core/GameEngine/Source/Common/INI/INIMultiplayer.cpp Moved unchanged from GeneralsMD; includes the new parseMultiplayerStartingMoneyChoiceDefinition handler which is registered in Core/INI.cpp and declared in Core/INI.h.
scripts/cpp/unify_move_files.py Appends 24 already-executed unify_file calls as commented-out entries, serving as a historical record of what was unified in this PR.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    subgraph Before
        G_INI["Generals/Code/GameEngine/\nSource/Common/INI/*.cpp\n(24 files)"]
        MD_INI["GeneralsMD/Code/GameEngine/\nSource/Common/INI/*.cpp\n(24 files)"]
    end

    subgraph After
        CORE_INI["Core/GameEngine/\nSource/Common/INI/*.cpp\n(24 files — shared)"]
        G_CMAKE["Generals CMakeLists.txt\n(references Core/)"]
        MD_CMAKE["GeneralsMD CMakeLists.txt\n(references Core/)"]
        CORE_CMAKE["Core CMakeLists.txt\n(enables 24 files)"]
    end

    G_INI -->|"moved to"| CORE_INI
    MD_INI -->|"moved to"| CORE_INI
    CORE_INI --> CORE_CMAKE
    CORE_CMAKE --> G_CMAKE
    CORE_CMAKE --> MD_CMAKE

    subgraph MultiplayerSettings
        GMS["Generals/MultiplayerSettings.cpp\n+addStartingMoneyChoice()\n+m_gotDefaultStartingMoney=false"]
        MDMS["GeneralsMD/MultiplayerSettings.cpp\n(already had addStartingMoneyChoice)"]
        CORE_MP["Core/INI/INIMultiplayer.cpp\nparseMultiplayerStartingMoneyChoiceDefinition\n→ TheMultiplayerSettings->addStartingMoneyChoice()"]
    end

    CORE_MP --> GMS
    CORE_MP --> MDMS
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    subgraph Before
        G_INI["Generals/Code/GameEngine/\nSource/Common/INI/*.cpp\n(24 files)"]
        MD_INI["GeneralsMD/Code/GameEngine/\nSource/Common/INI/*.cpp\n(24 files)"]
    end

    subgraph After
        CORE_INI["Core/GameEngine/\nSource/Common/INI/*.cpp\n(24 files — shared)"]
        G_CMAKE["Generals CMakeLists.txt\n(references Core/)"]
        MD_CMAKE["GeneralsMD CMakeLists.txt\n(references Core/)"]
        CORE_CMAKE["Core CMakeLists.txt\n(enables 24 files)"]
    end

    G_INI -->|"moved to"| CORE_INI
    MD_INI -->|"moved to"| CORE_INI
    CORE_INI --> CORE_CMAKE
    CORE_CMAKE --> G_CMAKE
    CORE_CMAKE --> MD_CMAKE

    subgraph MultiplayerSettings
        GMS["Generals/MultiplayerSettings.cpp\n+addStartingMoneyChoice()\n+m_gotDefaultStartingMoney=false"]
        MDMS["GeneralsMD/MultiplayerSettings.cpp\n(already had addStartingMoneyChoice)"]
        CORE_MP["Core/INI/INIMultiplayer.cpp\nparseMultiplayerStartingMoneyChoiceDefinition\n→ TheMultiplayerSettings->addStartingMoneyChoice()"]
    end

    CORE_MP --> GMS
    CORE_MP --> MDMS
Loading
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
Generals/Code/GameEngine/Source/Common/MultiplayerSettings.cpp:144-153
The `addStartingMoneyChoice` function body uses 2-space indentation while the rest of this file uses tabs. This is inconsistent with the surrounding code style — for example, the `MultiplayerSettings` constructor, `newMultiplayerColorDefinition`, and the `operator=` overload all indent with tabs.

```suggestion
void MultiplayerSettings::addStartingMoneyChoice( const Money & money, Bool isDefault )
{
	m_startingMoneyList.push_back( money );
	if ( isDefault )
	{
		DEBUG_ASSERTCRASH( !m_gotDefaultStartingMoney, ("Cannot have more than one default MultiplayerStartingMoneyChoice") );
		m_defaultStartingMoney = money;
		m_gotDefaultStartingMoney = true;
	}
}
```

Reviews (1): Last reviewed commit: "unify(ini): Move INI parser files to Cor..." | Re-trigger Greptile

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.

1 participant