diff --git a/modules/mono/glue/cs_files/AABB.cs b/modules/mono/glue/cs_files/AABB.cs index 94f27f38aa4..84566d855a1 100644 --- a/modules/mono/glue/cs_files/AABB.cs +++ b/modules/mono/glue/cs_files/AABB.cs @@ -111,8 +111,8 @@ namespace Godot public Vector3 GetLongestAxis() { - Vector3 axis = new Vector3(1f, 0f, 0f); - real_t max_size = size.x; + var axis = new Vector3(1f, 0f, 0f); + real_t max_size = size.x; if (size.y > max_size) { @@ -131,7 +131,7 @@ namespace Godot public Vector3.Axis GetLongestAxisIndex() { - Vector3.Axis axis = Vector3.Axis.X; + var axis = Vector3.Axis.X; real_t max_size = size.x; if (size.y > max_size) @@ -151,7 +151,7 @@ namespace Godot public real_t GetLongestAxisSize() { - real_t max_size = size.x; + real_t max_size = size.x; if (size.y > max_size) max_size = size.y; @@ -164,8 +164,8 @@ namespace Godot public Vector3 GetShortestAxis() { - Vector3 axis = new Vector3(1f, 0f, 0f); - real_t max_size = size.x; + var axis = new Vector3(1f, 0f, 0f); + real_t max_size = size.x; if (size.y < max_size) { @@ -184,8 +184,8 @@ namespace Godot public Vector3.Axis GetShortestAxisIndex() { - Vector3.Axis axis = Vector3.Axis.X; - real_t max_size = size.x; + var axis = Vector3.Axis.X; + real_t max_size = size.x; if (size.y < max_size) { @@ -204,7 +204,7 @@ namespace Godot public real_t GetShortestAxisSize() { - real_t max_size = size.x; + real_t max_size = size.x; if (size.y < max_size) max_size = size.y; @@ -228,7 +228,7 @@ namespace Godot public AABB Grow(real_t by) { - AABB res = this; + var res = this; res.position.x -= by; res.position.y -= by; @@ -339,7 +339,7 @@ namespace Godot bool over = false; bool under = false; - for (int i = 0; i < 8; i++) + for (var i = 0; i < 8; i++) { if (plane.DistanceTo(points[i]) > 0) over = true; @@ -355,7 +355,7 @@ namespace Godot real_t min = 0f; real_t max = 1f; - for (int i = 0; i < 3; i++) + for (var i = 0; i < 3; i++) { real_t seg_from = from[i]; real_t seg_to = to[i]; @@ -400,16 +400,16 @@ namespace Godot { Vector3 beg_1 = position; Vector3 beg_2 = with.position; - Vector3 end_1 = new Vector3(size.x, size.y, size.z) + beg_1; - Vector3 end_2 = new Vector3(with.size.x, with.size.y, with.size.z) + beg_2; + var end_1 = new Vector3(size.x, size.y, size.z) + beg_1; + var end_2 = new Vector3(with.size.x, with.size.y, with.size.z) + beg_2; - Vector3 min = new Vector3( + 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 ); - Vector3 max = new Vector3( + 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 diff --git a/modules/mono/glue/cs_files/Basis.cs b/modules/mono/glue/cs_files/Basis.cs index 660243f77ff..d16e40488cb 100644 --- a/modules/mono/glue/cs_files/Basis.cs +++ b/modules/mono/glue/cs_files/Basis.cs @@ -220,11 +220,11 @@ namespace Godot public int GetOrthogonalIndex() { - Basis orth = this; + var orth = this; - for (int i = 0; i < 3; i++) + for (var i = 0; i < 3; i++) { - for (int j = 0; j < 3; j++) + for (var j = 0; j < 3; j++) { real_t v = orth[i, j]; @@ -239,7 +239,7 @@ namespace Godot } } - for (int i = 0; i < 24; i++) + for (var i = 0; i < 24; i++) { if (orthoBases[i] == orth) return i; @@ -250,9 +250,9 @@ namespace Godot public Basis Inverse() { - Basis inv = this; + var inv = this; - real_t[] co = new real_t[3] + var co = new real_t[3] { inv[1, 1] * inv[2, 2] - inv[1, 2] * inv[2, 1], inv[1, 2] * inv[2, 0] - inv[1, 0] * inv[2, 2], @@ -311,7 +311,7 @@ namespace Godot public Basis Scaled(Vector3 scale) { - Basis m = this; + var m = this; m[0, 0] *= scale.x; m[0, 1] *= scale.x; @@ -343,7 +343,7 @@ namespace Godot public Basis Transposed() { - Basis tr = this; + var tr = this; real_t temp = this[0, 1]; this[0, 1] = this[1, 0]; @@ -415,8 +415,8 @@ namespace Godot (_x[2] - _z[0]) * inv_s ); } else { - real_t s = Mathf.Sqrt(-_x[0] - _y[1] + _z[2] + 1.0f) * 2f; - real_t inv_s = 1f / s; + var s = Mathf.Sqrt(-_x[0] - _y[1] + _z[2] + 1.0f) * 2f; + var inv_s = 1f / s; return new Quat( (_x[2] + _z[0]) * inv_s, (_y[2] + _z[1]) * inv_s, @@ -450,7 +450,7 @@ namespace Godot public Basis(Vector3 axis, real_t phi) { - Vector3 axis_sq = new Vector3(axis.x * axis.x, axis.y * axis.y, axis.z * axis.z); + var axis_sq = new Vector3(axis.x * axis.x, axis.y * axis.y, axis.z * axis.z); real_t cosine = Mathf.Cos( phi); real_t sine = Mathf.Sin( phi); diff --git a/modules/mono/glue/cs_files/Color.cs b/modules/mono/glue/cs_files/Color.cs index 618ae8870e0..d15f891e21d 100644 --- a/modules/mono/glue/cs_files/Color.cs +++ b/modules/mono/glue/cs_files/Color.cs @@ -45,8 +45,8 @@ namespace Godot { get { - float max = Mathf.Max(r, Mathf.Max(g, b)); - float min = Mathf.Min(r, Mathf.Min(g, b)); + float max = Math.Max(r, Math.Max(g, b)); + float min = Math.Min(r, Math.Min(g, b)); float delta = max - min; @@ -79,8 +79,8 @@ namespace Godot { get { - float max = Mathf.Max(r, Mathf.Max(g, b)); - float min = Mathf.Min(r, Mathf.Min(g, b)); + float max = Math.Max(r, Math.Max(g, b)); + float min = Math.Min(r, Math.Min(g, b)); float delta = max - min; @@ -96,7 +96,7 @@ namespace Godot { get { - return Mathf.Max(r, Mathf.Max(g, b)); + return Math.Max(r, Math.Max(g, b)); } set { @@ -265,7 +265,7 @@ namespace Godot public Color LinearInterpolate(Color b, float t) { - Color res = this; + var res = this; res.r += (t * (b.r - r)); res.g += (t * (b.g - g)); @@ -303,7 +303,7 @@ namespace Godot public string ToHtml(bool include_alpha = true) { - String txt = string.Empty; + var txt = string.Empty; txt += _to_hex(r); txt += _to_hex(g); @@ -339,10 +339,10 @@ namespace Godot { int ig = 0; - for (int i = 0; i < 2; i++) + for (var i = 0; i < 2; i++) { int c = str[i + ofs]; - int v = 0; + var v = 0; if (c >= '0' && c <= '9') { @@ -374,11 +374,11 @@ namespace Godot private String _to_hex(float val) { - int v = (int) Mathf.Clamp(val * 255.0f, 0, 255); + var v = (int) Mathf.Clamp(val * 255.0f, 0, 255); - string ret = string.Empty; + var ret = string.Empty; - for (int i = 0; i < 2; i++) + for (var i = 0; i < 2; i++) { char[] c = { (char)0, (char)0 }; int lv = v & 0xF; @@ -403,7 +403,7 @@ namespace Godot if (color[0] == '#') color = color.Substring(1, color.Length - 1); - bool alpha = false; + var alpha = false; if (color.Length == 8) alpha = true; @@ -449,7 +449,7 @@ namespace Godot if (rgba[0] == '#') rgba = rgba.Substring(1); - bool alpha = false; + var alpha = false; if (rgba.Length == 8) { diff --git a/modules/mono/glue/cs_files/DebuggingUtils.cs b/modules/mono/glue/cs_files/DebuggingUtils.cs index bbedf2fc44b..a654c9b268e 100644 --- a/modules/mono/glue/cs_files/DebuggingUtils.cs +++ b/modules/mono/glue/cs_files/DebuggingUtils.cs @@ -32,7 +32,7 @@ namespace Godot return; } - StringBuilder sb = new StringBuilder(); + var sb = new StringBuilder(); if (methodBase is MethodInfo) sb.AppendTypeName(((MethodInfo)methodBase).ReturnType); @@ -47,7 +47,7 @@ namespace Godot sb.Append("<"); - for (int j = 0; j < genericParams.Length; j++) + for (var j = 0; j < genericParams.Length; j++) { if (j > 0) sb.Append(", "); @@ -64,7 +64,7 @@ namespace Godot ParameterInfo[] parameter = methodBase.GetParameters(); - for (int i = 0; i < parameter.Length; i++) + for (var i = 0; i < parameter.Length; i++) { if (i > 0) sb.Append(", "); diff --git a/modules/mono/glue/cs_files/GD.cs b/modules/mono/glue/cs_files/GD.cs index 1ee7e7d21cc..f0967f2269c 100644 --- a/modules/mono/glue/cs_files/GD.cs +++ b/modules/mono/glue/cs_files/GD.cs @@ -91,9 +91,9 @@ namespace Godot public static int[] Range(int length) { - int[] ret = new int[length]; + var ret = new int[length]; - for (int i = 0; i < length; i++) + for (var i = 0; i < length; i++) { ret[i] = i; } @@ -106,9 +106,9 @@ namespace Godot if (to < from) return new int[0]; - int[] ret = new int[to - from]; + var ret = new int[to - from]; - for (int i = from; i < to; i++) + for (var i = from; i < to; i++) { ret[i - from] = i; } @@ -124,27 +124,27 @@ namespace Godot return new int[0]; // Calculate count - int count = 0; + var count = 0; if (increment > 0) count = ((to - from - 1) / increment) + 1; else count = ((from - to - 1) / -increment) + 1; - int[] ret = new int[count]; + var ret = new int[count]; if (increment > 0) { - int idx = 0; - for (int i = from; i < to; i += increment) + int idx = 0; + for (var i = from; i < to; i += increment) { ret[idx++] = i; } } else { - int idx = 0; - for (int i = from; i > to; i += increment) + int idx = 0; + for (var i = from; i > to; i += increment) { ret[idx++] = i; } diff --git a/modules/mono/glue/cs_files/MarshalUtils.cs b/modules/mono/glue/cs_files/MarshalUtils.cs index 2bdfb95c511..661af3f8a20 100644 --- a/modules/mono/glue/cs_files/MarshalUtils.cs +++ b/modules/mono/glue/cs_files/MarshalUtils.cs @@ -7,9 +7,9 @@ namespace Godot { private static Dictionary ArraysToDictionary(object[] keys, object[] values) { - Dictionary ret = new Dictionary(); + var ret = new Dictionary(); - for (int i = 0; i < keys.Length; i++) + for (var i = 0; i < keys.Length; i++) { ret.Add(keys[i], values[i]); } @@ -19,11 +19,11 @@ namespace Godot private static void DictionaryToArrays(Dictionary from, out object[] keysTo, out object[] valuesTo) { - Dictionary.KeyCollection keys = from.Keys; + var keys = from.Keys; keysTo = new object[keys.Count]; keys.CopyTo(keysTo, 0); - Dictionary.ValueCollection values = from.Values; + var values = from.Values; valuesTo = new object[values.Count]; values.CopyTo(valuesTo, 0); } diff --git a/modules/mono/glue/cs_files/Plane.cs b/modules/mono/glue/cs_files/Plane.cs index edbb3545b85..6b19d929c83 100644 --- a/modules/mono/glue/cs_files/Plane.cs +++ b/modules/mono/glue/cs_files/Plane.cs @@ -80,7 +80,7 @@ namespace Godot if (Mathf.Abs(denom) <= Mathf.Epsilon) return new Vector3(); - Vector3 result = (b.normal.Cross(c.normal) * d) + + Vector3 result = (b.normal.Cross(c.normal) * d) + (c.normal.Cross(normal) * b.d) + (normal.Cross(b.normal) * c.d); diff --git a/modules/mono/glue/cs_files/Quat.cs b/modules/mono/glue/cs_files/Quat.cs index cfdb5f21ee2..c0bce024cd8 100644 --- a/modules/mono/glue/cs_files/Quat.cs +++ b/modules/mono/glue/cs_files/Quat.cs @@ -116,7 +116,7 @@ namespace Godot // Calculate cosine real_t cosom = x * b.x + y * b.y + z * b.z + w * b.w; - real_t[] to1 = new real_t[4]; + var to1 = new real_t[4]; // Adjust signs if necessary if (cosom < 0.0) diff --git a/modules/mono/glue/cs_files/Rect2.cs b/modules/mono/glue/cs_files/Rect2.cs index c7a29b2f0be..027360bb172 100644 --- a/modules/mono/glue/cs_files/Rect2.cs +++ b/modules/mono/glue/cs_files/Rect2.cs @@ -38,7 +38,7 @@ namespace Godot public Rect2 Clip(Rect2 b) { - Rect2 newRect = b; + var newRect = b; if (!Intersects(newRect)) return new Rect2(); @@ -64,7 +64,7 @@ namespace Godot public Rect2 Expand(Vector2 to) { - Rect2 expanded = this; + var expanded = this; Vector2 begin = expanded.position; Vector2 end = expanded.position + expanded.size; @@ -92,7 +92,7 @@ namespace Godot public Rect2 Grow(real_t by) { - Rect2 g = this; + var g = this; g.position.x -= by; g.position.y -= by; @@ -104,7 +104,7 @@ namespace Godot public Rect2 GrowIndividual(real_t left, real_t top, real_t right, real_t bottom) { - Rect2 g = this; + var g = this; g.position.x -= left; g.position.y -= top; @@ -116,7 +116,7 @@ namespace Godot public Rect2 GrowMargin(Margin margin, real_t by) { - Rect2 g = this; + var g = this; g.GrowIndividual((Margin.Left == margin) ? by : 0, (Margin.Top == margin) ? by : 0, diff --git a/modules/mono/glue/cs_files/StringExtensions.cs b/modules/mono/glue/cs_files/StringExtensions.cs index a18c04b2740..030d1282f31 100644 --- a/modules/mono/glue/cs_files/StringExtensions.cs +++ b/modules/mono/glue/cs_files/StringExtensions.cs @@ -82,9 +82,9 @@ namespace Godot // public static string[] Bigrams(this string instance) { - string[] b = new string[instance.Length - 1]; + var b = new string[instance.Length - 1]; - for (int i = 0; i < b.Length; i++) + for (var i = 0; i < b.Length; i++) { b[i] = instance.Substring(i, 2); } @@ -97,7 +97,7 @@ namespace Godot // public static string CEscape(this string instance) { - StringBuilder sb = new StringBuilder(string.Copy(instance)); + var sb = new StringBuilder(string.Copy(instance)); sb.Replace("\\", "\\\\"); sb.Replace("\a", "\\a"); @@ -119,7 +119,7 @@ namespace Godot // public static string CUnescape(this string instance) { - StringBuilder sb = new StringBuilder(string.Copy(instance)); + var sb = new StringBuilder(string.Copy(instance)); sb.Replace("\\a", "\a"); sb.Replace("\\b", "\b"); @@ -141,12 +141,12 @@ namespace Godot // public static string Capitalize(this string instance) { - string aux = instance.Replace("_", " ").ToLower(); - string cap = string.Empty; + string aux = instance.Replace("_", " ").ToLower(); + var cap = string.Empty; - for (int i = 0; i < aux.GetSliceCount(" "); i++) + for (var i = 0; i < aux.GetSliceCount(" "); i++) { - string slice = aux.GetSlicec(' ', i); + string slice = aux.GetSlicec(' ', i); if (slice.Length > 0) { slice = char.ToUpper(slice[0]) + slice.Substring(1); @@ -259,12 +259,12 @@ namespace Godot { int basepos = instance.Find("://"); - string rs = string.Empty; - string @base = string.Empty; + var rs = string.Empty; + var @base = string.Empty; if (basepos != -1) { - int end = basepos + 3; + var end = basepos + 3; rs = instance.Substring(end, instance.Length); @base = instance.Substring(0, end); } @@ -378,7 +378,7 @@ namespace Godot while (instance[src] != 0 && text[tgt] != 0) { - bool match = false; + var match = false; if (case_insensitive) { @@ -446,7 +446,7 @@ namespace Godot if (len == 0) return false; - for (int i = 0; i < len; i++) + for (var i = 0; i < len; i++) { if (i == 0) { @@ -482,7 +482,7 @@ namespace Godot if (ip.Length != 4) return false; - for (int i = 0; i < ip.Length; i++) + for (var i = 0; i < ip.Length; i++) { string n = ip[i]; if (!n.IsValidInteger()) @@ -501,7 +501,7 @@ namespace Godot // public static string JsonEscape(this string instance) { - StringBuilder sb = new StringBuilder(string.Copy(instance)); + var sb = new StringBuilder(string.Copy(instance)); sb.Replace("\\", "\\\\"); sb.Replace("\b", "\\b"); @@ -810,9 +810,9 @@ namespace Godot float sum = src_size + tgt_size; float inter = 0; - for (int i = 0; i < src_size; i++) + for (var i = 0; i < src_size; i++) { - for (int j = 0; j < tgt_size; j++) + for (var j = 0; j < tgt_size; j++) { if (srcBigrams[i] == tgtBigrams[j]) { @@ -838,9 +838,9 @@ namespace Godot // public static float[] SplitFloats(this string instance, string divisor, bool allow_empty = true) { - List ret = new List(); - int from = 0; - int len = instance.Length; + var ret = new List(); + int from = 0; + int len = instance.Length; while (true) { diff --git a/modules/mono/glue/cs_files/Transform.cs b/modules/mono/glue/cs_files/Transform.cs index ff6d3869943..2e98a4e2e84 100644 --- a/modules/mono/glue/cs_files/Transform.cs +++ b/modules/mono/glue/cs_files/Transform.cs @@ -28,7 +28,7 @@ namespace Godot public Transform LookingAt(Vector3 target, Vector3 up) { - Transform t = this; + var t = this; t.SetLookAt(origin, target, up); return t; } diff --git a/modules/mono/glue/cs_files/Transform2D.cs b/modules/mono/glue/cs_files/Transform2D.cs index 44e5d042b94..cfb6a68b386 100644 --- a/modules/mono/glue/cs_files/Transform2D.cs +++ b/modules/mono/glue/cs_files/Transform2D.cs @@ -110,7 +110,7 @@ namespace Godot public Transform2D AffineInverse() { - Transform2D inv = this; + var inv = this; real_t det = this[0, 0] * this[1, 1] - this[1, 0] * this[0, 1]; @@ -157,15 +157,15 @@ namespace Godot Vector2 s2 = m.Scale; // Slerp rotation - Vector2 v1 = new Vector2(Mathf.Cos(r1), Mathf.Sin(r1)); - Vector2 v2 = new Vector2(Mathf.Cos(r2), Mathf.Sin(r2)); + var v1 = new Vector2(Mathf.Cos(r1), Mathf.Sin(r1)); + var v2 = new Vector2(Mathf.Cos(r2), Mathf.Sin(r2)); real_t dot = v1.Dot(v2); // Clamp dot to [-1, 1] dot = (dot < -1.0f) ? -1.0f : ((dot > 1.0f) ? 1.0f : dot); - Vector2 v = new Vector2(); + var v = new Vector2(); if (dot > 0.9995f) { @@ -184,8 +184,8 @@ namespace Godot Vector2 p2 = m.Origin; // Construct matrix - Transform2D res = new Transform2D(Mathf.Atan2(v.y, v.x), p1.LinearInterpolate(p2, c)); - Vector2 scale = s1.LinearInterpolate(s2, c); + var res = new Transform2D(Mathf.Atan2(v.y, v.x), p1.LinearInterpolate(p2, c)); + Vector2 scale = s1.LinearInterpolate(s2, c); res.x *= scale; res.y *= scale; @@ -194,7 +194,7 @@ namespace Godot public Transform2D Inverse() { - Transform2D inv = this; + var inv = this; // Swap real_t temp = inv.x.y; @@ -208,7 +208,7 @@ namespace Godot public Transform2D Orthonormalized() { - Transform2D on = this; + var on = this; Vector2 onX = on.x; Vector2 onY = on.y; @@ -230,7 +230,7 @@ namespace Godot public Transform2D Scaled(Vector2 scale) { - Transform2D copy = this; + var copy = this; copy.x *= scale; copy.y *= scale; copy.o *= scale; @@ -249,7 +249,7 @@ namespace Godot public Transform2D Translated(Vector2 offset) { - Transform2D copy = this; + var copy = this; copy.o += copy.BasisXform(offset); return copy; } diff --git a/modules/mono/glue/cs_files/Vector2.cs b/modules/mono/glue/cs_files/Vector2.cs index a5da9f97da5..aa651abb03b 100644 --- a/modules/mono/glue/cs_files/Vector2.cs +++ b/modules/mono/glue/cs_files/Vector2.cs @@ -99,8 +99,8 @@ namespace Godot public Vector2 Clamped(real_t length) { - Vector2 v = this; - real_t l = Length(); + var v = this; + real_t l = Length(); if (l > 0 && length < l) { @@ -113,10 +113,10 @@ namespace Godot public Vector2 CubicInterpolate(Vector2 b, Vector2 preA, Vector2 postB, real_t t) { - Vector2 p0 = preA; - Vector2 p1 = this; - Vector2 p2 = b; - Vector2 p3 = postB; + var p0 = preA; + var p1 = this; + var p2 = b; + var p3 = postB; real_t t2 = t * t; real_t t3 = t2 * t; @@ -164,7 +164,7 @@ namespace Godot public Vector2 LinearInterpolate(Vector2 b, real_t t) { - Vector2 res = this; + var res = this; res.x += (t * (b.x - x)); res.y += (t * (b.y - y)); @@ -174,7 +174,7 @@ namespace Godot public Vector2 Normalized() { - Vector2 result = this; + var result = this; result.Normalize(); return result; } diff --git a/modules/mono/glue/cs_files/Vector3.cs b/modules/mono/glue/cs_files/Vector3.cs index af190bfd581..c9c1bb344c3 100644 --- a/modules/mono/glue/cs_files/Vector3.cs +++ b/modules/mono/glue/cs_files/Vector3.cs @@ -111,10 +111,10 @@ namespace Godot public Vector3 CubicInterpolate(Vector3 b, Vector3 preA, Vector3 postB, real_t t) { - Vector3 p0 = preA; - Vector3 p1 = this; - Vector3 p2 = b; - Vector3 p3 = postB; + var p0 = preA; + var p1 = this; + var p2 = b; + var p3 = postB; real_t t2 = t * t; real_t t3 = t2 * t; @@ -196,7 +196,7 @@ namespace Godot public Vector3 Normalized() { - Vector3 v = this; + var v = this; v.Normalize(); return v; }