add singleplayer briefing extraction

This commit is contained in:
Matthias Mailänder
2016-01-10 15:14:04 +01:00
parent 5c1a236a75
commit 1555c163cb

View File

@@ -65,6 +65,8 @@ namespace OpenRA.Mods.Common.UtilityCommands
Author = "Westwood Studios"
};
Map.Description = ExtractBriefing(file);
Map.RequiresMod = Game.ModData.Manifest.Mod.Id;
SetBounds(Map, mapSection);
@@ -114,6 +116,19 @@ namespace OpenRA.Mods.Common.UtilityCommands
public abstract void ValidateMapFormat(int format);
static string ExtractBriefing(IniFile file)
{
var briefingSection = file.GetSection("Briefing", true);
if (briefingSection == null)
return string.Empty;
var briefing = new StringBuilder();
foreach (var s in briefingSection)
briefing.AppendLine(s.Value);
return briefing.Replace("\n", " ").ToString();
}
static void SetBounds(Map map, IniSection mapSection)
{
var offsetX = Exts.ParseIntegerInvariant(mapSection.GetValue("X", "0"));