Fix RCS1061
This commit is contained in:
@@ -195,11 +195,11 @@ namespace OpenRA
|
||||
if (value != null)
|
||||
{
|
||||
var parts = value.Split(SplitComma);
|
||||
if (parts.Length == 3)
|
||||
{
|
||||
if (WDist.TryParse(parts[0], out var rx) && WDist.TryParse(parts[1], out var ry) && WDist.TryParse(parts[2], out var rz))
|
||||
return new WVec(rx, ry, rz);
|
||||
}
|
||||
if (parts.Length == 3
|
||||
&& WDist.TryParse(parts[0], out var rx)
|
||||
&& WDist.TryParse(parts[1], out var ry)
|
||||
&& WDist.TryParse(parts[2], out var rz))
|
||||
return new WVec(rx, ry, rz);
|
||||
}
|
||||
|
||||
return InvalidValueAction(value, fieldType, fieldName);
|
||||
@@ -219,8 +219,8 @@ namespace OpenRA
|
||||
for (var i = 0; i < vecs.Length; ++i)
|
||||
{
|
||||
if (WDist.TryParse(parts[3 * i], out var rx)
|
||||
&& WDist.TryParse(parts[3 * i + 1], out var ry)
|
||||
&& WDist.TryParse(parts[3 * i + 2], out var rz))
|
||||
&& WDist.TryParse(parts[3 * i + 1], out var ry)
|
||||
&& WDist.TryParse(parts[3 * i + 2], out var rz))
|
||||
vecs[i] = new WVec(rx, ry, rz);
|
||||
}
|
||||
|
||||
@@ -235,13 +235,11 @@ namespace OpenRA
|
||||
if (value != null)
|
||||
{
|
||||
var parts = value.Split(SplitComma);
|
||||
if (parts.Length == 3)
|
||||
{
|
||||
if (WDist.TryParse(parts[0], out var rx)
|
||||
&& WDist.TryParse(parts[1], out var ry)
|
||||
&& WDist.TryParse(parts[2], out var rz))
|
||||
return new WPos(rx, ry, rz);
|
||||
}
|
||||
if (parts.Length == 3
|
||||
&& WDist.TryParse(parts[0], out var rx)
|
||||
&& WDist.TryParse(parts[1], out var ry)
|
||||
&& WDist.TryParse(parts[2], out var rz))
|
||||
return new WPos(rx, ry, rz);
|
||||
}
|
||||
|
||||
return InvalidValueAction(value, fieldType, fieldName);
|
||||
@@ -259,13 +257,11 @@ namespace OpenRA
|
||||
if (value != null)
|
||||
{
|
||||
var parts = value.Split(SplitComma);
|
||||
if (parts.Length == 3)
|
||||
{
|
||||
if (Exts.TryParseInt32Invariant(parts[0], out var rr)
|
||||
&& Exts.TryParseInt32Invariant(parts[1], out var rp)
|
||||
&& Exts.TryParseInt32Invariant(parts[2], out var ry))
|
||||
return new WRot(new WAngle(rr), new WAngle(rp), new WAngle(ry));
|
||||
}
|
||||
if (parts.Length == 3
|
||||
&& Exts.TryParseInt32Invariant(parts[0], out var rr)
|
||||
&& Exts.TryParseInt32Invariant(parts[1], out var rp)
|
||||
&& Exts.TryParseInt32Invariant(parts[2], out var ry))
|
||||
return new WRot(new WAngle(rr), new WAngle(rp), new WAngle(ry));
|
||||
}
|
||||
|
||||
return InvalidValueAction(value, fieldType, fieldName);
|
||||
|
||||
@@ -226,14 +226,11 @@ namespace OpenRA.FileSystem
|
||||
public bool TryOpen(string filename, out Stream s)
|
||||
{
|
||||
var explicitSplit = filename.IndexOf('|');
|
||||
if (explicitSplit > 0)
|
||||
if (explicitSplit > 0 && explicitMounts.TryGetValue(filename[..explicitSplit], out var explicitPackage))
|
||||
{
|
||||
if (explicitMounts.TryGetValue(filename[..explicitSplit], out var explicitPackage))
|
||||
{
|
||||
s = explicitPackage.GetStream(filename[(explicitSplit + 1)..]);
|
||||
if (s != null)
|
||||
return true;
|
||||
}
|
||||
s = explicitPackage.GetStream(filename[(explicitSplit + 1)..]);
|
||||
if (s != null)
|
||||
return true;
|
||||
}
|
||||
|
||||
s = GetFromCache(filename);
|
||||
@@ -262,10 +259,10 @@ namespace OpenRA.FileSystem
|
||||
public bool Exists(string filename)
|
||||
{
|
||||
var explicitSplit = filename.IndexOf('|');
|
||||
if (explicitSplit > 0)
|
||||
if (explicitMounts.TryGetValue(filename[..explicitSplit], out var explicitPackage))
|
||||
if (explicitPackage.Contains(filename[(explicitSplit + 1)..]))
|
||||
return true;
|
||||
if (explicitSplit > 0 &&
|
||||
explicitMounts.TryGetValue(filename[..explicitSplit], out var explicitPackage) &&
|
||||
explicitPackage.Contains(filename[(explicitSplit + 1)..]))
|
||||
return true;
|
||||
|
||||
return fileIndex.ContainsKey(filename);
|
||||
}
|
||||
|
||||
@@ -169,9 +169,8 @@ namespace OpenRA.Network
|
||||
}
|
||||
|
||||
// Games advertised using the old API calculated the play time locally
|
||||
if (State == 2 && PlayTime < 0)
|
||||
if (DateTime.TryParse(Started, out var startTime))
|
||||
PlayTime = (int)(DateTime.UtcNow - startTime).TotalSeconds;
|
||||
if (State == 2 && PlayTime < 0 && DateTime.TryParse(Started, out var startTime))
|
||||
PlayTime = (int)(DateTime.UtcNow - startTime).TotalSeconds;
|
||||
|
||||
var externalKey = ExternalMod.MakeKey(Mod, Version);
|
||||
if (Game.ExternalMods.TryGetValue(externalKey, out var external) && external.Version == Version)
|
||||
|
||||
@@ -40,13 +40,10 @@ namespace OpenRA.Scripting
|
||||
t = nullable;
|
||||
|
||||
// Value wraps a CLR object
|
||||
if (value.TryGetClrObject(out var temp))
|
||||
if (value.TryGetClrObject(out var temp) && temp.GetType() == t)
|
||||
{
|
||||
if (temp.GetType() == t)
|
||||
{
|
||||
clrObject = temp;
|
||||
return true;
|
||||
}
|
||||
clrObject = temp;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (value is LuaNil && !t.IsValueType)
|
||||
|
||||
@@ -153,9 +153,8 @@ namespace OpenRA.Server
|
||||
return;
|
||||
|
||||
// Regularly check player ping
|
||||
if (lastPingSent.ElapsedMilliseconds > 1000)
|
||||
if (TrySendData(CreatePingFrame()))
|
||||
lastPingSent.Restart();
|
||||
if (lastPingSent.ElapsedMilliseconds > 1000 && TrySendData(CreatePingFrame()))
|
||||
lastPingSent.Restart();
|
||||
|
||||
// Send all data immediately, we will block again on read
|
||||
while (sendQueue.TryTake(out var data, 0))
|
||||
|
||||
@@ -750,13 +750,11 @@ namespace OpenRA.Support
|
||||
public void Push(Expression expression, ExpressionType type)
|
||||
{
|
||||
expressions.Add(expression);
|
||||
if (type == ExpressionType.Int)
|
||||
if (expression.Type != typeof(int))
|
||||
throw new InvalidOperationException($"Expected System.Int type instead of {expression.Type} for {expression}");
|
||||
if (type == ExpressionType.Int && expression.Type != typeof(int))
|
||||
throw new InvalidOperationException($"Expected System.Int type instead of {expression.Type} for {expression}");
|
||||
|
||||
if (type == ExpressionType.Bool)
|
||||
if (expression.Type != typeof(bool))
|
||||
throw new InvalidOperationException($"Expected System.Boolean type instead of {expression.Type} for {expression}");
|
||||
if (type == ExpressionType.Bool && expression.Type != typeof(bool))
|
||||
throw new InvalidOperationException($"Expected System.Boolean type instead of {expression.Type} for {expression}");
|
||||
types.Add(type);
|
||||
}
|
||||
|
||||
|
||||
@@ -312,9 +312,8 @@ namespace OpenRA.Widgets
|
||||
return true;
|
||||
|
||||
foreach (var child in Children)
|
||||
if (child.IsVisible())
|
||||
if (child.EventBoundsContains(location))
|
||||
return true;
|
||||
if (child.IsVisible() && child.EventBoundsContains(location))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user