Merge pull request #10786 from pchote/mappreview-packages

Remove internal use of map paths.
This commit is contained in:
Oliver Brakmann
2016-02-23 22:52:54 +01:00
21 changed files with 172 additions and 174 deletions

View File

@@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
readonly ScrollPanelWidget missionList;
readonly ScrollItemWidget headerTemplate;
readonly ScrollItemWidget template;
readonly Cache<MapPreview, Map> mapCache = new Cache<MapPreview, Map>(p => new Map(p.Path));
readonly Cache<MapPreview, Map> mapCache;
MapPreview selectedMapPreview;
Map selectedMap;
@@ -56,6 +56,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public MissionBrowserLogic(Widget widget, World world, Action onStart, Action onExit)
{
modData = Game.ModData;
mapCache = new Cache<MapPreview, Map>(p => new Map(modData, p.Package));
this.onStart = onStart;
missionList = widget.Get<ScrollPanelWidget>("MISSION_LIST");
@@ -109,8 +110,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var missionMapPaths = kv.Value.Nodes.Select(n => Path.GetFullPath(n.Key)).ToList();
var previews = modData.MapCache
.Where(p => p.Status == MapStatus.Available && missionMapPaths.Contains(Path.GetFullPath(p.Path)))
.OrderBy(p => missionMapPaths.IndexOf(Path.GetFullPath(p.Path)));
.Where(p => p.Status == MapStatus.Available && missionMapPaths.Contains(p.Package.Name))
.OrderBy(p => missionMapPaths.IndexOf(p.Package.Name));
CreateMissionGroup(kv.Key, previews);
allPreviews.AddRange(previews);