From 1555c163cbf8f86f8d58bde484bb7c2589efa4d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 10 Jan 2016 15:14:04 +0100 Subject: [PATCH] add singleplayer briefing extraction --- .../UtilityCommands/ImportLegacyMapCommand.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs b/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs index a1382ffebb..6d21789266 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ImportLegacyMapCommand.cs @@ -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"));