@@ -417,6 +417,15 @@ private void LoadCustomMissions()
417417 return ;
418418
419419 string [ ] mapFiles = Directory . GetFiles ( customMissionsDirectory , "*.map" ) ;
420+ if ( mapFiles . Length == 0 )
421+ return ;
422+
423+ // Add a dummy mission to separate custom missions from official missions
424+ IniSection customMissionSeparatorSection = new ( ) ;
425+ customMissionSeparatorSection . AddKey ( "Description" , "-------- Custom Scenarios --------" . L10N ( "Client:Main:CustomMissionSeparator" ) ) ;
426+ Mission separator = Mission . NewCustomMission ( customMissionSeparatorSection , "__XCUSTOM" , string . Empty , null ) ;
427+ AddMission ( separator ) ;
428+
420429 foreach ( string mapFilePath in mapFiles )
421430 {
422431 var mapFile = new IniFile ( mapFilePath ) ;
@@ -482,7 +491,8 @@ private bool ParseBattleIni(string path)
482491 /// Load or re-load missons with selected tags.
483492 /// </summary>
484493 /// <param name="selectedTags">Missions with at lease one of which tags to be shown. As an exception, null means show all missions.</param>
485- public void LoadMissionsWithFilter ( ISet < string > selectedTags = null )
494+ /// <param name="loadCustomMissions">True means show official missions. False means show custom missions.</param>
495+ public void LoadMissionsWithFilter ( ISet < string > selectedTags , bool loadCustomMissions = false )
486496 {
487497 lbCampaignListMissions . Clear ( ) ;
488498
@@ -497,6 +507,7 @@ public void LoadMissionsWithFilter(ISet<string> selectedTags = null)
497507
498508 // Select missions with the filter
499509 IEnumerable < Mission > missions = AllMissions ;
510+ missions = missions . Where ( mission => mission . IsCustomMission == loadCustomMissions ) ;
500511 if ( selectedTags != null )
501512 missions = missions . Where ( mission => mission . Tags . Intersect ( selectedTags ) . Any ( ) ) . ToList ( ) ;
502513 lbCampaignListMissions = missions . ToList ( ) ;
0 commit comments