From 6bf66fbfc4d4532ef13a623abc6081306ffd6951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Tue, 4 Feb 2014 21:21:30 +0100 Subject: [PATCH 1/2] don't just crash when map IDs are missing spit out a warning --- OpenRA.Game/Map.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/OpenRA.Game/Map.cs b/OpenRA.Game/Map.cs index 5f36b5f4b4..f2ec745328 100644 --- a/OpenRA.Game/Map.cs +++ b/OpenRA.Game/Map.cs @@ -485,6 +485,11 @@ namespace OpenRA for (var i = Bounds.Left; i < Bounds.Right; i++) { var tr = MapTiles.Value[i, j]; + if (!tileset.Templates.ContainsKey(tr.Type)) + { + Console.WriteLine("Unknown Tile ID {0}".F(tr.Type)); + continue; + } var template = tileset.Templates[tr.Type]; if (!template.PickAny) continue; From 5e8a1710dc5955751179e3d673123989ccb84cc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Tue, 4 Feb 2014 21:22:36 +0100 Subject: [PATCH 2/2] convert tile ID 0 for RAED compatibility --- OpenRA.Utility/LegacyMapImporter.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OpenRA.Utility/LegacyMapImporter.cs b/OpenRA.Utility/LegacyMapImporter.cs index 191aaadcd3..30262b8902 100644 --- a/OpenRA.Utility/LegacyMapImporter.cs +++ b/OpenRA.Utility/LegacyMapImporter.cs @@ -240,7 +240,10 @@ namespace OpenRA.Utility for (int j = 0; j < mapSize; j++) for (int i = 0; i < mapSize; i++) - map.MapTiles.Value[i, j].Type = ms.ReadUInt16(); + { + var tileID = ms.ReadUInt16(); + map.MapTiles.Value[i, j].Type = tileID == (ushort)0 ? (ushort)255 : tileID; // RAED weirdness + } for (int j = 0; j < mapSize; j++) for (int i = 0; i < mapSize; i++)