mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 22:41:46 +00:00
Fixed the "within current selection" option in Find & Replace mode
This commit is contained in:
parent
9b8e06299a
commit
db132c30e8
15 changed files with 86 additions and 18 deletions
|
@ -1066,6 +1066,31 @@ namespace CodeImp.DoomBuilder.Map
|
|||
}
|
||||
}
|
||||
|
||||
// Returns a collection of sidedefs that match a selected linedefs state
|
||||
public ICollection<Sidedef> GetSidedefsFromSelectedLinedefs(bool selected)
|
||||
{
|
||||
if(selected)
|
||||
{
|
||||
List<Sidedef> list = new List<Sidedef>(sel_linedefs.Count);
|
||||
foreach(Linedef ld in sel_linedefs)
|
||||
{
|
||||
if(ld.Front != null) list.Add(ld.Front);
|
||||
if(ld.Back != null) list.Add(ld.Back);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
else
|
||||
{
|
||||
List<Sidedef> list = new List<Sidedef>(linedefs.Count - sel_linedefs.Count);
|
||||
foreach(Linedef ld in linedefs)
|
||||
{
|
||||
if(!ld.Selected && (ld.Front != null)) list.Add(ld.Front);
|
||||
if(!ld.Selected && (ld.Back != null)) list.Add(ld.Back);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
// Returns a collection of sectors that match a selected state
|
||||
public ICollection<Sector> GetSelectedSectors(bool selected)
|
||||
{
|
||||
|
|
|
@ -106,9 +106,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
// Interpret the find
|
||||
long longfind = Lump.MakeLongName(value.Trim());
|
||||
|
||||
|
||||
// Where to search?
|
||||
ICollection<Sector> seclist = withinselection ? General.Map.Map.GetSelectedSectors(true) : General.Map.Map.Sectors;
|
||||
ICollection<Sidedef> sidelist = withinselection ? General.Map.Map.GetSidedefsFromSelectedLinedefs(true) : General.Map.Map.Sidedefs;
|
||||
|
||||
// Go for all sectors
|
||||
foreach(Sector s in General.Map.Map.Sectors)
|
||||
foreach(Sector s in seclist)
|
||||
{
|
||||
// Flat matches?
|
||||
if(s.LongCeilTexture == longfind)
|
||||
|
@ -127,7 +131,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
// Go for all sidedefs
|
||||
foreach(Sidedef sd in General.Map.Map.Sidedefs)
|
||||
foreach(Sidedef sd in sidelist)
|
||||
{
|
||||
string side = sd.IsFront ? "front" : "back";
|
||||
|
||||
|
|
|
@ -111,8 +111,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
int tag = 0;
|
||||
if(int.TryParse(value, out tag))
|
||||
{
|
||||
// Where to search?
|
||||
ICollection<Linedef> list = withinselection ? General.Map.Map.GetSelectedLinedefs(true) : General.Map.Map.Linedefs;
|
||||
|
||||
// Go for all linedefs
|
||||
foreach(Linedef l in General.Map.Map.Linedefs)
|
||||
foreach(Linedef l in list)
|
||||
{
|
||||
bool addline = false;
|
||||
|
||||
|
|
|
@ -110,8 +110,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
int tag = 0;
|
||||
if(int.TryParse(value, out tag))
|
||||
{
|
||||
// Where to search?
|
||||
ICollection<Linedef> list = withinselection ? General.Map.Map.GetSelectedLinedefs(true) : General.Map.Map.Linedefs;
|
||||
|
||||
// Go for all linedefs
|
||||
foreach(Linedef l in General.Map.Map.Linedefs)
|
||||
foreach(Linedef l in list)
|
||||
{
|
||||
// Tag matches?
|
||||
if(l.Tag == tag)
|
||||
|
|
|
@ -111,8 +111,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
int tag = 0;
|
||||
if(int.TryParse(value, out tag))
|
||||
{
|
||||
// Where to search?
|
||||
ICollection<Linedef> list = withinselection ? General.Map.Map.GetSelectedLinedefs(true) : General.Map.Map.Linedefs;
|
||||
|
||||
// Go for all linedefs
|
||||
foreach(Linedef l in General.Map.Map.Linedefs)
|
||||
foreach(Linedef l in list)
|
||||
{
|
||||
bool addline = false;
|
||||
|
||||
|
|
|
@ -105,8 +105,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
int action = 0;
|
||||
if(int.TryParse(value, out action))
|
||||
{
|
||||
// Where to search?
|
||||
ICollection<Linedef> list = withinselection ? General.Map.Map.GetSelectedLinedefs(true) : General.Map.Map.Linedefs;
|
||||
|
||||
// Go for all linedefs
|
||||
foreach(Linedef l in General.Map.Map.Linedefs)
|
||||
foreach(Linedef l in list)
|
||||
{
|
||||
// Action matches?
|
||||
if(l.Action == action)
|
||||
|
|
|
@ -106,8 +106,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
int effect = 0;
|
||||
if(int.TryParse(value, out effect))
|
||||
{
|
||||
// Where to search?
|
||||
ICollection<Sector> list = withinselection ? General.Map.Map.GetSelectedSectors(true) : General.Map.Map.Sectors;
|
||||
|
||||
// Go for all sectors
|
||||
foreach(Sector s in General.Map.Map.Sectors)
|
||||
foreach(Sector s in list)
|
||||
{
|
||||
// Tag matches?
|
||||
if(s.Effect == effect)
|
||||
|
|
|
@ -99,9 +99,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
// Interpret the find
|
||||
long longfind = Lump.MakeLongName(value.Trim());
|
||||
|
||||
|
||||
// Where to search?
|
||||
ICollection<Sector> list = withinselection ? General.Map.Map.GetSelectedSectors(true) : General.Map.Map.Sectors;
|
||||
|
||||
// Go for all sectors
|
||||
foreach(Sector s in General.Map.Map.Sectors)
|
||||
foreach(Sector s in list)
|
||||
{
|
||||
// Flat matches?
|
||||
if(s.LongCeilTexture == longfind)
|
||||
|
|
|
@ -103,8 +103,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
int tag = 0;
|
||||
if(int.TryParse(value, out tag))
|
||||
{
|
||||
// Where to search?
|
||||
ICollection<Sector> list = withinselection ? General.Map.Map.GetSelectedSectors(true) : General.Map.Map.Sectors;
|
||||
|
||||
// Go for all sectors
|
||||
foreach(Sector s in General.Map.Map.Sectors)
|
||||
foreach(Sector s in list)
|
||||
{
|
||||
// Tag matches?
|
||||
if(s.Tag == tag)
|
||||
|
|
|
@ -99,9 +99,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
// Interpret the find
|
||||
long longfind = Lump.MakeLongName(value.Trim());
|
||||
|
||||
|
||||
// Where to search?
|
||||
ICollection<Sidedef> list = withinselection ? General.Map.Map.GetSidedefsFromSelectedLinedefs(true) : General.Map.Map.Sidedefs;
|
||||
|
||||
// Go for all sidedefs
|
||||
foreach(Sidedef sd in General.Map.Map.Sidedefs)
|
||||
foreach(Sidedef sd in list)
|
||||
{
|
||||
string side = sd.IsFront ? "front" : "back";
|
||||
|
||||
|
|
|
@ -113,8 +113,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
int findaction = 0;
|
||||
if(int.TryParse(value, out findaction))
|
||||
{
|
||||
// Where to search?
|
||||
ICollection<Thing> list = withinselection ? General.Map.Map.GetSelectedThings(true) : General.Map.Map.Things;
|
||||
|
||||
// Go for all things
|
||||
foreach(Thing t in General.Map.Map.Things)
|
||||
foreach(Thing t in list)
|
||||
{
|
||||
// Match?
|
||||
if(t.Action == findaction)
|
||||
|
|
|
@ -111,8 +111,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
int tag = 0;
|
||||
if(int.TryParse(value, out tag))
|
||||
{
|
||||
// Where to search?
|
||||
ICollection<Thing> list = withinselection ? General.Map.Map.GetSelectedThings(true) : General.Map.Map.Things;
|
||||
|
||||
// Go for all things
|
||||
foreach(Thing t in General.Map.Map.Things)
|
||||
foreach(Thing t in list)
|
||||
{
|
||||
bool addthing = false;
|
||||
|
||||
|
|
|
@ -110,8 +110,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
int tag = 0;
|
||||
if(int.TryParse(value, out tag))
|
||||
{
|
||||
// Where to search?
|
||||
ICollection<Thing> list = withinselection ? General.Map.Map.GetSelectedThings(true) : General.Map.Map.Things;
|
||||
|
||||
// Go for all things
|
||||
foreach(Thing t in General.Map.Map.Things)
|
||||
foreach(Thing t in list)
|
||||
{
|
||||
// Match?
|
||||
if(t.Tag == tag)
|
||||
|
|
|
@ -111,8 +111,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
int tag = 0;
|
||||
if(int.TryParse(value, out tag))
|
||||
{
|
||||
// Where to search?
|
||||
ICollection<Thing> list = withinselection ? General.Map.Map.GetSelectedThings(true) : General.Map.Map.Things;
|
||||
|
||||
// Go for all things
|
||||
foreach(Thing t in General.Map.Map.Things)
|
||||
foreach(Thing t in list)
|
||||
{
|
||||
bool addthing = false;
|
||||
|
||||
|
|
|
@ -106,8 +106,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
int findtype = 0;
|
||||
if(int.TryParse(value, out findtype))
|
||||
{
|
||||
// Where to search?
|
||||
ICollection<Thing> list = withinselection ? General.Map.Map.GetSelectedThings(true) : General.Map.Map.Things;
|
||||
|
||||
// Go for all things
|
||||
foreach(Thing t in General.Map.Map.Things)
|
||||
foreach(Thing t in list)
|
||||
{
|
||||
// Match?
|
||||
if(t.Type == findtype)
|
||||
|
|
Loading…
Reference in a new issue