WADReader: another fix to patches outside of patch ranges detection logic.

This commit is contained in:
MaxED 2014-04-08 11:09:05 +00:00
parent 8132584155
commit 0d6f9a2594

View file

@ -102,32 +102,28 @@ namespace CodeImp.DoomBuilder.Data
invertedflatranges = new List<LumpRange>(); invertedflatranges = new List<LumpRange>();
if(flatranges.Count > 0) { if(flatranges.Count > 0) {
//add range before first flatrange
if (flatranges[0].start > 0) { if (flatranges[0].start > 0) {
LumpRange range = new LumpRange {start = 0, end = flatranges[0].start - 1}; LumpRange range = new LumpRange {start = 0, end = flatranges[0].start - 1};
invertedflatranges.Add(range); invertedflatranges.Add(range);
} }
//add ranges between flatranges
for(int i = 1; i < flatranges.Count; i++) {
LumpRange range = new LumpRange { start = flatranges[i - 1].end + 1, end = flatranges[i].start - 1 };
invertedflatranges.Add(range);
}
//add range after last flatrange
if(flatranges[flatranges.Count - 1].end < file.Lumps.Count - 1) {
LumpRange range = new LumpRange { start = flatranges[flatranges.Count - 1].end + 1, end = file.Lumps.Count - 1 };
invertedflatranges.Add(range);
}
} else { // No flat ranges? Make one giant range then... } else { // No flat ranges? Make one giant range then...
LumpRange range = new LumpRange {start = 0, end = file.Lumps.Count - 1}; LumpRange range = new LumpRange {start = 0, end = file.Lumps.Count - 1};
invertedflatranges.Add(range); invertedflatranges.Add(range);
} }
for (int i = 1; i < flatranges.Count; i++) {
if (flatranges[i].start == 0) continue;
LumpRange range = new LumpRange();
if(i == flatranges.Count - 1) {
if (flatranges[i].end < file.Lumps.Count - 1) {
range.start = flatranges[i].end + 1;
range.end = file.Lumps.Count - 1;
invertedflatranges.Add(range);
}
} else {
range.start = flatranges[i - 1].end + 1;
range.end = flatranges[i].start - 1;
invertedflatranges.Add(range);
}
}
// We have no destructor // We have no destructor
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
} }