summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Cho <mysticfallband@gmail.com>2018-04-08 12:39:35 +0900
committerXavier Cho <mysticfallband@gmail.com>2018-04-17 07:39:37 +0900
commit9097c71255c6e8edb0014c043562caffc84ee2cf (patch)
treeb84dff910353e8b118a9ea46fdcfa06e9f610190
parent93dd59d763146938d59defe270f43091b5579a0a (diff)
#18051: Remove redundant parenthesis
-rw-r--r--modules/mono/glue/cs_files/AABB.cs54
-rw-r--r--modules/mono/glue/cs_files/Basis.cs10
-rw-r--r--modules/mono/glue/cs_files/Color.cs18
-rw-r--r--modules/mono/glue/cs_files/GD.cs4
-rw-r--r--modules/mono/glue/cs_files/Mathf.cs18
-rw-r--r--modules/mono/glue/cs_files/Plane.cs8
-rw-r--r--modules/mono/glue/cs_files/Quat.cs2
-rw-r--r--modules/mono/glue/cs_files/Rect2.cs26
-rw-r--r--modules/mono/glue/cs_files/StringExtensions.cs15
-rw-r--r--modules/mono/glue/cs_files/Transform.cs6
-rw-r--r--modules/mono/glue/cs_files/Transform2D.cs4
-rw-r--r--modules/mono/glue/cs_files/Vector2.cs6
-rw-r--r--modules/mono/glue/cs_files/Vector3.cs14
13 files changed, 94 insertions, 91 deletions
diff --git a/modules/mono/glue/cs_files/AABB.cs b/modules/mono/glue/cs_files/AABB.cs
index 909f999333..3304e418c8 100644
--- a/modules/mono/glue/cs_files/AABB.cs
+++ b/modules/mono/glue/cs_files/AABB.cs
@@ -49,12 +49,12 @@ namespace Godot
Vector3 dst_min = with.position;
Vector3 dst_max = with.position + with.size;
- return ((src_min.x <= dst_min.x) &&
- (src_max.x > dst_max.x) &&
- (src_min.y <= dst_min.y) &&
- (src_max.y > dst_max.y) &&
- (src_min.z <= dst_min.z) &&
- (src_max.z > dst_max.z));
+ return src_min.x <= dst_min.x &&
+ src_max.x > dst_max.x &&
+ src_min.y <= dst_min.y &&
+ src_max.y > dst_max.y &&
+ src_min.z <= dst_min.z &&
+ src_max.z > dst_max.z;
}
public AABB Expand(Vector3 to_point)
@@ -217,9 +217,9 @@ namespace Godot
Vector3 ofs = position + half_extents;
return ofs + new Vector3(
- (dir.x > 0f) ? -half_extents.x : half_extents.x,
- (dir.y > 0f) ? -half_extents.y : half_extents.y,
- (dir.z > 0f) ? -half_extents.z : half_extents.z);
+ dir.x > 0f ? -half_extents.x : half_extents.x,
+ dir.y > 0f ? -half_extents.y : half_extents.y,
+ dir.z > 0f ? -half_extents.z : half_extents.z);
}
public AABB Grow(real_t by)
@@ -278,41 +278,41 @@ namespace Godot
return new AABB();
}
- min.x = (src_min.x > dst_min.x) ? src_min.x : dst_min.x;
- max.x = (src_max.x < dst_max.x) ? src_max.x : dst_max.x;
+ min.x = src_min.x > dst_min.x ? src_min.x : dst_min.x;
+ max.x = src_max.x < dst_max.x ? src_max.x : dst_max.x;
if (src_min.y > dst_max.y || src_max.y < dst_min.y)
{
return new AABB();
}
- min.y = (src_min.y > dst_min.y) ? src_min.y : dst_min.y;
- max.y = (src_max.y < dst_max.y) ? src_max.y : dst_max.y;
+ min.y = src_min.y > dst_min.y ? src_min.y : dst_min.y;
+ max.y = src_max.y < dst_max.y ? src_max.y : dst_max.y;
if (src_min.z > dst_max.z || src_max.z < dst_min.z)
{
return new AABB();
}
- min.z = (src_min.z > dst_min.z) ? src_min.z : dst_min.z;
- max.z = (src_max.z < dst_max.z) ? src_max.z : dst_max.z;
+ min.z = src_min.z > dst_min.z ? src_min.z : dst_min.z;
+ max.z = src_max.z < dst_max.z ? src_max.z : dst_max.z;
return new AABB(min, max - min);
}
public bool Intersects(AABB with)
{
- if (position.x >= (with.position.x + with.size.x))
+ if (position.x >= with.position.x + with.size.x)
return false;
- if ((position.x + size.x) <= with.position.x)
+ if (position.x + size.x <= with.position.x)
return false;
- if (position.y >= (with.position.y + with.size.y))
+ if (position.y >= with.position.y + with.size.y)
return false;
- if ((position.y + size.y) <= with.position.y)
+ if (position.y + size.y <= with.position.y)
return false;
- if (position.z >= (with.position.z + with.size.z))
+ if (position.z >= with.position.z + with.size.z)
return false;
- if ((position.z + size.z) <= with.position.z)
+ if (position.z + size.z <= with.position.z)
return false;
return true;
@@ -400,15 +400,15 @@ namespace Godot
var end_2 = new Vector3(with.size.x, with.size.y, with.size.z) + beg_2;
var min = new Vector3(
- (beg_1.x < beg_2.x) ? beg_1.x : beg_2.x,
- (beg_1.y < beg_2.y) ? beg_1.y : beg_2.y,
- (beg_1.z < beg_2.z) ? beg_1.z : beg_2.z
+ beg_1.x < beg_2.x ? beg_1.x : beg_2.x,
+ beg_1.y < beg_2.y ? beg_1.y : beg_2.y,
+ beg_1.z < beg_2.z ? beg_1.z : beg_2.z
);
var max = new Vector3(
- (end_1.x > end_2.x) ? end_1.x : end_2.x,
- (end_1.y > end_2.y) ? end_1.y : end_2.y,
- (end_1.z > end_2.z) ? end_1.z : end_2.z
+ end_1.x > end_2.x ? end_1.x : end_2.x,
+ end_1.y > end_2.y ? end_1.y : end_2.y,
+ end_1.z > end_2.z ? end_1.z : end_2.z
);
return new AABB(min, max - min);
diff --git a/modules/mono/glue/cs_files/Basis.cs b/modules/mono/glue/cs_files/Basis.cs
index d16e40488c..9a4bd7b366 100644
--- a/modules/mono/glue/cs_files/Basis.cs
+++ b/modules/mono/glue/cs_files/Basis.cs
@@ -296,9 +296,9 @@ namespace Godot
Vector3 zAxis = GetAxis(2);
xAxis.Normalize();
- yAxis = (yAxis - xAxis * (xAxis.Dot(yAxis)));
+ yAxis = yAxis - xAxis * xAxis.Dot(yAxis);
yAxis.Normalize();
- zAxis = (zAxis - xAxis * (xAxis.Dot(zAxis)) - yAxis * (yAxis.Dot(zAxis)));
+ zAxis = zAxis - xAxis * xAxis.Dot(zAxis) - yAxis * yAxis.Dot(zAxis);
zAxis.Normalize();
return CreateFromAxes(xAxis, yAxis, zAxis);
@@ -374,9 +374,9 @@ namespace Godot
{
return new Vector3
(
- (this[0, 0] * v.x) + (this[1, 0] * v.y) + (this[2, 0] * v.z),
- (this[0, 1] * v.x) + (this[1, 1] * v.y) + (this[2, 1] * v.z),
- (this[0, 2] * v.x) + (this[1, 2] * v.y) + (this[2, 2] * v.z)
+ this[0, 0] * v.x + this[1, 0] * v.y + this[2, 0] * v.z,
+ this[0, 1] * v.x + this[1, 1] * v.y + this[2, 1] * v.z,
+ this[0, 2] * v.x + this[1, 2] * v.y + this[2, 2] * v.z
);
}
diff --git a/modules/mono/glue/cs_files/Color.cs b/modules/mono/glue/cs_files/Color.cs
index 8e9091cc09..a5160e415a 100644
--- a/modules/mono/glue/cs_files/Color.cs
+++ b/modules/mono/glue/cs_files/Color.cs
@@ -180,7 +180,7 @@ namespace Godot
hue += 1.0f;
}
- saturation = (max == 0) ? 0 : 1f - (1f * min / max);
+ saturation = max == 0 ? 0 : 1f - 1f * min / max;
value = max / 255f;
}
@@ -267,10 +267,10 @@ namespace Godot
{
var res = this;
- res.r += (t * (b.r - r));
- res.g += (t * (b.g - g));
- res.b += (t * (b.b - this.b));
- res.a += (t * (b.a - a));
+ res.r += t * (b.r - r);
+ res.g += t * (b.g - g);
+ res.b += t * (b.b - this.b);
+ res.a += t * (b.a - a);
return res;
}
@@ -511,8 +511,8 @@ namespace Godot
if (left.g == right.g)
{
if (left.b == right.b)
- return (left.a < right.a);
- return (left.b < right.b);
+ return left.a < right.a;
+ return left.b < right.b;
}
return left.g < right.g;
@@ -528,8 +528,8 @@ namespace Godot
if (left.g == right.g)
{
if (left.b == right.b)
- return (left.a > right.a);
- return (left.b > right.b);
+ return left.a > right.a;
+ return left.b > right.b;
}
return left.g > right.g;
diff --git a/modules/mono/glue/cs_files/GD.cs b/modules/mono/glue/cs_files/GD.cs
index f565d092dd..5f9ca2c335 100644
--- a/modules/mono/glue/cs_files/GD.cs
+++ b/modules/mono/glue/cs_files/GD.cs
@@ -127,9 +127,9 @@ namespace Godot
int count;
if (increment > 0)
- count = ((to - from - 1) / increment) + 1;
+ count = (to - @from - 1) / increment + 1;
else
- count = ((from - to - 1) / -increment) + 1;
+ count = (@from - to - 1) / -increment + 1;
var ret = new int[count];
diff --git a/modules/mono/glue/cs_files/Mathf.cs b/modules/mono/glue/cs_files/Mathf.cs
index d6655aa1e2..0d20a12563 100644
--- a/modules/mono/glue/cs_files/Mathf.cs
+++ b/modules/mono/glue/cs_files/Mathf.cs
@@ -145,7 +145,7 @@ namespace Godot
return x % y;
}
- return y - (-x % y);
+ return y - -x % y;
}
public static real_t InverseLerp(real_t from, real_t to, real_t weight)
@@ -175,22 +175,22 @@ namespace Godot
public static int Max(int a, int b)
{
- return (a > b) ? a : b;
+ return a > b ? a : b;
}
public static real_t Max(real_t a, real_t b)
{
- return (a > b) ? a : b;
+ return a > b ? a : b;
}
public static int Min(int a, int b)
{
- return (a < b) ? a : b;
+ return a < b ? a : b;
}
public static real_t Min(real_t a, real_t b)
{
- return (a < b) ? a : b;
+ return a < b ? a : b;
}
public static int NearestPo2(int value)
@@ -227,12 +227,12 @@ namespace Godot
public static int Sign(int s)
{
- return (s < 0) ? -1 : 1;
+ return s < 0 ? -1 : 1;
}
public static real_t Sign(real_t s)
{
- return (s < 0f) ? -1f : 1f;
+ return s < 0f ? -1f : 1f;
}
public static real_t Sin(real_t s)
@@ -273,13 +273,13 @@ namespace Godot
public static int Wrap(int value, int min, int max)
{
int rng = max - min;
- return min + ((((value - min) % rng) + rng) % rng);
+ return min + ((value - min) % rng + rng) % rng;
}
public static real_t Wrap(real_t value, real_t min, real_t max)
{
real_t rng = max - min;
- return min + ((((value - min) % rng) + rng) % rng);
+ return min + ((value - min) % rng + rng) % rng;
}
}
}
diff --git a/modules/mono/glue/cs_files/Plane.cs b/modules/mono/glue/cs_files/Plane.cs
index 6b19d929c8..1043738d7b 100644
--- a/modules/mono/glue/cs_files/Plane.cs
+++ b/modules/mono/glue/cs_files/Plane.cs
@@ -80,9 +80,9 @@ namespace Godot
if (Mathf.Abs(denom) <= Mathf.Epsilon)
return new Vector3();
- Vector3 result = (b.normal.Cross(c.normal) * d) +
- (c.normal.Cross(normal) * b.d) +
- (normal.Cross(b.normal) * c.d);
+ Vector3 result = b.normal.Cross(c.normal) * d +
+ c.normal.Cross(normal) * b.d +
+ normal.Cross(b.normal) * c.d;
return result / denom;
}
@@ -113,7 +113,7 @@ namespace Godot
real_t dist = (normal.Dot(begin) - d) / den;
- if (dist < -Mathf.Epsilon || dist > (1.0f + Mathf.Epsilon))
+ if (dist < -Mathf.Epsilon || dist > 1.0f + Mathf.Epsilon)
return new Vector3();
return begin + segment * -dist;
diff --git a/modules/mono/glue/cs_files/Quat.cs b/modules/mono/glue/cs_files/Quat.cs
index c0bce024cd..c69c55d997 100644
--- a/modules/mono/glue/cs_files/Quat.cs
+++ b/modules/mono/glue/cs_files/Quat.cs
@@ -137,7 +137,7 @@ namespace Godot
real_t sinom, scale0, scale1;
// Calculate coefficients
- if ((1.0 - cosom) > Mathf.Epsilon)
+ if (1.0 - cosom > Mathf.Epsilon)
{
// Standard case (Slerp)
real_t omega = Mathf.Acos(cosom);
diff --git a/modules/mono/glue/cs_files/Rect2.cs b/modules/mono/glue/cs_files/Rect2.cs
index 027360bb17..6f16656573 100644
--- a/modules/mono/glue/cs_files/Rect2.cs
+++ b/modules/mono/glue/cs_files/Rect2.cs
@@ -57,9 +57,9 @@ namespace Godot
public bool Encloses(Rect2 b)
{
- return (b.position.x >= position.x) && (b.position.y >= position.y) &&
- ((b.position.x + b.size.x) < (position.x + size.x)) &&
- ((b.position.y + b.size.y) < (position.y + size.y));
+ return b.position.x >= position.x && b.position.y >= position.y &&
+ b.position.x + b.size.x < position.x + size.x &&
+ b.position.y + b.size.y < position.y + size.y;
}
public Rect2 Expand(Vector2 to)
@@ -118,10 +118,10 @@ namespace Godot
{
var g = this;
- g.GrowIndividual((Margin.Left == margin) ? by : 0,
- (Margin.Top == margin) ? by : 0,
- (Margin.Right == margin) ? by : 0,
- (Margin.Bottom == margin) ? by : 0);
+ g.GrowIndividual(Margin.Left == margin ? by : 0,
+ Margin.Top == margin ? by : 0,
+ Margin.Right == margin ? by : 0,
+ Margin.Bottom == margin ? by : 0);
return g;
}
@@ -138,9 +138,9 @@ namespace Godot
if (point.y < position.y)
return false;
- if (point.x >= (position.x + size.x))
+ if (point.x >= position.x + size.x)
return false;
- if (point.y >= (position.y + size.y))
+ if (point.y >= position.y + size.y)
return false;
return true;
@@ -148,13 +148,13 @@ namespace Godot
public bool Intersects(Rect2 b)
{
- if (position.x > (b.position.x + b.size.x))
+ if (position.x > b.position.x + b.size.x)
return false;
- if ((position.x + size.x) < b.position.x)
+ if (position.x + size.x < b.position.x)
return false;
- if (position.y > (b.position.y + b.size.y))
+ if (position.y > b.position.y + b.size.y)
return false;
- if ((position.y + size.y) < b.position.y)
+ if (position.y + size.y < b.position.y)
return false;
return true;
diff --git a/modules/mono/glue/cs_files/StringExtensions.cs b/modules/mono/glue/cs_files/StringExtensions.cs
index de85b080df..c86208f9bd 100644
--- a/modules/mono/glue/cs_files/StringExtensions.cs
+++ b/modules/mono/glue/cs_files/StringExtensions.cs
@@ -312,7 +312,7 @@ namespace Godot
int c;
while ((c = instance[index++]) != 0)
- hashv = ((hashv << 5) + hashv) + c; // hash * 33 + c
+ hashv = (hashv << 5) + hashv + c; // hash * 33 + c
return hashv;
}
@@ -454,7 +454,10 @@ namespace Godot
return false; // Don't start with number plz
}
- bool valid_char = (instance[i] >= '0' && instance[i] <= '9') || (instance[i] >= 'a' && instance[i] <= 'z') || (instance[i] >= 'A' && instance[i] <= 'Z') || instance[i] == '_';
+ bool valid_char = instance[i] >= '0' &&
+ instance[i] <= '9' || instance[i] >= 'a' &&
+ instance[i] <= 'z' || instance[i] >= 'A' &&
+ instance[i] <= 'Z' || instance[i] == '_';
if (!valid_char)
return false;
@@ -550,7 +553,7 @@ namespace Godot
case '\0':
return instance[0] == 0;
case '*':
- return ExprMatch(expr + 1, instance, caseSensitive) || (instance[0] != 0 && ExprMatch(expr, instance + 1, caseSensitive));
+ return ExprMatch(expr + 1, instance, caseSensitive) || instance[0] != 0 && ExprMatch(expr, instance + 1, caseSensitive);
case '?':
return instance[0] != 0 && instance[0] != '.' && ExprMatch(expr + 1, instance + 1, caseSensitive);
default:
@@ -769,7 +772,7 @@ namespace Godot
if (pos < 0)
return string.Empty;
- return instance.Substring(pos, (instance.Length - pos));
+ return instance.Substring(pos, instance.Length - pos);
}
public static byte[] Sha256Buffer(this string instance)
@@ -822,7 +825,7 @@ namespace Godot
}
}
- return (2.0f * inter) / sum;
+ return 2.0f * inter / sum;
}
// <summary>
@@ -847,7 +850,7 @@ namespace Godot
int end = instance.Find(divisor, from);
if (end < 0)
end = len;
- if (allow_empty || (end > from))
+ if (allow_empty || end > @from)
ret.Add(float.Parse(instance.Substring(from)));
if (end == len)
break;
diff --git a/modules/mono/glue/cs_files/Transform.cs b/modules/mono/glue/cs_files/Transform.cs
index 2e98a4e2e8..d1b247a552 100644
--- a/modules/mono/glue/cs_files/Transform.cs
+++ b/modules/mono/glue/cs_files/Transform.cs
@@ -97,9 +97,9 @@ namespace Godot
return new Vector3
(
- (basis[0, 0] * vInv.x) + (basis[1, 0] * vInv.y) + (basis[2, 0] * vInv.z),
- (basis[0, 1] * vInv.x) + (basis[1, 1] * vInv.y) + (basis[2, 1] * vInv.z),
- (basis[0, 2] * vInv.x) + (basis[1, 2] * vInv.y) + (basis[2, 2] * vInv.z)
+ basis[0, 0] * vInv.x + basis[1, 0] * vInv.y + basis[2, 0] * vInv.z,
+ basis[0, 1] * vInv.x + basis[1, 1] * vInv.y + basis[2, 1] * vInv.z,
+ basis[0, 2] * vInv.x + basis[1, 2] * vInv.y + basis[2, 2] * vInv.z
);
}
diff --git a/modules/mono/glue/cs_files/Transform2D.cs b/modules/mono/glue/cs_files/Transform2D.cs
index d3969dfc6e..fad3c86190 100644
--- a/modules/mono/glue/cs_files/Transform2D.cs
+++ b/modules/mono/glue/cs_files/Transform2D.cs
@@ -163,7 +163,7 @@ namespace Godot
real_t dot = v1.Dot(v2);
// Clamp dot to [-1, 1]
- dot = (dot < -1.0f) ? -1.0f : ((dot > 1.0f) ? 1.0f : dot);
+ dot = dot < -1.0f ? -1.0f : (dot > 1.0f ? 1.0f : dot);
Vector2 v;
@@ -214,7 +214,7 @@ namespace Godot
Vector2 onY = on.y;
onX.Normalize();
- onY = onY - onX * (onX.Dot(onY));
+ onY = onY - onX * onX.Dot(onY);
onY.Normalize();
on.x = onX;
diff --git a/modules/mono/glue/cs_files/Vector2.cs b/modules/mono/glue/cs_files/Vector2.cs
index aa651abb03..7f8c342e6f 100644
--- a/modules/mono/glue/cs_files/Vector2.cs
+++ b/modules/mono/glue/cs_files/Vector2.cs
@@ -121,7 +121,7 @@ namespace Godot
real_t t2 = t * t;
real_t t3 = t2 * t;
- return 0.5f * ((p1 * 2.0f) +
+ return 0.5f * (p1 * 2.0f +
(-p0 + p2) * t +
(2.0f * p0 - 5.0f * p1 + 4 * p2 - p3) * t2 +
(-p0 + 3.0f * p1 - 3.0f * p2 + p3) * t3);
@@ -166,8 +166,8 @@ namespace Godot
{
var res = this;
- res.x += (t * (b.x - x));
- res.y += (t * (b.y - y));
+ res.x += t * (b.x - x);
+ res.y += t * (b.y - y);
return res;
}
diff --git a/modules/mono/glue/cs_files/Vector3.cs b/modules/mono/glue/cs_files/Vector3.cs
index c9c1bb344c..0a71f3fa4d 100644
--- a/modules/mono/glue/cs_files/Vector3.cs
+++ b/modules/mono/glue/cs_files/Vector3.cs
@@ -103,9 +103,9 @@ namespace Godot
{
return new Vector3
(
- (y * b.z) - (z * b.y),
- (z * b.x) - (x * b.z),
- (x * b.y) - (y * b.x)
+ y * b.z - z * b.y,
+ z * b.x - x * b.z,
+ x * b.y - y * b.x
);
}
@@ -120,7 +120,7 @@ namespace Godot
real_t t3 = t2 * t;
return 0.5f * (
- (p1 * 2.0f) + (-p0 + p2) * t +
+ p1 * 2.0f + (-p0 + p2) * t +
(2.0f * p0 - 5.0f * p1 + 4f * p2 - p3) * t2 +
(-p0 + 3.0f * p1 - 3.0f * p2 + p3) * t3
);
@@ -178,9 +178,9 @@ namespace Godot
{
return new Vector3
(
- x + (t * (b.x - x)),
- y + (t * (b.y - y)),
- z + (t * (b.z - z))
+ x + t * (b.x - x),
+ y + t * (b.y - y),
+ z + t * (b.z - z)
);
}