Convert damage modifiers to integer percentages.

This commit is contained in:
Paul Chote
2014-08-09 21:27:37 +12:00
parent c5519a7f3b
commit 0425416ce2
11 changed files with 59 additions and 27 deletions

View File

@@ -26,6 +26,12 @@ namespace OpenRA.Utility
input = "{0}c{1}".F(cells, subcells);
}
static void ConvertFloatArrayToPercentArray(ref string input)
{
input = string.Join(", ", input.Split(',')
.Select(s => ((int)(float.Parse(s) * 100)).ToString()));
}
static void ConvertPxToRange(ref string input)
{
ConvertPxToRange(ref input, 1, 1);
@@ -402,6 +408,16 @@ namespace OpenRA.Utility
}
}
// Modifiers were changed to integer percentages
if (engineVersion < 20140809)
{
if (depth == 2 && node.Key == "ClosedDamageMultiplier" && parentKey == "AttackPopupTurreted")
ConvertFloatArrayToPercentArray(ref node.Value.Value);
if (depth == 2 && node.Key == "ArmorModifier" && parentKey == "GainsStatUpgrades")
ConvertFloatArrayToPercentArray(ref node.Value.Value);
}
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
}
}