From c2b0cec2ea8892a78c6e51f1d6a717797d78ccfd Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Mon, 28 Feb 2011 22:18:44 +1300 Subject: [PATCH] add a sensible error when trying to save a map using a bogus tileset --- OpenRA.Game/Map.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/OpenRA.Game/Map.cs b/OpenRA.Game/Map.cs index cf29e55ffb..6892a782dc 100644 --- a/OpenRA.Game/Map.cs +++ b/OpenRA.Game/Map.cs @@ -375,7 +375,12 @@ namespace OpenRA // File header consists of a version byte, followed by 2 ushorts for width and height writer.Write(TileFormat); writer.Write((ushort)MapSize.X); - writer.Write((ushort)MapSize.Y); + writer.Write((ushort)MapSize.Y); + + if (!OpenRA.Rules.TileSets.ContainsKey(Tileset)) + throw new InvalidOperationException( + "Tileset used by the map ({0}) does not exist in this mod. Valid tilesets are: {1}" + .F(Tileset, string.Join(",", OpenRA.Rules.TileSets.Keys.ToArray()))); // Tile data for (int i = 0; i < MapSize.X; i++)