From a64e17edc54ab062afa49e05081d0ccee5ad35cb Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Mon, 10 May 2010 21:28:31 +1200 Subject: [PATCH] fix more broken templates --- OpenRA.FileFormats/Map/Walkability.cs | 11 ++++++++--- mods/ra/templates.ini | 6 ++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/OpenRA.FileFormats/Map/Walkability.cs b/OpenRA.FileFormats/Map/Walkability.cs index 9a2235b9fb..4e9c1f71c2 100644 --- a/OpenRA.FileFormats/Map/Walkability.cs +++ b/OpenRA.FileFormats/Map/Walkability.cs @@ -59,17 +59,22 @@ namespace OpenRA.FileFormats foreach (var section in file.Sections) { + var name = section.GetValue("Name", null).ToLowerInvariant(); + if (!section.Contains("width") || !section.Contains("height")) + throw new InvalidOperationException("no width/height for template `{0}`".F(name)); + var tile = new TileTemplate { + Name = name, Size = new int2( - int.Parse(section.GetValue("width", "0")), - int.Parse(section.GetValue("height", "0"))), + int.Parse(section.GetValue("width", "--")), + int.Parse(section.GetValue("height", "--"))), TerrainType = section .Where(p => p.Key.StartsWith("tiletype")) .ToDictionary( p => int.Parse(p.Key.Substring(8)), p => (TerrainType)Enum.Parse(typeof(TerrainType),p.Value)), - Name = section.GetValue("Name", null).ToLowerInvariant(), + Bridge = section.GetValue("bridge", null), HP = float.Parse(section.GetValue("hp", "0")) }; diff --git a/mods/ra/templates.ini b/mods/ra/templates.ini index 7c1bfee8ee..44be758ec9 100644 --- a/mods/ra/templates.ini +++ b/mods/ra/templates.ini @@ -2482,10 +2482,14 @@ tiletype1=3 [TEM227] Name=D44 +width=1 +height=1 tiletype0=2 [TEM228] Name=D45 +width=1 +height=1 tiletype0=2 [TEM229] @@ -2797,6 +2801,8 @@ tiletype8=0 [TEM255] Name=CLEAR1 +width=1 +height=1 tiletype0=0 tiletype1=0 tiletype2=0