Allow passing map author as an argument
This commit is contained in:
committed by
Matthias Mailänder
parent
459bbf0025
commit
6193da6899
@@ -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
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user