mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2025-02-13 23:50:55 +00:00
Fixed: consequential duplicate maps weren't handled properly
This commit is contained in:
parent
ab4b59c981
commit
6bd76dee4e
1 changed files with 9 additions and 8 deletions
|
@ -1444,15 +1444,11 @@ namespace CodeImp.DoomBuilder
|
||||||
//
|
//
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
int nextindex = target.FindLumpIndex(targetmapname, tgtheaderindex + 1);
|
int nextindex = target.FindLumpIndex(targetmapname, tgtheaderindex);
|
||||||
// note that this (and the original algorithm too) would break if you have a patch or a texture named MAP01 for example...
|
// note that this (and the original algorithm too) would break if you have a patch or a texture named MAP01 for example...
|
||||||
// this is the case for multiple megawads that have level selection screen (Duel40-style), but luckily most of them are using the PK3 format.
|
// this is the case for multiple megawads that have level selection screen (Duel40-style), but luckily most of them are using the PK3 format.
|
||||||
if (nextindex < 0) break; // next lump not found
|
if (nextindex < 0) break; // next lump not found
|
||||||
// remove the header lump
|
|
||||||
target.RemoveAt(nextindex, false);
|
|
||||||
writeheaders = true;
|
|
||||||
//
|
|
||||||
tgtheaderindex = nextindex;
|
|
||||||
// try to detect the format used for this map.
|
// try to detect the format used for this map.
|
||||||
// if more than one format matches, do... idk what actually.
|
// if more than one format matches, do... idk what actually.
|
||||||
// todo: move this code out and call it something like DetectMapConfiguration
|
// todo: move this code out and call it something like DetectMapConfiguration
|
||||||
|
@ -1492,7 +1488,7 @@ namespace CodeImp.DoomBuilder
|
||||||
{
|
{
|
||||||
int matches = 0;
|
int matches = 0;
|
||||||
int maxcnt = lst.Count;
|
int maxcnt = lst.Count;
|
||||||
int checkindex = nextindex;
|
int checkindex = nextindex+1;
|
||||||
foreach (string lmp in lst)
|
foreach (string lmp in lst)
|
||||||
{
|
{
|
||||||
if (checkindex >= target.Lumps.Count)
|
if (checkindex >= target.Lumps.Count)
|
||||||
|
@ -1513,7 +1509,7 @@ namespace CodeImp.DoomBuilder
|
||||||
// if we didn't find anything it's weird...
|
// if we didn't find anything it's weird...
|
||||||
if (trylist != null)
|
if (trylist != null)
|
||||||
{
|
{
|
||||||
int checkindex = nextindex;
|
int checkindex = nextindex+1;
|
||||||
foreach (string lmp in trylist)
|
foreach (string lmp in trylist)
|
||||||
{
|
{
|
||||||
if (checkindex >= target.Lumps.Count)
|
if (checkindex >= target.Lumps.Count)
|
||||||
|
@ -1523,6 +1519,11 @@ namespace CodeImp.DoomBuilder
|
||||||
else break; // stop deleting on first non-matching lump
|
else break; // stop deleting on first non-matching lump
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// how if trylist was not null, we need to remove the header as well.
|
||||||
|
target.RemoveAt(nextindex, false);
|
||||||
|
writeheaders = true;
|
||||||
|
tgtheaderindex = nextindex;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (writeheaders) target.WriteHeaders();
|
if (writeheaders) target.WriteHeaders();
|
||||||
|
|
Loading…
Reference in a new issue