Skip to content

Commit

Permalink
Replace String.Contains(Chars) with String.Contains(String).
Browse files Browse the repository at this point in the history
Game can't complain the String.Contains(Char) doesn't exists if you don't use it.
  • Loading branch information
MustaphaTR committed Mar 28, 2020
1 parent 1a30831 commit c11da79
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions OpenRA.Game/FieldLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,14 @@ public static object GetValue(string fieldName, Type fieldType, MiniYaml yaml, M
{
float res;
if (value != null && float.TryParse(value.Replace("%", ""), NumberStyles.Float, NumberFormatInfo.InvariantInfo, out res))
return res * (value.Contains('%') ? 0.01f : 1f);
return res * (value.Contains("%") ? 0.01f : 1f);
return InvalidValueAction(value, fieldType, fieldName);
}
else if (fieldType == typeof(decimal))
{
decimal res;
if (value != null && decimal.TryParse(value.Replace("%", ""), NumberStyles.Float, NumberFormatInfo.InvariantInfo, out res))
return res * (value.Contains('%') ? 0.01m : 1m);
return res * (value.Contains("%") ? 0.01m : 1m);
return InvalidValueAction(value, fieldType, fieldName);
}
else if (fieldType == typeof(string))
Expand Down Expand Up @@ -565,9 +565,9 @@ public static object GetValue(string fieldName, Type fieldType, MiniYaml yaml, M
float yy = 0;
float res;
if (float.TryParse(parts[0].Replace("%", ""), NumberStyles.Float, NumberFormatInfo.InvariantInfo, out res))
xx = res * (parts[0].Contains('%') ? 0.01f : 1f);
xx = res * (parts[0].Contains("%") ? 0.01f : 1f);
if (float.TryParse(parts[1].Replace("%", ""), NumberStyles.Float, NumberFormatInfo.InvariantInfo, out res))
yy = res * (parts[1].Contains('%') ? 0.01f : 1f);
yy = res * (parts[1].Contains("%") ? 0.01f : 1f);
return new float2(xx, yy);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ internal static void FromChromeLayout(ref List<MiniYamlNode> nodes, MiniYamlNode

foreach (var node in nodes)
{
var alreadyTranslated = node.Value.Value != null && node.Value.Value.Contains('@');
var alreadyTranslated = node.Value.Value != null && node.Value.Value.Contains("@");
if (translatables.Contains(node.Key) && !alreadyTranslated && parentLabel != null)
{
var translationKey = "{0}-{1}-{2}".F(container.Replace('_', '-'), parentLabel.Replace('_', '-'), node.Key.ToUpper());
Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Mods.Common/UtilityCommands/Glob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static IEnumerable<string> Expand(string filePath)
if (parts.Count == 0
|| (parts[0][0] != Path.DirectorySeparatorChar
&& parts[0][0] != Path.AltDirectorySeparatorChar
&& parts[0].Contains(':') == false
&& parts[0].Contains(":") == false
&& parts[0] != "." + Path.DirectorySeparatorChar
&& parts[0] != "." + Path.AltDirectorySeparatorChar
&& parts[0] != ".." + Path.DirectorySeparatorChar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public ActorSelectorLogic(Widget widget, World world, WorldRenderer worldRendere
foreach (var a in mapRules.Actors.Values)
{
// Partial templates are not allowed
if (a.Name.Contains('^'))
if (a.Name.Contains("^"))
continue;

// Actor must have a preview associated with it
Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Mods.Common/Widgets/Logic/TabCompletionLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public string Complete(string text)
}
else if (Names != null)
{
var oneWord = text.Contains(' ');
var oneWord = text.Contains(" ");
if (oneWord)
{
prefix = text.Substring(0, text.LastIndexOf(' ') + 1);
Expand Down

0 comments on commit c11da79

Please sign in to comment.