mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-07 08:21:59 +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
|
// Make lists
|
||||||
visiblethings = new List<Thing>(General.Map.Map.Things);
|
visiblethings = new List<Thing>(General.Map.Map.Things);
|
||||||
hiddenthings = new List<Thing>(0);
|
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
|
#endregion
|
||||||
|
|
|
@ -56,6 +56,7 @@ namespace CodeImp.DoomBuilder.Editing
|
||||||
// List of things
|
// List of things
|
||||||
protected List<Thing> visiblethings;
|
protected List<Thing> visiblethings;
|
||||||
protected List<Thing> hiddenthings;
|
protected List<Thing> hiddenthings;
|
||||||
|
protected Dictionary<Thing, bool> thingsvisiblestate;
|
||||||
|
|
||||||
// Disposing
|
// Disposing
|
||||||
protected bool isdisposed = false;
|
protected bool isdisposed = false;
|
||||||
|
@ -142,6 +143,7 @@ namespace CodeImp.DoomBuilder.Editing
|
||||||
// Clean up
|
// Clean up
|
||||||
visiblethings = null;
|
visiblethings = null;
|
||||||
hiddenthings = null;
|
hiddenthings = null;
|
||||||
|
thingsvisiblestate = null;
|
||||||
|
|
||||||
// Done
|
// Done
|
||||||
isdisposed = true;
|
isdisposed = true;
|
||||||
|
@ -152,6 +154,14 @@ namespace CodeImp.DoomBuilder.Editing
|
||||||
|
|
||||||
#region ================== Methods
|
#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
|
// This writes the filter to configuration
|
||||||
internal void WriteSettings(Configuration cfg, string path)
|
internal void WriteSettings(Configuration cfg, string path)
|
||||||
{
|
{
|
||||||
|
@ -182,14 +192,18 @@ namespace CodeImp.DoomBuilder.Editing
|
||||||
// Clear lists
|
// Clear lists
|
||||||
visiblethings = null;
|
visiblethings = null;
|
||||||
hiddenthings = null;
|
hiddenthings = null;
|
||||||
|
thingsvisiblestate = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This updates the list of things
|
/// <summary>
|
||||||
|
/// This updates the list of things.
|
||||||
|
/// </summary>
|
||||||
public virtual void Update()
|
public virtual void Update()
|
||||||
{
|
{
|
||||||
// Make new list
|
// Make new list
|
||||||
visiblethings = new List<Thing>(General.Map.Map.Things.Count);
|
visiblethings = new List<Thing>(General.Map.Map.Things.Count);
|
||||||
hiddenthings = 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)
|
foreach(Thing t in General.Map.Map.Things)
|
||||||
{
|
{
|
||||||
bool qualifies;
|
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);
|
if(qualifies) visiblethings.Add(t); else hiddenthings.Add(t);
|
||||||
|
thingsvisiblestate.Add(t, qualifies);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -341,20 +341,24 @@ namespace CodeImp.DoomBuilder.VisualModes
|
||||||
{
|
{
|
||||||
VisualThing vt;
|
VisualThing vt;
|
||||||
|
|
||||||
if(allthings.ContainsKey(t))
|
// Not filtered out?
|
||||||
|
if(General.Map.ThingsFilter.IsThingVisible(t))
|
||||||
{
|
{
|
||||||
vt = allthings[t];
|
if(allthings.ContainsKey(t))
|
||||||
}
|
{
|
||||||
else
|
vt = allthings[t];
|
||||||
{
|
}
|
||||||
// Create new visual thing
|
else
|
||||||
vt = CreateVisualThing(t);
|
{
|
||||||
if(vt != null) allthings.Add(t, vt);
|
// Create new visual thing
|
||||||
}
|
vt = CreateVisualThing(t);
|
||||||
|
if(vt != null) allthings.Add(t, vt);
|
||||||
|
}
|
||||||
|
|
||||||
if(vt != null)
|
if(vt != null)
|
||||||
{
|
{
|
||||||
visiblethings.Add(vt);
|
visiblethings.Add(vt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue