diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index f0b61be1e6..9dc0772f61 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2013 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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. For more information, @@ -355,6 +355,7 @@ namespace OpenRA modData = new ModData(mod); Renderer.InitializeFonts(modData.Manifest); modData.InitializeLoaders(); + modData.LoadMaps(); PerfHistory.items["render"].hasNormalTick = false; PerfHistory.items["batches"].hasNormalTick = false; @@ -385,7 +386,7 @@ namespace OpenRA if (Settings.Server.DedicatedLoop) { Console.WriteLine("Starting a new server instance..."); - modData.InitializeLoaders(); + modData.LoadMaps(); continue; } diff --git a/OpenRA.Game/ModData.cs b/OpenRA.Game/ModData.cs index 7c5c55b300..55ad688f56 100755 --- a/OpenRA.Game/ModData.cs +++ b/OpenRA.Game/ModData.cs @@ -76,8 +76,6 @@ namespace OpenRA SpriteLoader = new SpriteLoader(new string[0], SheetBuilder); VoxelLoader = new VoxelLoader(); CursorProvider.Initialize(Manifest.Cursors); - - AvailableMaps = FindMaps(); } public IEnumerable Languages { get; private set; } @@ -121,6 +119,11 @@ namespace OpenRA FieldLoader.Translations = translations; } + public void LoadMaps() + { + AvailableMaps = FindMaps(); + } + public Map PrepareMap(string uid) { LoadScreen.Display(); diff --git a/OpenRA.Lint/YamlChecker.cs b/OpenRA.Lint/YamlChecker.cs index 6027d38ff9..2acded35bd 100644 --- a/OpenRA.Lint/YamlChecker.cs +++ b/OpenRA.Lint/YamlChecker.cs @@ -52,27 +52,38 @@ namespace OpenRA.Lint AppDomain.CurrentDomain.AssemblyResolve += FileSystem.ResolveAssembly; Game.modData = new ModData(mod); - var testMap = string.IsNullOrEmpty(map) ? new Map() : new Map(map); - if (verbose && !string.IsNullOrEmpty(map)) - Console.WriteLine("Map: {0}".F(testMap.Title)); - Rules.LoadRules(Game.modData.Manifest, testMap); - - foreach (var customPassType in Game.modData.ObjectCreator - .GetTypesImplementing()) + var maps = new Map[] { new Map() }; + if (!string.IsNullOrEmpty(map)) + maps = new Map[] { new Map(map) }; + else { - try - { - var customPass = (ILintPass)Game.modData.ObjectCreator - .CreateBasic(customPassType); + Game.modData.LoadMaps(); + maps = Game.modData.AvailableMaps.Values.ToArray(); + } - if (verbose) - Console.WriteLine("Pass: {0}".F(customPassType.ToString())); + foreach (var testMap in maps) + { + if (verbose) + Console.WriteLine("Map: {0}".F(testMap.Title)); + Rules.LoadRules(Game.modData.Manifest, testMap); - customPass.Run(EmitError, EmitWarning, testMap); - } - catch (Exception e) + foreach (var customPassType in Game.modData.ObjectCreator + .GetTypesImplementing()) { - EmitError("Failed with exception: {0}".F(e)); + try + { + var customPass = (ILintPass)Game.modData.ObjectCreator + .CreateBasic(customPassType); + + if (verbose) + Console.WriteLine("Pass: {0}".F(customPassType.ToString())); + + customPass.Run(EmitError, EmitWarning, testMap); + } + catch (Exception e) + { + EmitError("Failed with exception: {0}".F(e)); + } } }