Fixed, "Select Similar" action: in some cases map elements flags were incorrectly compared resulting in map elements not being selected when they should have been.
This commit is contained in:
parent
e34fe0d32f
commit
98e5c5b9b4
|
@ -965,6 +965,15 @@ namespace CodeImp.DoomBuilder.Map
|
||||||
{
|
{
|
||||||
return new Dictionary<string, bool>(flags);
|
return new Dictionary<string, bool>(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//mxd. This returns enabled flags
|
||||||
|
public HashSet<string> GetEnabledFlags()
|
||||||
|
{
|
||||||
|
HashSet<string> result = new HashSet<string>();
|
||||||
|
foreach(KeyValuePair<string, bool> group in flags)
|
||||||
|
if(group.Value) result.Add(group.Key);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
// This clears all flags
|
// This clears all flags
|
||||||
public void ClearFlags()
|
public void ClearFlags()
|
||||||
|
|
|
@ -516,6 +516,15 @@ namespace CodeImp.DoomBuilder.Map
|
||||||
return new Dictionary<string, bool>(flags);
|
return new Dictionary<string, bool>(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//mxd. This returns enabled flags
|
||||||
|
public HashSet<string> GetEnabledFlags()
|
||||||
|
{
|
||||||
|
HashSet<string> result = new HashSet<string>();
|
||||||
|
foreach(KeyValuePair<string, bool> group in flags)
|
||||||
|
if(group.Value) result.Add(group.Key);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
// This clears all flags
|
// This clears all flags
|
||||||
public void ClearFlags()
|
public void ClearFlags()
|
||||||
{
|
{
|
||||||
|
|
|
@ -323,6 +323,15 @@ namespace CodeImp.DoomBuilder.Map
|
||||||
return new Dictionary<string, bool>(flags);
|
return new Dictionary<string, bool>(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//mxd. This returns enabled flags
|
||||||
|
public HashSet<string> GetEnabledFlags()
|
||||||
|
{
|
||||||
|
HashSet<string> result = new HashSet<string>();
|
||||||
|
foreach(KeyValuePair<string, bool> group in flags)
|
||||||
|
if(group.Value) result.Add(group.Key);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
// This clears all flags
|
// This clears all flags
|
||||||
public void ClearFlags()
|
public void ClearFlags()
|
||||||
{
|
{
|
||||||
|
|
|
@ -649,8 +649,17 @@ namespace CodeImp.DoomBuilder.Map
|
||||||
if (General.Map.SRB2) pos.z = value >> 4;
|
if (General.Map.SRB2) pos.z = value >> 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This clears all flags
|
//mxd. This returns enabled flags
|
||||||
public void ClearFlags()
|
public HashSet<string> GetEnabledFlags()
|
||||||
|
{
|
||||||
|
HashSet<string> result = new HashSet<string>();
|
||||||
|
foreach(KeyValuePair<string, bool> group in flags)
|
||||||
|
if(group.Value) result.Add(group.Key);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This clears all flags
|
||||||
|
public void ClearFlags()
|
||||||
{
|
{
|
||||||
BeforePropsChange();
|
BeforePropsChange();
|
||||||
|
|
||||||
|
|
|
@ -804,7 +804,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
if(flags.CeilingTexture && source.CeilTexture != target.CeilTexture) return false;
|
if(flags.CeilingTexture && source.CeilTexture != target.CeilTexture) return false;
|
||||||
if(flags.Brightness && source.Brightness != target.Brightness) return false;
|
if(flags.Brightness && source.Brightness != target.Brightness) return false;
|
||||||
if(flags.Tag && !TagsMatch(source.Tags, target.Tags)) return false;
|
if(flags.Tag && !TagsMatch(source.Tags, target.Tags)) return false;
|
||||||
if(flags.Flags && !FlagsMatch(source.GetFlags(), target.GetFlags())) return false;
|
if(flags.Flags && !FlagsMatch(source.GetEnabledFlags(), target.GetEnabledFlags())) return false;
|
||||||
|
|
||||||
// Generalized effects require more tender loving care...
|
// Generalized effects require more tender loving care...
|
||||||
if(flags.Special && source.Effect != target.Effect)
|
if(flags.Special && source.Effect != target.Effect)
|
||||||
|
@ -871,7 +871,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
if(!UniFields.ValuesMatch("arg4str", source, target)) return false;
|
if(!UniFields.ValuesMatch("arg4str", source, target)) return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(linedefflags.Flags && !FlagsMatch(source.GetFlags(), target.GetFlags())) return false;
|
if(linedefflags.Flags && !FlagsMatch(source.GetEnabledFlags(), target.GetEnabledFlags())) return false;
|
||||||
|
|
||||||
if(General.Map.UDMF)
|
if(General.Map.UDMF)
|
||||||
{
|
{
|
||||||
|
@ -907,7 +907,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
if(!General.Map.UDMF) return true;
|
if(!General.Map.UDMF) return true;
|
||||||
|
|
||||||
// UDMF-specific properties
|
// UDMF-specific properties
|
||||||
if(flags.Flags && !FlagsMatch(source.GetFlags(), target.GetFlags())) return false;
|
if(flags.Flags && !FlagsMatch(source.GetEnabledFlags(), target.GetEnabledFlags())) return false;
|
||||||
|
|
||||||
// UI fields
|
// UI fields
|
||||||
if(flags.UpperTextureScale && !UniFields.ValuesMatch("scalex_top", "scaley_top", source, target)) return false;
|
if(flags.UpperTextureScale && !UniFields.ValuesMatch("scalex_top", "scaley_top", source, target)) return false;
|
||||||
|
@ -949,7 +949,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(flags.Tag && source.Tag != target.Tag) return false;
|
if(flags.Tag && source.Tag != target.Tag) return false;
|
||||||
if(flags.Flags && !FlagsMatch(source.GetFlags(), target.GetFlags())) return false;
|
if(flags.Flags && !FlagsMatch(source.GetEnabledFlags(), target.GetEnabledFlags())) return false;
|
||||||
if(!General.Map.UDMF) return true;
|
if(!General.Map.UDMF) return true;
|
||||||
|
|
||||||
// UDMF-specific properties
|
// UDMF-specific properties
|
||||||
|
@ -973,11 +973,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private static bool FlagsMatch(Dictionary<string, bool> flags1, Dictionary<string, bool> flags2)
|
private static bool FlagsMatch(HashSet<string> flags1, HashSet<string> flags2)
|
||||||
{
|
{
|
||||||
if(flags1.Count != flags2.Count) return false;
|
if(flags1.Count != flags2.Count) return false;
|
||||||
foreach(KeyValuePair<string, bool> group in flags1)
|
foreach(string flag in flags1)
|
||||||
if(!flags2.ContainsKey(group.Key) || flags2[group.Key] != flags1[group.Key]) return false;
|
{
|
||||||
|
if(!flags2.Contains(flag)) return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue