Merge remote-tracking branch 'udb/master'

This commit is contained in:
spherallic 2024-05-24 15:24:42 +02:00
commit c6eecdec5d
7 changed files with 69 additions and 34 deletions

View file

@ -10,10 +10,10 @@ jobs:
fail-fast: false
matrix:
config:
- {
name: "macOS",
os: macos-latest
}
# - {
# name: "macOS",
# os: macos-latest
# }
- {
name: "Linux",
os: ubuntu-latest

View file

@ -908,16 +908,8 @@ universalfields
type = 1;
default = 1.0;
}
lm_gridsize
{
type = 1;
default = 32.0;
thingtypespecific = true;
managed = false;
}
lm_sampledistance
lm_sampledist
{
type = 0;
default = 8;

View file

@ -808,8 +808,6 @@ namespace CodeImp.DoomBuilder.Windows
private void cbEngineSelector_SelectedIndexChanged(object sender, EventArgs e)
{
if(cbEngineSelector.SelectedIndex == -1) return;
preventchanges = true;
//set new values
configinfo.CurrentEngineIndex = cbEngineSelector.SelectedIndex;
@ -834,8 +832,6 @@ namespace CodeImp.DoomBuilder.Windows
skill.Value = skilllevel - 1; //mxd. WHY???
skill.Value = skilllevel;
customparameters.Checked = configinfo.CustomParameters;
preventchanges = false;
}
//mxd

View file

@ -59,6 +59,7 @@ namespace CodeImp.DoomBuilder.ZDoom
// todo: parse stuff
//
string[] control_keywords = new string[] { "goto", "loop", "wait", "fail", "stop" };
string[] data_types = new string[] { "double", "int", "uint" };
while (true)
{
@ -151,20 +152,54 @@ namespace CodeImp.DoomBuilder.ZDoom
token = tokenizer.ExpectToken(ZScriptTokenType.Identifier);
if (token != null && token.IsValid)
{
duration = -1;
tokenizer.SkipWhitespace();
token = tokenizer.ExpectToken(ZScriptTokenType.OpenParen);
if (token != null && token.IsValid)
{
List<ZScriptToken> tokens = parser.ParseExpression(true);
tokenizer.SkipWhitespace();
token = tokenizer.ExpectToken(ZScriptTokenType.CloseParen);
if (token == null || !token.IsValid)
{
parser.ReportError("Expected ), got " + ((Object)token ?? "<null>").ToString());
return;
}
}
// Known data type? Then it's hopefully the .min or .max value (like int.min or int.max)
if (data_types.Contains(token.Value))
{
token = tokenizer.ExpectToken(ZScriptTokenType.Dot);
if(token == null || !token.IsValid)
{
parser.ReportError("Expected ., got " + ((Object)token ?? "<null>").ToString());
return;
}
token = tokenizer.ExpectToken(ZScriptTokenType.Identifier);
if (token == null || !token.IsValid)
{
parser.ReportError("Expected an identifier, got " + ((Object)token ?? "<null>").ToString());
return;
}
if (token.Value == "min")
{
duration = int.MinValue;
}
else if (token.Value == "max")
{
duration = int.MaxValue;
}
else
{
parser.ReportError("Expected min or max, got " + ((Object)token ?? "<null>").ToString());
return;
}
}
else // No known data type
{
duration = -1;
tokenizer.SkipWhitespace();
token = tokenizer.ExpectToken(ZScriptTokenType.OpenParen);
if (token != null && token.IsValid)
{
List<ZScriptToken> tokens = parser.ParseExpression(true);
tokenizer.SkipWhitespace();
token = tokenizer.ExpectToken(ZScriptTokenType.CloseParen);
if (token == null || !token.IsValid)
{
parser.ReportError("Expected ), got " + ((Object)token ?? "<null>").ToString());
return;
}
}
}
}
else
{

View file

@ -362,7 +362,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(curdistance < closest2) closest2 = curdistance;
// Return closer one
return (int)(closest1 - closest2);
// biwa: the difference between closest1 and closest2 can exceed the capacity of int, and that
// sometimes seem to cause problems, resulting in the sorting to throw an ArgumentException
// because of inconsistent results. Making sure to only return -1, 0, or 1 seems to fix the issue
// See https://github.com/UltimateDoomBuilder/UltimateDoomBuilder/issues/1053
return (closest1 - closest2) < 0 ? -1 : ((closest1 - closest2) > 0 ? 1 : 0);
});
return result;

View file

@ -722,7 +722,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Return closer one
return (int)(closest1 - closest2);
// biwa: the difference between closest1 and closest2 can exceed the capacity of int, and that
// sometimes seem to cause problems, resulting in the sorting to throw an ArgumentException
// because of inconsistent results. Making sure to only return -1, 0, or 1 seems to fix the issue
// See https://github.com/UltimateDoomBuilder/UltimateDoomBuilder/issues/1053
return (closest1 - closest2) < 0 ? -1 : ((closest1 - closest2) > 0 ? 1 : 0);
});
return result;

View file

@ -1012,7 +1012,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
double closest2 = Vector2D.DistanceSq(t2.Position, targetpoint);
// Return closer one
return (int)(closest1 - closest2);
// biwa: the difference between closest1 and closest2 can exceed the capacity of int, and that
// sometimes seem to cause problems, resulting in the sorting to throw an ArgumentException
// because of inconsistent results. Making sure to only return -1, 0, or 1 seems to fix the issue
// See https://github.com/UltimateDoomBuilder/UltimateDoomBuilder/issues/1053
return (closest1 - closest2) < 0 ? -1 : ((closest1 - closest2) > 0 ? 1 : 0);
});
return result;