Merge pull request #4237 from Mailaender/map-lint

Allow map.yaml checks with OpenRA.Lint.exe
This commit is contained in:
Paul Chote
2013-12-06 02:12:55 -08:00
3 changed files with 21 additions and 10 deletions

View File

@@ -100,6 +100,7 @@ NEW:
Fixed 'make docs' crashing when the game assets are not installed.
Renamed Game.Mods launch argument to Game.Mod.
Linux packages now install to /usr/lib/openra for consistency with other Mono applications.
Added an optional map.yaml check to the OpenRA.Lint.exe command line tool.
Mod / Custom map compatibility:
Mods can now include traits from TD and D2K in RA.
Mods can now customize UI text settings like font type/color/contrast for most widgets and set global defaults in metrics.yaml.

View File

@@ -219,14 +219,14 @@ PROGRAMS += ralint
ralint: $(ralint_TARGET)
test:
@mono --debug OpenRA.Lint.exe ra
@echo "OpenRA.Lint: ra mod yaml checks passed."
@mono --debug OpenRA.Lint.exe cnc
@echo "OpenRA.Lint: cnc mod yaml checks passed."
@mono --debug OpenRA.Lint.exe d2k
@echo "OpenRA.Lint: d2k mod yaml checks passed."
@mono --debug OpenRA.Lint.exe ts
@echo "OpenRA.Lint: ts mod yaml checks passed."
@echo "OpenRA.Lint: checking Red Alert mod MiniYAML..."
@mono --debug OpenRA.Lint.exe --verbose ra
@echo "OpenRA.Lint: checking Tiberian Dawn mod MiniYAML..."
@mono --debug OpenRA.Lint.exe --verbose cnc
@echo "OpenRA.Lint: checking Dune 2000 mod MiniYAML..."
@mono --debug OpenRA.Lint.exe --verbose d2k
@echo "OpenRA.Lint: checking Tiberian Sun mod MiniYAML..."
@mono --debug OpenRA.Lint.exe --verbose ts
# Builds and exports tilesets from a bitmap
tsbuild_SRCS := $(shell find OpenRA.TilesetBuilder/ -iname '*.cs')

View File

@@ -32,11 +32,17 @@ namespace OpenRA.Lint
static int Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("Usage: OpenRA.Lint.exe MOD [MAP] [--verbose]");
return 0;
}
try
{
var options = args.Where(a => a.StartsWith("-"));
var mod = args.Where(a => !options.Contains(a)).First();
var map = args.Where(a => !options.Contains(a)).Skip(1).FirstOrDefault();
var verbose = options.Contains("-v") || options.Contains("--verbose");
// bind some nonfatal error handling into FieldLoader, so we don't just *explode*.
@@ -45,7 +51,11 @@ namespace OpenRA.Lint
AppDomain.CurrentDomain.AssemblyResolve += FileSystem.ResolveAssembly;
Game.modData = new ModData(mod);
Rules.LoadRules(Game.modData.Manifest, new Map());
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<ILintPass>())