Add dynamic map refresh

This commit is contained in:
Gustas
2022-02-10 14:57:43 +02:00
committed by Matthias Mailänder
parent 61df7974b0
commit b254eb0f3d
6 changed files with 263 additions and 46 deletions

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2021 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2022 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of
@@ -178,10 +178,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var combinedPath = Platform.ResolvePath(Path.Combine(selectedDirectory.Folder.Name, filename.Text + fileTypes[fileType].Extension));
// Invalidate the old map metadata
if (map.Uid != null && map.Package != null && map.Package.Name == combinedPath)
modData.MapCache[map.Uid].Invalidate();
try
{
if (!(map.Package is IReadWritePackage package) || package.Name != combinedPath)
@@ -195,9 +191,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
map.Save(package);
// Update the map cache so it can be loaded without restarting the game
modData.MapCache[map.Uid].UpdateFromMap(map.Package, selectedDirectory.Folder, selectedDirectory.Classification, null, map.Grid.Type);
Console.WriteLine("Saved current map at {0}", combinedPath);
Ui.CloseWindow();