From 42368ae530bdeb891556f04b0c03c11c0613e369 Mon Sep 17 00:00:00 2001
From: MaxED <j.maxed@gmail.com>
Date: Fri, 9 Nov 2012 17:40:47 +0000
Subject: [PATCH] Error checks mode: UDMF Thing skill flags are now also taken
 into account. Some more tweaks in ZDoom_misc.cfg

---
 Build/Configurations/Includes/ZDoom_misc.cfg | 18 ++++++++++++++-
 Source/Core/Config/ThingsFlagsCompare.cs     | 23 +++++++++++++-------
 2 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/Build/Configurations/Includes/ZDoom_misc.cfg b/Build/Configurations/Includes/ZDoom_misc.cfg
index cae622bb7..f234d0ffc 100644
--- a/Build/Configurations/Includes/ZDoom_misc.cfg
+++ b/Build/Configurations/Includes/ZDoom_misc.cfg
@@ -120,7 +120,15 @@ thingflagscompare_udmf
 	skills {
 		skill6;
 		skill7;
-		skill8;
+		skill8; 
+    skill9;
+    skill10;
+    skill11;
+    skill12;
+    skill13;
+    skill14;
+    skill15;
+    skill16;
 	}
 
 	classes {
@@ -129,6 +137,14 @@ thingflagscompare_udmf
 		class6;
 		class7;
 		class8;
+    class9;
+		class10;
+		class11;
+		class12;
+		class13;
+    class14;
+		class15;
+		class16;
 	}
 }
 
diff --git a/Source/Core/Config/ThingsFlagsCompare.cs b/Source/Core/Config/ThingsFlagsCompare.cs
index 544688642..15870c4b3 100644
--- a/Source/Core/Config/ThingsFlagsCompare.cs
+++ b/Source/Core/Config/ThingsFlagsCompare.cs
@@ -117,16 +117,23 @@ namespace CodeImp.DoomBuilder.Config
 		//	1 if the flag overlaps
 		public int Compare(Thing t1, Thing t2)
 		{
-			bool t1flag;
-			bool t2flag;
+			bool t1flag = false;
+			bool t2flag = false;
 
 			// Check if the flags exist
-			if (!t1.Flags.ContainsKey(flag) || !t2.Flags.ContainsKey(flag))
-				return 0;
-
-			// tag flag inversion into account
-			t1flag = invert ? !t1.Flags[flag] : t1.Flags[flag];
-			t2flag = invert ? !t2.Flags[flag] : t2.Flags[flag];
+			if(!t1.Flags.ContainsKey(flag) || !t2.Flags.ContainsKey(flag)) {
+				//mxd. If a map is in UDMF format - check Fields
+				if(!General.Map.UDMF || !t1.Fields.ContainsKey(flag) || !t2.Fields.ContainsKey(flag)) 
+					return 0;
+
+				// tag flag inversion into account
+				t1flag = invert ? !(bool)t1.Fields[flag].Value : (bool)t1.Fields[flag].Value;
+				t2flag = invert ? !(bool)t2.Fields[flag].Value : (bool)t2.Fields[flag].Value;
+			} else {
+				// tag flag inversion into account
+				t1flag = invert ? !t1.Flags[flag] : t1.Flags[flag];
+				t2flag = invert ? !t2.Flags[flag] : t2.Flags[flag];
+			}
 
 			if (comparemethod == CompareMethod.And && (t1flag && t2flag))
 				return 1;
-- 
GitLab