diff --git a/OpenRA.Game/Manifest.cs b/OpenRA.Game/Manifest.cs index a1ae7d4612..282ae968d1 100644 --- a/OpenRA.Game/Manifest.cs +++ b/OpenRA.Game/Manifest.cs @@ -37,7 +37,7 @@ namespace OpenRA public readonly Size TileSize = new Size(24, 24); public readonly TileShape TileShape = TileShape.Rectangle; - [Desc("(x,y,z) offset of the full cell and each sub-cell", "x & y: -512 ... 512, Z >= 0")] + [Desc("(x,y,z) offset of the full cell and each sub-cell", "X & Y should be between -512 ... 512 and Z >= 0")] public readonly WVec[] SubCellOffsets = { new WVec(0, 0, 0), // full cell - index 0 @@ -101,32 +101,21 @@ namespace OpenRA if (yaml.ContainsKey("TileShape")) TileShape = FieldLoader.GetValue("TileShape", yaml["TileShape"].Value); - // Read subcell information - // sub-cell index 0 is the full cell if (yaml.ContainsKey("SubCells")) { var subcells = yaml["SubCells"].ToDictionary(); // Read (x,y,z) offset (relative to cell center) pairs for positioning subcells if (subcells.ContainsKey("Offsets")) - { SubCellOffsets = FieldLoader.GetValue("Offsets", subcells["Offsets"].Value); - foreach (var i in SubCellOffsets) - if (i.X < -512 || i.X > 512 || i.Y < -512 || i.Y > 512 || i.Z < 0) - throw new InvalidDataException("Subcell offsets must be in bounds (X & Y: -512 ... 512, Z > 0)"); - } - - // Read default subcell index used when creating actors that share cells without SubCellInit if (subcells.ContainsKey("DefaultIndex")) - SubCellDefaultIndex = FieldLoader.GetValue("DefaultIndex", subcells ["DefaultIndex"].Value); - - // Otherwise set the default subcell index to the middle subcell entry - else - SubCellDefaultIndex = SubCellOffsets.Length / 2; // default is the middle subcell entry + SubCellDefaultIndex = FieldLoader.GetValue("DefaultIndex", subcells["DefaultIndex"].Value); + else // Otherwise set the default subcell index to the middle subcell entry + SubCellDefaultIndex = SubCellOffsets.Length / 2; } - // validate default index - 0 for no subcells, otherwise > 1 & <= subcell count (offset triples count - 1) + // Validate default index - 0 for no subcells, otherwise > 1 & <= subcell count (offset triples count - 1) if (SubCellDefaultIndex < (SubCellOffsets.Length > 1 ? 1 : 0) || SubCellDefaultIndex >= SubCellOffsets.Length) throw new InvalidDataException("Subcell default index must be a valid index into the offset triples and must be greater than 0 for mods with subcells"); diff --git a/OpenRA.Game/Traits/World/ActorMap.cs b/OpenRA.Game/Traits/World/ActorMap.cs index 3c028af924..32f927a706 100644 --- a/OpenRA.Game/Traits/World/ActorMap.cs +++ b/OpenRA.Game/Traits/World/ActorMap.cs @@ -93,7 +93,7 @@ namespace OpenRA.Traits if (!AnyUnitsAt(a)) return map.SubCellDefaultIndex; - for (var i = 1; i < map.SubCellOffsets.Length; ++i) + for (var i = 1; i < map.SubCellOffsets.Length; i++) if (!AnyUnitsAt(a, i)) return i; return -1; diff --git a/OpenRA.Mods.RA/Move/Mobile.cs b/OpenRA.Mods.RA/Move/Mobile.cs index f4419079bc..b83ea123cc 100755 --- a/OpenRA.Mods.RA/Move/Mobile.cs +++ b/OpenRA.Mods.RA/Move/Mobile.cs @@ -442,7 +442,7 @@ namespace OpenRA.Mods.RA.Move if (IsDesiredSubcellNotBlocked(a, fromSubCell, ignoreActor)) return fromSubCell; - for (var i = 1; i < self.World.Map.SubCellOffsets.Length; ++i) + for (var i = 1; i < self.World.Map.SubCellOffsets.Length; i++) if (IsDesiredSubcellNotBlocked(a, i, ignoreActor)) return i;