Skip to content

Commit

Permalink
Make CampaignID default to -1, with an optional override (CnCNet#538)
Browse files Browse the repository at this point in the history
Different parsing of duplicate entries in Battle.ini between the client and the game has led to the game crashing
as the game sees duplicate entries as one entry, while the client sees them as separate entries.
Separate entries are often used by modders to add separators to the mission list.

The game is not known to really use the campaign ID for much (only the "do you need GDI/Nod/Firestorm CD" check is known),
so setting it to -1 by default should do little harm.
In case it does, there is now the possibility to manually override the campaign ID.
  • Loading branch information
Rampastring authored and SadPencil committed Oct 4, 2024
1 parent 799a3c8 commit c6aeb2c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions DXMainClient/DXGUI/Generic/CampaignSelector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,12 @@ private void LaunchMission(Mission mission)
if (UserINISettings.Instance.GameSpeed == 0)
UserINISettings.Instance.GameSpeed.Value = 1;

spawnStreamWriter.WriteLine("CampaignID=" + mission.Index);
spawnStreamWriter.WriteLine("CampaignID=" + mission.CampaignID);
spawnStreamWriter.WriteLine("GameSpeed=" + UserINISettings.Instance.GameSpeed);
#if YR || ARES
spawnStreamWriter.WriteLine("Ra2Mode=" + !mission.RequiredAddon);
#else
spawnStreamWriter.WriteLine("Firestorm=" + mission.RequiredAddon);
spawnStreamWriter.WriteLine("Firestorm=" + mission.RequiredAddon);
#endif
spawnStreamWriter.WriteLine("CustomLoadScreen=" + LoadingScreenController.GetLoadScreenName(mission.Side.ToString()));
spawnStreamWriter.WriteLine("IsSinglePlayer=Yes");
Expand Down
1 change: 1 addition & 0 deletions DXMainClient/Domain/Mission.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public Mission(IniFile iniFile, string sectionName, int index)

public int Index { get; }
public int CD { get; }
public int CampaignID { get; } = -1;
public int Side { get; }
public string Scenario { get; }
public string GUIName { get; }
Expand Down

0 comments on commit c6aeb2c

Please sign in to comment.