From b9f7fb4ebc6acfa769295e9ac0e08838370133d5 Mon Sep 17 00:00:00 2001 From: Visa Varjus Date: Thu, 17 Sep 2015 19:56:19 +0300 Subject: [PATCH] adds map filtering by PlayerCount --- OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs index 175f0bbae5..0e6dbcfbcf 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs @@ -200,11 +200,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic void EnumerateMaps(MapClassification tab, ScrollItemWidget template) { + int playerCountFilter; + if (!int.TryParse(mapFilter, out playerCountFilter)) + playerCountFilter = -1; + var maps = tabMaps[tab] .Where(m => gameMode == null || m.Type == gameMode) .Where(m => mapFilter == null || m.Title.IndexOf(mapFilter, StringComparison.OrdinalIgnoreCase) >= 0 || - m.Author.IndexOf(mapFilter, StringComparison.OrdinalIgnoreCase) >= 0) + m.Author.IndexOf(mapFilter, StringComparison.OrdinalIgnoreCase) >= 0 || + m.PlayerCount == playerCountFilter) .OrderBy(m => m.PlayerCount) .ThenBy(m => m.Title);