mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-25 21:31:14 +00:00
Improved error message when a CVAR used for actor distance check is not of type int. Fixes #1008
This commit is contained in:
parent
5ff0bc76db
commit
f63be092dc
2 changed files with 26 additions and 19 deletions
|
@ -590,23 +590,30 @@ namespace CodeImp.DoomBuilder.Config
|
|||
if (renderradius == 0)
|
||||
renderradius = radius;
|
||||
|
||||
//mxd. DistanceCheck. The value is CVAR. Also we'll need squared value
|
||||
if(actor.HasPropertyWithValue("distancecheck"))
|
||||
// DistanceCheck. The value is CVAR. Also we'll need squared value
|
||||
if (actor.HasPropertyWithValue("distancecheck"))
|
||||
{
|
||||
string cvarname = actor.GetPropertyValueString("distancecheck", 0);
|
||||
if(!General.Map.Data.CVars.Integers.ContainsKey(cvarname))
|
||||
if (General.Map.Data.CVars.AllNames.Contains(cvarname))
|
||||
{
|
||||
General.ErrorLogger.Add(ErrorType.Error, "Error in actor \"" + title + "\":" + index + ". DistanceCheck property references undefined cvar \"" + cvarname + "\"");
|
||||
distancechecksq = double.MaxValue;
|
||||
if (!General.Map.Data.CVars.Integers.ContainsKey(cvarname))
|
||||
{
|
||||
General.ErrorLogger.Add(ErrorType.Error, "Error in actor \"" + title + "\":" + index + ". DistanceCheck property references cvar \"" + cvarname + "\" which has to be of type int, but is not");
|
||||
distancechecksq = double.MaxValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
distancechecksq = Math.Pow(General.Map.Data.CVars.Integers[cvarname], 2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
distancechecksq = Math.Pow(General.Map.Data.CVars.Integers[cvarname], 2);
|
||||
General.ErrorLogger.Add(ErrorType.Error, "Error in actor \"" + title + "\":" + index + ". DistanceCheck property references undefined cvar \"" + cvarname + "\"");
|
||||
}
|
||||
}
|
||||
|
||||
//mxd. Renderstyle
|
||||
if(actor.HasPropertyWithValue("renderstyle") && !actor.HasProperty("$ignorerenderstyle"))
|
||||
if (actor.HasPropertyWithValue("renderstyle") && !actor.HasProperty("$ignorerenderstyle"))
|
||||
renderstyle = actor.GetPropertyValueString("renderstyle", 0, true).ToLower();
|
||||
|
||||
//mxd. Alpha
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
internal readonly Dictionary<string, PixelColor> Colors;
|
||||
internal readonly Dictionary<string, bool> Booleans;
|
||||
internal readonly Dictionary<string, string> Strings;
|
||||
private readonly HashSet<string> allnames;
|
||||
internal readonly HashSet<string> AllNames;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
Colors = new Dictionary<string, PixelColor>(StringComparer.OrdinalIgnoreCase);
|
||||
Booleans = new Dictionary<string, bool>(StringComparer.OrdinalIgnoreCase);
|
||||
Strings = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
allnames = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
AllNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -39,40 +39,40 @@ namespace CodeImp.DoomBuilder.Data
|
|||
|
||||
public bool AddValue(string name, int value)
|
||||
{
|
||||
if(allnames.Contains(name)) return false;
|
||||
allnames.Add(name);
|
||||
if(AllNames.Contains(name)) return false;
|
||||
AllNames.Add(name);
|
||||
Integers.Add(name, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool AddValue(string name, float value)
|
||||
{
|
||||
if(allnames.Contains(name)) return false;
|
||||
allnames.Add(name);
|
||||
if(AllNames.Contains(name)) return false;
|
||||
AllNames.Add(name);
|
||||
Floats.Add(name, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool AddValue(string name, PixelColor value)
|
||||
{
|
||||
if(allnames.Contains(name)) return false;
|
||||
allnames.Add(name);
|
||||
if(AllNames.Contains(name)) return false;
|
||||
AllNames.Add(name);
|
||||
Colors.Add(name, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool AddValue(string name, bool value)
|
||||
{
|
||||
if(allnames.Contains(name)) return false;
|
||||
allnames.Add(name);
|
||||
if(AllNames.Contains(name)) return false;
|
||||
AllNames.Add(name);
|
||||
Booleans.Add(name, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool AddValue(string name, string value)
|
||||
{
|
||||
if(allnames.Contains(name)) return false;
|
||||
allnames.Add(name);
|
||||
if(AllNames.Contains(name)) return false;
|
||||
AllNames.Add(name);
|
||||
Strings.Add(name, value);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue