mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-22 20:02:48 +00:00
Small cleanup
This commit is contained in:
parent
1b93dcb114
commit
f0ad463637
2 changed files with 2 additions and 59 deletions
|
@ -1206,25 +1206,6 @@ namespace CodeImp.DoomBuilder.Data
|
|||
return result;
|
||||
}
|
||||
|
||||
//mxd
|
||||
private List<TextResourceData> GetAllLumpsDataWithPrefix(string prefix)
|
||||
{
|
||||
List<TextResourceData> result = new List<TextResourceData>();
|
||||
|
||||
// Find all lumps with given name
|
||||
int lumpindex = file.FindLumpIndexWithPrefix(prefix);
|
||||
while (lumpindex > -1)
|
||||
{
|
||||
// Add to collection
|
||||
result.Add(new TextResourceData(this, file.Lumps[lumpindex].GetSafeStream(), prefix, lumpindex, true));
|
||||
|
||||
// Find next entry
|
||||
lumpindex = file.FindLumpIndexWithPrefix(prefix, lumpindex + 1);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//sphere
|
||||
private List<TextResourceData> GetAllPrefixedLumps(string prefix)
|
||||
{
|
||||
|
@ -1233,10 +1214,10 @@ namespace CodeImp.DoomBuilder.Data
|
|||
// Loop through the lumps
|
||||
for (int i = 0; i < file.Lumps.Count - 1; i++)
|
||||
{
|
||||
// Check if the lump name matches
|
||||
// Check if the lump name contains the given prefix
|
||||
if (file.Lumps[i].Name.StartsWith(prefix))
|
||||
{
|
||||
// Found the lump!
|
||||
// Found a matching lump!
|
||||
result.Add(new TextResourceData(this, file.Lumps[i].GetSafeStream(), file.Lumps[i].Name, i, true));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -568,44 +568,6 @@ namespace CodeImp.DoomBuilder.IO
|
|||
return -1;
|
||||
}
|
||||
|
||||
// This finds a lump with given prefix, returns -1 when not found
|
||||
public int FindLumpIndexWithPrefix(string prefix)
|
||||
{
|
||||
// Do search
|
||||
return FindLumpIndexWithPrefix(prefix, 0, lumps.Count - 1);
|
||||
}
|
||||
|
||||
// This finds a lump with given prefix, returns -1 when not found
|
||||
public int FindLumpIndexWithPrefix(string prefix, int start)
|
||||
{
|
||||
// Do search
|
||||
return FindLumpIndex(prefix, start, lumps.Count - 1);
|
||||
}
|
||||
|
||||
// This finds a lump with given prefix, returns -1 when not found
|
||||
public int FindLumpIndexWithPrefix(string prefix, int start, int end)
|
||||
{
|
||||
if (prefix.Length > 8 || lumps.Count == 0 || start > lumps.Count - 1) return -1; //mxd. Can't be here. Go away!
|
||||
|
||||
// Fix start/end when they exceed safe bounds
|
||||
start = Math.Max(start, 0);
|
||||
end = General.Clamp(end, 0, lumps.Count - 1);
|
||||
|
||||
// Loop through the lumps
|
||||
for (int i = start; i < end + 1; i++)
|
||||
{
|
||||
// Check if the lump name matches
|
||||
if (lumps[i].Name.StartsWith(prefix))
|
||||
{
|
||||
// Found the lump!
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
// Nothing found
|
||||
return -1;
|
||||
}
|
||||
|
||||
//mxd. Same as above, but searches in reversed order
|
||||
|
||||
// This finds a lump by name, returns null when not found
|
||||
|
|
Loading…
Reference in a new issue