Rework MapCache API.

This clarifies the ownership of the underlying
IReadOnlyPackage objects, and avoids passing
around some unnecessary state.
This commit is contained in:
Paul Chote
2025-03-02 21:19:50 +00:00
committed by Gustas Kažukauskas
parent 5c0b82e65b
commit e186dc428e
7 changed files with 72 additions and 62 deletions

View File

@@ -247,7 +247,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (map.Package?.Name != combinedPath)
{
// When creating a new map or when file paths don't match
if (modData.MapCache.Any(m => m.Status == MapStatus.Available && m.PackageName == combinedPath))
if (modData.MapCache.Any(m => m.Status == MapStatus.Available && m.Path == combinedPath))
{
ConfirmationDialogs.ButtonPrompt(modData,
title: OverwriteMapFailedTitle,

View File

@@ -166,7 +166,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
.Select(p => new
{
Preview = p,
Index = missionMapPaths.IndexOf(Path.GetFileName(p.PackageName))
Index = missionMapPaths.IndexOf(Path.GetFileName(p.Path))
})
.Where(x => x.Index != -1)
.OrderBy(x => x.Index)