diff --git a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs index a6d0e900cc..fa28086718 100644 --- a/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs +++ b/OpenRA.Mods.Common/UtilityCommands/UpgradeRules.cs @@ -640,14 +640,41 @@ namespace OpenRA.Mods.Common.UtilityCommands if (node.Key == "Offset" && parent.Key.StartsWith("WithHarvestOverlay", StringComparison.Ordinal)) RenameNodeKey(node, "LocalOffset"); - if (node.Key == "LocalOffset") + var gridType = modData.Manifest.Get().Type; + if (gridType == MapGridType.RectangularIsometric) { - var orig = FieldLoader.GetValue(node.Key, node.Value.Value); - var scaled = orig.Select(o => FieldSaver.FormatValue(new WVec( - (int)Math.Round(Math.Sqrt(2) * o.X), - (int)Math.Round(Math.Sqrt(2) * o.Y), - (int)Math.Round(Math.Sqrt(2) * o.Z)))); - node.Value.Value = scaled.JoinWith(", "); + if (node.Key == "LocalOffset") + { + var orig = FieldLoader.GetValue(node.Key, node.Value.Value); + var scaled = orig.Select(o => FieldSaver.FormatValue(new WVec( + (int)Math.Round(Math.Sqrt(2) * o.X), + (int)Math.Round(Math.Sqrt(2) * o.Y), + (int)Math.Round(Math.Sqrt(2) * o.Z)))); + node.Value.Value = scaled.JoinWith(", "); + } + + if (node.Key == "Radius" && parent.Key == "Shape") + { + var orig = FieldLoader.GetValue(node.Key, node.Value.Value); + var scaled = (int)Math.Round(Math.Sqrt(2) * orig.Length); + node.Value.Value = scaled.ToString(); + } + + if (node.Key == "TopLeft" || node.Key == "BottomRight" || node.Key == "PointA" || node.Key == "PointB") + { + var orig = FieldLoader.GetValue(node.Key, node.Value.Value); + var scaled = new int2( + (int)Math.Round(Math.Sqrt(2) * orig.X), + (int)Math.Round(Math.Sqrt(2) * orig.Y)); + node.Value.Value = scaled.ToString(); + } + + if (node.Key == "VerticalTopOffset" || node.Key == "VerticalBottomOffset") + { + var orig = FieldLoader.GetValue(node.Key, node.Value.Value); + var scaled = (int)Math.Round(Math.Sqrt(2) * orig); + node.Value.Value = scaled.ToString(); + } } }