From 8ee504f9cf8d29112154055546e015a6ec150837 Mon Sep 17 00:00:00 2001
From: MaxED <j.maxed@gmail.com>
Date: Mon, 16 May 2016 14:04:04 +0000
Subject: [PATCH] Fixed, Tag Explorer: in some cases (for example, when
 geometry was removed implicitly by dragging geometry) the list was not
 updated. Fixed: in some cases generalized sector effect detection logic
 failed to detect a valid generalized effect. Fixed, Action selector control:
 action label was not updated when changing action number from one generalized
 effect to another.

---
 Source/Core/Config/GameConfiguration.cs         |  2 +-
 Source/Core/Controls/ActionSelectorControl.cs   |  5 +++++
 .../ClassicModes/DragGeometryMode.cs            | 17 ++++++++++-------
 Source/Plugins/TagExplorer/BuilderPlug.cs       |  6 ++++++
 4 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/Source/Core/Config/GameConfiguration.cs b/Source/Core/Config/GameConfiguration.cs
index cbd6f5d76..4c9e3e04a 100644
--- a/Source/Core/Config/GameConfiguration.cs
+++ b/Source/Core/Config/GameConfiguration.cs
@@ -1052,9 +1052,9 @@ namespace CodeImp.DoomBuilder.Config
 				for(int j = options[i].Bits.Count - 1; j > -1; j--)
 				{
 					GeneralizedBit bit = options[i].Bits[j];
+					if(bit.Index > cureffect) continue;
 					if(bit.Index > 0 && (cureffect & bit.Index) == bit.Index) return true;
 					cureffect -= bit.Index;
-					if(cureffect < 1) return false;
 				}
 			}
 
diff --git a/Source/Core/Controls/ActionSelectorControl.cs b/Source/Core/Controls/ActionSelectorControl.cs
index 852e80a42..53cb82b7e 100644
--- a/Source/Core/Controls/ActionSelectorControl.cs
+++ b/Source/Core/Controls/ActionSelectorControl.cs
@@ -218,6 +218,11 @@ namespace CodeImp.DoomBuilder.Controls
 				list.SelectedIndex = itemindex;
 				list.Refresh();
 			}
+			//mxd. This may be generalized effect, and it may've changed
+			else if(itemindex == -1)
+			{
+				list.Refresh();
+			}
 
 			// Raise change event
 			//mxd. This HAS to be raised during Edit form setup, otherwise TypeHandlers in ArgumentBoxes won't be initialized
diff --git a/Source/Plugins/BuilderModes/ClassicModes/DragGeometryMode.cs b/Source/Plugins/BuilderModes/ClassicModes/DragGeometryMode.cs
index 278a82995..b84e25beb 100644
--- a/Source/Plugins/BuilderModes/ClassicModes/DragGeometryMode.cs
+++ b/Source/Plugins/BuilderModes/ClassicModes/DragGeometryMode.cs
@@ -516,14 +516,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
 							s.CeilSlopeOffset = -Vector3D.DotProduct(s.CeilSlope, new Vector3D(center + offset, ceiling.GetZ(center)));
 						}
 					}
-				}
-				
-				// Update cached values
-				General.Map.Map.Update();
 
-				// Done
-				Cursor.Current = Cursors.Default;
-				General.Map.IsChanged = true;
+					// Update cached values
+					General.Map.Map.Update();
+
+					//mxd. Let the plugins know
+					General.Editing.AcceptMode();
+
+					// Done
+					Cursor.Current = Cursors.Default;
+					General.Map.IsChanged = true;
+				}
 			}
 		}
 
diff --git a/Source/Plugins/TagExplorer/BuilderPlug.cs b/Source/Plugins/TagExplorer/BuilderPlug.cs
index d4b1e3164..ce2137e03 100644
--- a/Source/Plugins/TagExplorer/BuilderPlug.cs
+++ b/Source/Plugins/TagExplorer/BuilderPlug.cs
@@ -74,6 +74,12 @@ namespace CodeImp.DoomBuilder.TagExplorer
 			if(tagExplorer != null) tagExplorer.UpdateTreeSoon();
 		}
 
+		// Edit performed
+		public override void OnEditAccept()
+		{
+			if(tagExplorer != null) tagExplorer.UpdateTreeSoon();
+		}
+
 		public override void OnActionEnd(Actions.Action action) 
 		{
 			if(tagExplorer != null && action.Name == "builder_deleteitem")
-- 
GitLab