mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-31 04:40:55 +00:00
Things filter now also hides things in le Mode de la Visuale
This commit is contained in:
parent
8c91bc30ab
commit
3c6beb1e68
3 changed files with 35 additions and 14 deletions
|
@ -63,6 +63,8 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
// Make lists
|
||||
visiblethings = new List<Thing>(General.Map.Map.Things);
|
||||
hiddenthings = new List<Thing>(0);
|
||||
thingsvisiblestate = new Dictionary<Thing, bool>(General.Map.Map.Things.Count);
|
||||
foreach(Thing t in visiblethings) thingsvisiblestate.Add(t, true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -56,6 +56,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
// List of things
|
||||
protected List<Thing> visiblethings;
|
||||
protected List<Thing> hiddenthings;
|
||||
protected Dictionary<Thing, bool> thingsvisiblestate;
|
||||
|
||||
// Disposing
|
||||
protected bool isdisposed = false;
|
||||
|
@ -142,6 +143,7 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
// Clean up
|
||||
visiblethings = null;
|
||||
hiddenthings = null;
|
||||
thingsvisiblestate = null;
|
||||
|
||||
// Done
|
||||
isdisposed = true;
|
||||
|
@ -152,6 +154,14 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
|
||||
#region ================== Methods
|
||||
|
||||
/// <summary>
|
||||
/// This checks if a thing is visible. Throws an exception when the specified Thing does not exist in the map (filter not updated?).
|
||||
/// </summary>
|
||||
public bool IsThingVisible(Thing t)
|
||||
{
|
||||
return thingsvisiblestate[t];
|
||||
}
|
||||
|
||||
// This writes the filter to configuration
|
||||
internal void WriteSettings(Configuration cfg, string path)
|
||||
{
|
||||
|
@ -182,14 +192,18 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
// Clear lists
|
||||
visiblethings = null;
|
||||
hiddenthings = null;
|
||||
thingsvisiblestate = null;
|
||||
}
|
||||
|
||||
// This updates the list of things
|
||||
/// <summary>
|
||||
/// This updates the list of things.
|
||||
/// </summary>
|
||||
public virtual void Update()
|
||||
{
|
||||
// Make new list
|
||||
visiblethings = new List<Thing>(General.Map.Map.Things.Count);
|
||||
hiddenthings = new List<Thing>(General.Map.Map.Things.Count);
|
||||
thingsvisiblestate = new Dictionary<Thing, bool>(General.Map.Map.Things.Count);
|
||||
foreach(Thing t in General.Map.Map.Things)
|
||||
{
|
||||
bool qualifies;
|
||||
|
@ -243,8 +257,9 @@ namespace CodeImp.DoomBuilder.Editing
|
|||
}
|
||||
}
|
||||
|
||||
// Put the thing in the correct list
|
||||
// Put the thing in the lists
|
||||
if(qualifies) visiblethings.Add(t); else hiddenthings.Add(t);
|
||||
thingsvisiblestate.Add(t, qualifies);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -341,20 +341,24 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
{
|
||||
VisualThing vt;
|
||||
|
||||
if(allthings.ContainsKey(t))
|
||||
// Not filtered out?
|
||||
if(General.Map.ThingsFilter.IsThingVisible(t))
|
||||
{
|
||||
vt = allthings[t];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create new visual thing
|
||||
vt = CreateVisualThing(t);
|
||||
if(vt != null) allthings.Add(t, vt);
|
||||
}
|
||||
if(allthings.ContainsKey(t))
|
||||
{
|
||||
vt = allthings[t];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create new visual thing
|
||||
vt = CreateVisualThing(t);
|
||||
if(vt != null) allthings.Add(t, vt);
|
||||
}
|
||||
|
||||
if(vt != null)
|
||||
{
|
||||
visiblethings.Add(vt);
|
||||
if(vt != null)
|
||||
{
|
||||
visiblethings.Add(vt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue