]> Dogcows Code - chaz/carfire/commitdiff
map constants should be case-insensitive
authorCharles <Charles@92bb83a3-7c8f-8a45-bc97-515c4e399668>
Mon, 12 Apr 2010 01:36:42 +0000 (01:36 +0000)
committerCharles <Charles@92bb83a3-7c8f-8a45-bc97-515c4e399668>
Mon, 12 Apr 2010 01:36:42 +0000 (01:36 +0000)
git-svn-id: https://bd85.net/svn/cs3505_group@64 92bb83a3-7c8f-8a45-bc97-515c4e399668

CarFire/CarFire/CarFire/Content/Maps/sandbox.cfmap
CarFire/CarFire/CarFire/Parse.cs

index f537127a2342610d807b6d2c8cb89064a6c92d26..48338b32e783155fd5a8f4b170bfd03a1670304f 100644 (file)
@@ -6,7 +6,7 @@
 [metadata]\r
        author = Chaz McGarvey\r
        levelname = Sandbox\r
-       type = Campaign\r
+       type = campaign\r
        dimensions = [80,21]\r
        tileset = FuturisticBuilding\r
        numplayers = <1,4>\r
index e1a482eb6a08c55398650186bdefd3f45d9fd527..169cf30a7b8340b59af9aa61aae521c9e7c04ad8 100644 (file)
@@ -101,21 +101,19 @@ namespace CarFire
         /// </summary>\r
         /// <typeparam name="T">An enumeration.</typeparam>\r
         /// <param name="atom">Text.</param>\r
-        /// <returns>The constant, or null if parsing failed.</returns>\r
+        /// <returns>The constant, or default(T) if parsing failed.</returns>\r
         public static T Constant<T>(string atom)\r
         {\r
-            string constant = String(atom);\r
-            if (constant != null)\r
+            try\r
             {\r
-                foreach (string enumConstant in System.Enum.GetNames(typeof(T)))\r
-                {\r
-                    if (constant == enumConstant)\r
-                    {\r
-                        return (T)System.Enum.Parse(typeof(T), constant);\r
-                    }\r
-                }\r
+                return (T)System.Enum.Parse(typeof(T), String(atom), true);\r
+            }\r
+#pragma warning disable 0168\r
+            catch (System.Exception ex)\r
+#pragma warning restore 0168\r
+            {\r
+                return default(T);\r
             }\r
-            return default(T);\r
         }\r
 \r
         /// <summary>\r
@@ -171,17 +169,6 @@ namespace CarFire
             return null;\r
         }\r
 \r
-        /// <summary>\r
-        /// Parses a comma-separated list of atoms.\r
-        /// </summary>\r
-        /// <param name="text">Text.</param>\r
-        /// <returns>An array of strings containing the atoms, or null\r
-        /// if parsing failed.</returns>\r
-        public static string[] ParameterList(string text)\r
-        {\r
-            return null;\r
-        }\r
-\r
         /// <summary>\r
         /// Parses a whitespace-separated list of atoms.\r
         /// </summary>\r
This page took 0.030094 seconds and 4 git commands to generate.