make forcing evaluation of lazyness explicit
This commit is contained in:
@@ -6,13 +6,13 @@
|
|||||||
* as published by the Free Software Foundation. For more information,
|
* as published by the Free Software Foundation. For more information,
|
||||||
* see COPYING.
|
* see COPYING.
|
||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Windows.Forms;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.IO;
|
using System.Windows.Forms;
|
||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
|
|
||||||
namespace OpenRA.Editor
|
namespace OpenRA.Editor
|
||||||
@@ -46,11 +46,11 @@ namespace OpenRA.Editor
|
|||||||
foreach (var path in ModData.FindMapsIn(MapFolderPath))
|
foreach (var path in ModData.FindMapsIn(MapFolderPath))
|
||||||
{
|
{
|
||||||
var map = new Map(path);
|
var map = new Map(path);
|
||||||
// Touch the lazy bits to initialize them
|
// Touch the lazy bits to initialize them
|
||||||
var foo = map.Actors.Value.Count;
|
map.Actors.Force();
|
||||||
foo = map.Smudges.Value.Count;
|
map.Smudges.Force();
|
||||||
var bar = map.MapResources.Value[0,0];
|
map.MapTiles.Force();
|
||||||
var baz = map.MapTiles.Value[0,0];
|
map.MapResources.Force();
|
||||||
map.Save(path);
|
map.Save(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,12 @@ namespace OpenRA.FileFormats
|
|||||||
p = null;
|
p = null;
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Force()
|
||||||
|
{
|
||||||
|
var ignored = Value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Lazy
|
public static class Lazy
|
||||||
|
|||||||
Reference in New Issue
Block a user