mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 04:12:12 +00:00
When loading UDMF maps and fields that have NaN (not a number) as a value are encountered those fields will now be dropped permanently. A warning that this happens will be displayed in the Errors and Warnings dialog.
This commit is contained in:
parent
6659a8ccbd
commit
c0984c8b67
2 changed files with 15 additions and 2 deletions
|
@ -60,6 +60,9 @@ namespace CodeImp.DoomBuilder.IO
|
|||
private int cpErrorResult;
|
||||
private string cpErrorDescription = "";
|
||||
private int cpErrorLine;
|
||||
|
||||
// Warnings
|
||||
private List<string> warnings = new List<string>();
|
||||
|
||||
// Configuration root
|
||||
private UniversalCollection root;
|
||||
|
@ -82,6 +85,8 @@ namespace CodeImp.DoomBuilder.IO
|
|||
public int ErrorLine { get { return cpErrorLine; } }
|
||||
public UniversalCollection Root { get { return root; } }
|
||||
public bool StrictChecking { get { return strictchecking; } set { strictchecking = value; } }
|
||||
public bool HasWarnings { get { return warnings.Count != 0; } }
|
||||
public List<string> Warnings { get { return warnings; } }
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -623,8 +628,10 @@ namespace CodeImp.DoomBuilder.IO
|
|||
|
||||
case "nan":
|
||||
// Add float value
|
||||
UniversalEntry nan = new UniversalEntry(key.ToString().Trim().ToLowerInvariant(), float.NaN);
|
||||
cs.Add(nan);
|
||||
UniversalEntry nan = new UniversalEntry(key.ToString().Trim().ToLowerInvariant(), double.NaN);
|
||||
// Do not add NaN, just drop it with a warning
|
||||
// cs.Add(nan);
|
||||
warnings.Add("UDMF map data line " + (line+1) + ": value of field " + key.ToString().Trim().ToLowerInvariant() + " has a value of NaN (not a number). Field is being dropped permanentely.");
|
||||
if (!matches.ContainsKey(data[line])) matches.Add(data[line], nan);
|
||||
break;
|
||||
|
||||
|
|
|
@ -152,6 +152,12 @@ namespace CodeImp.DoomBuilder.IO
|
|||
throw new Exception("Error on line " + textmap.ErrorLine + " while parsing UDMF map data:\n" + textmap.ErrorDescription);
|
||||
}
|
||||
|
||||
if(textmap.HasWarnings)
|
||||
{
|
||||
foreach (string warning in textmap.Warnings)
|
||||
General.ErrorLogger.Add(ErrorType.Warning, warning);
|
||||
}
|
||||
|
||||
// Read the map
|
||||
Dictionary<int, Vertex> vertexlink = ReadVertices(map, textmap);
|
||||
Dictionary<int, Sector> sectorlink = ReadSectors(map, textmap);
|
||||
|
|
Loading…
Reference in a new issue