diff --git a/Source/Plugins/BuilderModes/FindReplace/FindLinedefTags.cs b/Source/Plugins/BuilderModes/FindReplace/FindLinedefTags.cs index 86cb459..82f8660 100644 --- a/Source/Plugins/BuilderModes/FindReplace/FindLinedefTags.cs +++ b/Source/Plugins/BuilderModes/FindReplace/FindLinedefTags.cs @@ -75,6 +75,22 @@ namespace CodeImp.DoomBuilder.BuilderModes } } + // Check for comparison operators + string comparer; + if (value[0].ToString() == ">" || value[0].ToString() == "<") + { + comparer = value.Substring(0, 1); + if (value.Length > 1) + if (value[1].ToString() == "=") + comparer = value.Substring(0, 2); + value = value.Remove(0, comparer.Length); + } + else + comparer = ""; + + if (value.Length == 0) + return objs.ToArray(); + // Interpret the number given int tag; if(int.TryParse(value, out tag)) @@ -86,8 +102,16 @@ namespace CodeImp.DoomBuilder.BuilderModes foreach(Linedef l in list) { // Tag matches? - int index = l.Tags.IndexOf(tag); - if(index != -1) + int index = -1; + for (int i = 0; i < l.Tags.Count; i++) + if ((l.Tags[i] == tag && comparer.ToString() == "") || + (l.Tags[i] > tag && comparer.ToString() == ">") || + (l.Tags[i] < tag && comparer.ToString() == "<") || + (l.Tags[i] >= tag && comparer.ToString() == ">=") || + (l.Tags[i] <= tag && comparer.ToString() == "<=")) + index = l.Tags[i]; + + if (index != -1) { // Replace if(replace) diff --git a/Source/Plugins/BuilderModes/FindReplace/FindSectorBrightness.cs b/Source/Plugins/BuilderModes/FindReplace/FindSectorBrightness.cs index 752ad31..1437fdd 100644 --- a/Source/Plugins/BuilderModes/FindReplace/FindSectorBrightness.cs +++ b/Source/Plugins/BuilderModes/FindReplace/FindSectorBrightness.cs @@ -35,6 +35,22 @@ namespace CodeImp.DoomBuilder.BuilderModes } } + // Check for comparison operators + string comparer; + if (value[0].ToString() == ">" || value[0].ToString() == "<") + { + comparer = value.Substring(0, 1); + if (value.Length > 1) + if (value[1].ToString() == "=") + comparer = value.Substring(0, 2); + value = value.Remove(0, comparer.Length); + } + else + comparer = ""; + + if (value.Length == 0) + return objs.ToArray(); + // Interpret the number given int brightness; if(int.TryParse(value, out brightness)) @@ -46,7 +62,11 @@ namespace CodeImp.DoomBuilder.BuilderModes foreach(Sector s in list) { // Brightness matches? - if(s.Brightness == brightness) + if ((s.Brightness == brightness && comparer.ToString() == "") || + (s.Brightness > brightness && comparer.ToString() == ">") || + (s.Brightness < brightness && comparer.ToString() == "<") || + (s.Brightness >= brightness && comparer.ToString() == ">=") || + (s.Brightness <= brightness && comparer.ToString() == "<=")) { // Replace if(replace) s.Brightness = replacebrightness; diff --git a/Source/Plugins/BuilderModes/FindReplace/FindSectorCeilingHeight.cs b/Source/Plugins/BuilderModes/FindReplace/FindSectorCeilingHeight.cs index 5cd123e..9e0465e 100644 --- a/Source/Plugins/BuilderModes/FindReplace/FindSectorCeilingHeight.cs +++ b/Source/Plugins/BuilderModes/FindReplace/FindSectorCeilingHeight.cs @@ -33,6 +33,22 @@ namespace CodeImp.DoomBuilder.BuilderModes.FindReplace } } + // Check for comparison operators + string comparer; + if (value[0].ToString() == ">" || value[0].ToString() == "<") + { + comparer = value.Substring(0, 1); + if (value.Length > 1) + if (value[1].ToString() == "=") + comparer = value.Substring(0, 2); + value = value.Remove(0, comparer.Length); + } + else + comparer = ""; + + if (value.Length == 0) + return objs.ToArray(); + // Interpret the number given int height; if(int.TryParse(value, out height)) @@ -44,7 +60,11 @@ namespace CodeImp.DoomBuilder.BuilderModes.FindReplace foreach(Sector s in list) { // Height matches? - if(s.CeilHeight == height) + if ((s.CeilHeight == height && comparer.ToString() == "") || + (s.CeilHeight > height && comparer.ToString() == ">") || + (s.CeilHeight < height && comparer.ToString() == "<") || + (s.CeilHeight >= height && comparer.ToString() == ">=") || + (s.CeilHeight <= height && comparer.ToString() == "<=")) { // Replace if(replace) s.CeilHeight = replaceheight; diff --git a/Source/Plugins/BuilderModes/FindReplace/FindSectorFloorHeight.cs b/Source/Plugins/BuilderModes/FindReplace/FindSectorFloorHeight.cs index 05316e6..4393eb4 100644 --- a/Source/Plugins/BuilderModes/FindReplace/FindSectorFloorHeight.cs +++ b/Source/Plugins/BuilderModes/FindReplace/FindSectorFloorHeight.cs @@ -33,6 +33,22 @@ namespace CodeImp.DoomBuilder.BuilderModes.FindReplace } } + // Check for comparison operators + string comparer; + if (value[0].ToString() == ">" || value[0].ToString() == "<") + { + comparer = value.Substring(0, 1); + if (value.Length > 1) + if (value[1].ToString() == "=") + comparer = value.Substring(0, 2); + value = value.Remove(0, comparer.Length); + } + else + comparer = ""; + + if (value.Length == 0) + return objs.ToArray(); + // Interpret the number given int height; if(int.TryParse(value, out height)) @@ -44,7 +60,11 @@ namespace CodeImp.DoomBuilder.BuilderModes.FindReplace foreach(Sector s in list) { // Height matches? - if(s.FloorHeight == height) + if ((s.FloorHeight == height && comparer.ToString() == "") || + (s.FloorHeight > height && comparer.ToString() == ">") || + (s.FloorHeight < height && comparer.ToString() == "<") || + (s.FloorHeight >= height && comparer.ToString() == ">=") || + (s.FloorHeight <= height && comparer.ToString() == "<=")) { // Replace if(replace) s.FloorHeight = replaceheight; diff --git a/Source/Plugins/BuilderModes/FindReplace/FindSectorTags.cs b/Source/Plugins/BuilderModes/FindReplace/FindSectorTags.cs index 5668ee1..f06b6a6 100644 --- a/Source/Plugins/BuilderModes/FindReplace/FindSectorTags.cs +++ b/Source/Plugins/BuilderModes/FindReplace/FindSectorTags.cs @@ -68,7 +68,23 @@ namespace CodeImp.DoomBuilder.BuilderModes return objs.ToArray(); } } - + + // Check for comparison operators + string comparer; + if (value[0].ToString() == ">" || value[0].ToString() == "<") + { + comparer = value.Substring(0, 1); + if (value.Length > 1) + if (value[1].ToString() == "=") + comparer = value.Substring(0, 2); + value = value.Remove(0, comparer.Length); + } + else + comparer = ""; + + if (value.Length == 0) + return objs.ToArray(); + // Interpret the number given int tag; if(int.TryParse(value, out tag)) @@ -80,8 +96,15 @@ namespace CodeImp.DoomBuilder.BuilderModes foreach(Sector s in list) { // Tag matches? - int index = s.Tags.IndexOf(tag); - if(index != -1) + int index = -1; + for (int i = 0; i < s.Tags.Count; i++) + if ((s.Tags[i] == tag && comparer.ToString() == "") || + (s.Tags[i] > tag && comparer.ToString() == ">") || + (s.Tags[i] < tag && comparer.ToString() == "<") || + (s.Tags[i] >= tag && comparer.ToString() == ">=") || + (s.Tags[i] <= tag && comparer.ToString() == "<=")) + index = s.Tags[i]; + if (index != -1) { // Replace if(replace) diff --git a/Source/Plugins/BuilderModes/FindReplace/FindThingAngle.cs b/Source/Plugins/BuilderModes/FindReplace/FindThingAngle.cs index fc8c81a..1420da1 100644 --- a/Source/Plugins/BuilderModes/FindReplace/FindThingAngle.cs +++ b/Source/Plugins/BuilderModes/FindReplace/FindThingAngle.cs @@ -82,6 +82,22 @@ namespace CodeImp.DoomBuilder.BuilderModes } } + // Check for comparison operators + string comparer; + if (value[0].ToString() == ">" || value[0].ToString() == "<") + { + comparer = value.Substring(0, 1); + if (value.Length > 1) + if (value[1].ToString() == "=") + comparer = value.Substring(0, 2); + value = value.Remove(0, comparer.Length); + } + else + comparer = ""; + + if (value.Length == 0) + return objs.ToArray(); + // Interpret the number given int angle; if(int.TryParse(value, out angle)) @@ -93,7 +109,11 @@ namespace CodeImp.DoomBuilder.BuilderModes foreach(Thing t in list) { // Match? - if(t.AngleDoom == angle) + if ((t.AngleDoom == angle && comparer.ToString() == "") || + (t.AngleDoom > angle && comparer.ToString() == ">") || + (t.AngleDoom < angle && comparer.ToString() == "<") || + (t.AngleDoom >= angle && comparer.ToString() == ">=") || + (t.AngleDoom <= angle && comparer.ToString() == "<=")) { // Replace if(replace) t.Rotate(replaceangle); diff --git a/Source/Plugins/BuilderModes/FindReplace/FindThingType.cs b/Source/Plugins/BuilderModes/FindReplace/FindThingType.cs index e366f34..2c2cdda 100644 --- a/Source/Plugins/BuilderModes/FindReplace/FindThingType.cs +++ b/Source/Plugins/BuilderModes/FindReplace/FindThingType.cs @@ -84,6 +84,22 @@ namespace CodeImp.DoomBuilder.BuilderModes } } + // Check for comparison operators + string comparer; + if (value[0].ToString() == ">" || value[0].ToString() == "<") + { + comparer = value.Substring(0, 1); + if (value.Length > 1) + if (value[1].ToString() == "=") + comparer = value.Substring(0, 2); + value = value.Remove(0, comparer.Length); + } + else + comparer = ""; + + if (value.Length == 0) + return objs.ToArray(); + // Interpret the number given int findtype; if(int.TryParse(value, out findtype)) @@ -95,7 +111,11 @@ namespace CodeImp.DoomBuilder.BuilderModes foreach(Thing t in list) { // Match? - if(t.SRB2Type == findtype) + if ((t.SRB2Type == findtype && comparer.ToString() == "") || + (t.SRB2Type > findtype && comparer.ToString() == ">") || + (t.SRB2Type < findtype && comparer.ToString() == "<") || + (t.SRB2Type >= findtype && comparer.ToString() == ">=") || + (t.SRB2Type <= findtype && comparer.ToString() == "<=")) { // Replace if(replace)