Allow passing map author as an argument

This commit is contained in:
Gustas
2025-01-03 19:19:25 +02:00
committed by Matthias Mailänder
parent 459bbf0025
commit 6193da6899
5 changed files with 13 additions and 5 deletions

View File

@@ -51,6 +51,10 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
Game.ModData = ModData = utility.ModData;
var filename = args[1];
var author = args.Length > 2
? args[2]
: "Westwood Studios";
using (var stream = File.OpenRead(filename))
{
var file = new IniFile(stream);
@@ -73,7 +77,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
Map = new Map(ModData, terrainInfo, MapSize, MapSize)
{
Title = basic.GetValue("Name", Path.GetFileNameWithoutExtension(filename)),
Author = "Westwood Studios",
Author = author,
RequiresMod = ModData.Manifest.Id
};

View File

@@ -59,6 +59,10 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
Game.ModData = utility.ModData;
var filename = args[1];
var author = args.Length > 2
? args[2]
: "Westwood Studios";
var file = new IniFile(File.Open(args[1], FileMode.Open));
var basic = file.GetSection("Basic");
var mapSection = file.GetSection("Map");
@@ -75,7 +79,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
var map = new Map(Game.ModData, terrainInfo, mapCanvasSize.Width, mapCanvasSize.Height)
{
Title = basic.GetValue("Name", Path.GetFileNameWithoutExtension(filename)),
Author = "Westwood Studios",
Author = author,
RequiresMod = utility.ModData.Manifest.Id
};

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
string IUtilityCommand.Name => "--import-ra-map";
bool IUtilityCommand.ValidateArguments(string[] args) { return ValidateArguments(args); }
[Desc("FILENAME", "Convert a legacy Red Alert INI/MPR map to the OpenRA format.")]
[Desc("FILENAME [AUTHOR]", "Convert a legacy Red Alert INI/MPR map to the OpenRA format.")]
void IUtilityCommand.Run(Utility utility, string[] args) { Run(utility, args); }
public override void ValidateMapFormat(int format)

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
string IUtilityCommand.Name => "--import-td-map";
bool IUtilityCommand.ValidateArguments(string[] args) { return ValidateArguments(args); }
[Desc("FILENAME", "Convert a legacy Tiberian Dawn INI/MPR map to the OpenRA format.")]
[Desc("FILENAME [AUTHOR]", "Convert a legacy Tiberian Dawn INI/MPR map to the OpenRA format.")]
void IUtilityCommand.Run(Utility utility, string[] args) { Run(utility, args); }
public override void ValidateMapFormat(int format)

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
bool IUtilityCommand.ValidateArguments(string[] args) { return args.Length >= 2; }
[Desc("FILENAME", "Convert a Tiberian Sun map to the OpenRA format.")]
[Desc("FILENAME [AUTHOR]", "Convert a Tiberian Sun map to the OpenRA format.")]
void IUtilityCommand.Run(Utility utility, string[] args)
{
Run(utility, args);