Remove 'yes' and 'no' in favor of 'true' and 'false'

This commit is contained in:
abcdefg30
2019-10-07 15:16:04 +02:00
committed by reaperrr
parent c4f48ad521
commit 55c3f313b1
21 changed files with 53 additions and 61 deletions

View File

@@ -415,7 +415,13 @@ namespace OpenRA
}
}
else if (fieldType == typeof(bool))
return ParseYesNo(value, fieldType, fieldName);
{
bool result;
if (bool.TryParse(value.ToLowerInvariant(), out result))
return result;
return InvalidValueAction(value, fieldType, fieldName);
}
else if (fieldType == typeof(int2[]))
{
if (value != null)
@@ -592,20 +598,6 @@ namespace OpenRA
return null;
}
static object ParseYesNo(string p, Type fieldType, string field)
{
if (string.IsNullOrEmpty(p))
return InvalidValueAction(p, fieldType, field);
p = p.ToLowerInvariant();
if (p == "yes") return true;
if (p == "true") return true;
if (p == "no") return false;
if (p == "false") return false;
return InvalidValueAction(p, fieldType, field);
}
public sealed class FieldLoadInfo
{
public readonly FieldInfo Field;