mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-16 17:11:28 +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)
|
if (renderradius == 0)
|
||||||
renderradius = radius;
|
renderradius = radius;
|
||||||
|
|
||||||
//mxd. DistanceCheck. The value is CVAR. Also we'll need squared value
|
// DistanceCheck. The value is CVAR. Also we'll need squared value
|
||||||
if(actor.HasPropertyWithValue("distancecheck"))
|
if (actor.HasPropertyWithValue("distancecheck"))
|
||||||
{
|
{
|
||||||
string cvarname = actor.GetPropertyValueString("distancecheck", 0);
|
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 + "\"");
|
if (!General.Map.Data.CVars.Integers.ContainsKey(cvarname))
|
||||||
distancechecksq = double.MaxValue;
|
{
|
||||||
|
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
|
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
|
//mxd. Renderstyle
|
||||||
if(actor.HasPropertyWithValue("renderstyle") && !actor.HasProperty("$ignorerenderstyle"))
|
if (actor.HasPropertyWithValue("renderstyle") && !actor.HasProperty("$ignorerenderstyle"))
|
||||||
renderstyle = actor.GetPropertyValueString("renderstyle", 0, true).ToLower();
|
renderstyle = actor.GetPropertyValueString("renderstyle", 0, true).ToLower();
|
||||||
|
|
||||||
//mxd. Alpha
|
//mxd. Alpha
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
internal readonly Dictionary<string, PixelColor> Colors;
|
internal readonly Dictionary<string, PixelColor> Colors;
|
||||||
internal readonly Dictionary<string, bool> Booleans;
|
internal readonly Dictionary<string, bool> Booleans;
|
||||||
internal readonly Dictionary<string, string> Strings;
|
internal readonly Dictionary<string, string> Strings;
|
||||||
private readonly HashSet<string> allnames;
|
internal readonly HashSet<string> AllNames;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
Colors = new Dictionary<string, PixelColor>(StringComparer.OrdinalIgnoreCase);
|
Colors = new Dictionary<string, PixelColor>(StringComparer.OrdinalIgnoreCase);
|
||||||
Booleans = new Dictionary<string, bool>(StringComparer.OrdinalIgnoreCase);
|
Booleans = new Dictionary<string, bool>(StringComparer.OrdinalIgnoreCase);
|
||||||
Strings = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
Strings = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||||
allnames = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
AllNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -39,40 +39,40 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
|
|
||||||
public bool AddValue(string name, int value)
|
public bool AddValue(string name, int value)
|
||||||
{
|
{
|
||||||
if(allnames.Contains(name)) return false;
|
if(AllNames.Contains(name)) return false;
|
||||||
allnames.Add(name);
|
AllNames.Add(name);
|
||||||
Integers.Add(name, value);
|
Integers.Add(name, value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AddValue(string name, float value)
|
public bool AddValue(string name, float value)
|
||||||
{
|
{
|
||||||
if(allnames.Contains(name)) return false;
|
if(AllNames.Contains(name)) return false;
|
||||||
allnames.Add(name);
|
AllNames.Add(name);
|
||||||
Floats.Add(name, value);
|
Floats.Add(name, value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AddValue(string name, PixelColor value)
|
public bool AddValue(string name, PixelColor value)
|
||||||
{
|
{
|
||||||
if(allnames.Contains(name)) return false;
|
if(AllNames.Contains(name)) return false;
|
||||||
allnames.Add(name);
|
AllNames.Add(name);
|
||||||
Colors.Add(name, value);
|
Colors.Add(name, value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AddValue(string name, bool value)
|
public bool AddValue(string name, bool value)
|
||||||
{
|
{
|
||||||
if(allnames.Contains(name)) return false;
|
if(AllNames.Contains(name)) return false;
|
||||||
allnames.Add(name);
|
AllNames.Add(name);
|
||||||
Booleans.Add(name, value);
|
Booleans.Add(name, value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AddValue(string name, string value)
|
public bool AddValue(string name, string value)
|
||||||
{
|
{
|
||||||
if(allnames.Contains(name)) return false;
|
if(AllNames.Contains(name)) return false;
|
||||||
allnames.Add(name);
|
AllNames.Add(name);
|
||||||
Strings.Add(name, value);
|
Strings.Add(name, value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue