Revert "Fixed: 'forbidden' lumps are not supposed to count towards matching while detecting map type"
This reverts commit c6a2288c22
.
This commit is contained in:
parent
daf38b5bd3
commit
aa0bd8de91
|
@ -31,7 +31,6 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
public readonly bool NodeBuild;
|
public readonly bool NodeBuild;
|
||||||
public readonly bool AllowEmpty;
|
public readonly bool AllowEmpty;
|
||||||
public readonly bool ScriptBuild; //mxd
|
public readonly bool ScriptBuild; //mxd
|
||||||
public readonly bool Forbidden; // [ZZ]
|
|
||||||
internal readonly ScriptConfiguration Script;
|
internal readonly ScriptConfiguration Script;
|
||||||
|
|
||||||
// Construct from IDictionary
|
// Construct from IDictionary
|
||||||
|
@ -45,7 +44,6 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
this.NodeBuild = cfg.ReadSetting("maplumpnames." + name + ".nodebuild", false);
|
this.NodeBuild = cfg.ReadSetting("maplumpnames." + name + ".nodebuild", false);
|
||||||
this.AllowEmpty = cfg.ReadSetting("maplumpnames." + name + ".allowempty", false);
|
this.AllowEmpty = cfg.ReadSetting("maplumpnames." + name + ".allowempty", false);
|
||||||
this.ScriptBuild = cfg.ReadSetting("maplumpnames." + name + ".scriptbuild", false); //mxd
|
this.ScriptBuild = cfg.ReadSetting("maplumpnames." + name + ".scriptbuild", false); //mxd
|
||||||
this.Forbidden = cfg.ReadSetting("maplumpnames." + name + ".forbidden", false); //mxd
|
|
||||||
string scriptconfig = cfg.ReadSetting("maplumpnames." + name + ".script", "");
|
string scriptconfig = cfg.ReadSetting("maplumpnames." + name + ".script", "");
|
||||||
|
|
||||||
// Find script configuration
|
// Find script configuration
|
||||||
|
|
|
@ -1463,19 +1463,19 @@ namespace CodeImp.DoomBuilder
|
||||||
// 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
|
||||||
List<List<MapLumpInfo>> trylists = new List<List<MapLumpInfo>>();
|
List<List<string>> trylists = new List<List<string>>();
|
||||||
foreach (ConfigurationInfo cinfo in General.Configs)
|
foreach (ConfigurationInfo cinfo in General.Configs)
|
||||||
{
|
{
|
||||||
List<MapLumpInfo> maplumps = new List<MapLumpInfo>();
|
List<string> maplumps = new List<string>();
|
||||||
// parse only the map lumps section of the config.
|
// parse only the map lumps section of the config.
|
||||||
Configuration cfg = cinfo.Configuration;
|
Configuration cfg = cinfo.Configuration;
|
||||||
IDictionary dic = cfg.ReadSetting("maplumpnames", new Hashtable());
|
IDictionary dic = cfg.ReadSetting("maplumpnames", new Hashtable());
|
||||||
foreach (string k in dic.Keys)
|
foreach (string k in dic.Keys)
|
||||||
maplumps.Add(new MapLumpInfo(k, cfg));
|
maplumps.Add(k);
|
||||||
|
|
||||||
// check if we already have this lump list. don't duplicate.
|
// check if we already have this lump list. don't duplicate.
|
||||||
bool found = false;
|
bool found = false;
|
||||||
foreach (List<MapLumpInfo> ctrylist in trylists)
|
foreach (List<string> ctrylist in trylists)
|
||||||
{
|
{
|
||||||
if (ctrylist.Count == maplumps.Count &&
|
if (ctrylist.Count == maplumps.Count &&
|
||||||
ctrylist.SequenceEqual(maplumps))
|
ctrylist.SequenceEqual(maplumps))
|
||||||
|
@ -1494,26 +1494,19 @@ namespace CodeImp.DoomBuilder
|
||||||
|
|
||||||
// find the most probable lump list.
|
// find the most probable lump list.
|
||||||
int maxmatches = 0;
|
int maxmatches = 0;
|
||||||
List<MapLumpInfo> trylist = null;
|
List<string> trylist = null;
|
||||||
foreach (List<MapLumpInfo> lst in trylists)
|
foreach (List<string> lst in trylists)
|
||||||
{
|
{
|
||||||
int matches = 0;
|
int matches = 0;
|
||||||
int maxcnt = lst.Count;
|
int maxcnt = lst.Count;
|
||||||
int checkindex = nextindex+1;
|
int checkindex = nextindex+1;
|
||||||
for (int i = 0; i < lst.Count; i++)
|
foreach (string lmp in lst)
|
||||||
{
|
{
|
||||||
if (checkindex >= target.Lumps.Count)
|
if (checkindex >= target.Lumps.Count)
|
||||||
break;
|
break;
|
||||||
int mliIdx = lst.FindIndex(e => e.Name == target.Lumps[checkindex].Name);
|
bool match = lst.Contains(target.Lumps[checkindex].Name);
|
||||||
if (mliIdx < 0) break; // stop matching on first non-matching lump
|
if (match) matches++;
|
||||||
MapLumpInfo mli = lst[mliIdx];
|
else break; // stop matching on first non-matching lump
|
||||||
if (mli.Forbidden)
|
|
||||||
{
|
|
||||||
matches = 0;
|
|
||||||
break; // completely stop matching on first forbidden lump - definitely not this configuration
|
|
||||||
}
|
|
||||||
|
|
||||||
matches++;
|
|
||||||
checkindex++;
|
checkindex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1530,11 +1523,11 @@ namespace CodeImp.DoomBuilder
|
||||||
if (reallyremove)
|
if (reallyremove)
|
||||||
{
|
{
|
||||||
int checkindex = nextindex + 1;
|
int checkindex = nextindex + 1;
|
||||||
for (int i = 0; i < trylist.Count; i++)
|
foreach (string lmp in trylist)
|
||||||
{
|
{
|
||||||
if (checkindex >= target.Lumps.Count)
|
if (checkindex >= target.Lumps.Count)
|
||||||
break;
|
break;
|
||||||
bool match = (trylist.FindIndex(e => e.Name == target.Lumps[checkindex].Name) >= 0);
|
bool match = trylist.Contains(target.Lumps[checkindex].Name);
|
||||||
if (match) target.RemoveAt(checkindex);
|
if (match) target.RemoveAt(checkindex);
|
||||||
else break; // stop deleting on first non-matching lump
|
else break; // stop deleting on first non-matching lump
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue