mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 12:22:35 +00:00
DECORATE and MAPINFO parsers: added editor number range check.
This commit is contained in:
parent
e70c436882
commit
95e28518cb
5 changed files with 29 additions and 9 deletions
|
@ -382,6 +382,15 @@ namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
|
|||
return false;
|
||||
}
|
||||
|
||||
// Range check
|
||||
if((id < General.Map.FormatInterface.MinThingType) || (id > General.Map.FormatInterface.MaxThingType))
|
||||
{
|
||||
// Out of bounds!
|
||||
ReportError("\"" + token + "\" actor's spawn number must be between "
|
||||
+ General.Map.FormatInterface.MinThingType + " and " + General.Map.FormatInterface.MaxThingType);
|
||||
return false; // Finished with this file
|
||||
}
|
||||
|
||||
// Add to collection
|
||||
spawnnums[id] = token.ToLowerInvariant();
|
||||
}
|
||||
|
|
|
@ -76,8 +76,8 @@ namespace CodeImp.DoomBuilder.IO
|
|||
public override int MinEffect { get { return ushort.MinValue; } }
|
||||
public override int MaxBrightness { get { return short.MaxValue; } }
|
||||
public override int MinBrightness { get { return short.MinValue; } }
|
||||
public override int MaxThingType { get { return ushort.MaxValue; } }
|
||||
public override int MinThingType { get { return ushort.MinValue; } }
|
||||
public override int MaxThingType { get { return short.MaxValue; } } //mxd. Editor numbers must be in [1 .. 32767] range
|
||||
public override int MinThingType { get { return 1; } } //mxd
|
||||
public override float MaxCoordinate { get { return short.MaxValue; } }
|
||||
public override float MinCoordinate { get { return short.MinValue; } }
|
||||
public override int MaxThingAngle { get { return short.MaxValue; } }
|
||||
|
|
|
@ -74,8 +74,8 @@ namespace CodeImp.DoomBuilder.IO
|
|||
public override int MinEffect { get { return ushort.MinValue; } }
|
||||
public override int MaxBrightness { get { return short.MaxValue; } }
|
||||
public override int MinBrightness { get { return short.MinValue; } }
|
||||
public override int MaxThingType { get { return ushort.MaxValue; } }
|
||||
public override int MinThingType { get { return ushort.MinValue; } }
|
||||
public override int MaxThingType { get { return short.MaxValue; } } //mxd. Editor numbers must be in [1 .. 32767] range
|
||||
public override int MinThingType { get { return 1; } } //mxd
|
||||
public override float MaxCoordinate { get { return short.MaxValue; } }
|
||||
public override float MinCoordinate { get { return short.MinValue; } }
|
||||
public override int MaxThingAngle { get { return short.MaxValue; } }
|
||||
|
|
|
@ -126,8 +126,8 @@ namespace CodeImp.DoomBuilder.IO
|
|||
public override int MinEffect { get { return int.MinValue; } }
|
||||
public override int MaxBrightness { get { return int.MaxValue; } }
|
||||
public override int MinBrightness { get { return int.MinValue; } }
|
||||
public override int MaxThingType { get { return int.MaxValue; } }
|
||||
public override int MinThingType { get { return int.MinValue; } }
|
||||
public override int MaxThingType { get { return short.MaxValue; } } //mxd. Editor numbers must be in [1 .. 32767] range
|
||||
public override int MinThingType { get { return 1; } } //mxd
|
||||
public override float MaxCoordinate { get { return short.MaxValue; } } //mxd. UDMF maps are still bounded to -32768 .. 32767 range
|
||||
public override float MinCoordinate { get { return short.MinValue; } } //mxd
|
||||
public override int MaxThingAngle { get { return int.MaxValue; } }
|
||||
|
|
|
@ -160,11 +160,22 @@ namespace CodeImp.DoomBuilder.ZDoom
|
|||
{
|
||||
// This is for editor-only properties such as $sprite and $category
|
||||
props[token] = new List<string> { (parser.SkipWhitespace(false) ? parser.ReadLine() : "") };
|
||||
}
|
||||
else if(!int.TryParse(token, NumberStyles.Integer, CultureInfo.InvariantCulture, out doomednum)) // Check if numeric
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!int.TryParse(token, NumberStyles.Integer, CultureInfo.InvariantCulture, out doomednum)) // Check if numeric
|
||||
{
|
||||
// Not numeric!
|
||||
parser.ReportError("Expected editor thing number or start of actor scope while parsing \"" + classname + "\"");
|
||||
parser.ReportError("Expected editor number or start of actor scope while parsing \"" + classname + "\"");
|
||||
return;
|
||||
}
|
||||
|
||||
//mxd. Range check
|
||||
if((doomednum < General.Map.FormatInterface.MinThingType) || (doomednum > General.Map.FormatInterface.MaxThingType))
|
||||
{
|
||||
// Out of bounds!
|
||||
parser.ReportError("\"" + classname + "\" actor's editor number must be between "
|
||||
+ General.Map.FormatInterface.MinThingType + " and " + General.Map.FormatInterface.MaxThingType);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue