Convert versus to integers.

This commit is contained in:
Paul Chote
2014-08-17 21:54:58 +12:00
parent 50fea12a80
commit fa3e7b5e1b
11 changed files with 835 additions and 830 deletions

View File

@@ -29,7 +29,7 @@ namespace OpenRA.Utility
static void ConvertFloatArrayToPercentArray(ref string input)
{
input = string.Join(", ", input.Split(',')
.Select(s => ((int)(float.Parse(s) * 100)).ToString()));
.Select(s => ((int)Math.Round(FieldLoader.GetValue<float>("(float value)", s) * 100)).ToString()));
}
static void ConvertPxToRange(ref string input)
@@ -755,6 +755,13 @@ namespace OpenRA.Utility
}
}
if (engineVersion < 20140821)
{
// Converted versus definitions to integers
if (depth == 3 && parentKey == "Versus")
ConvertFloatArrayToPercentArray(ref node.Value.Value);
}
UpgradeWeaponRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
}
}