Merge pull request #10702 from RoosterDragon/map-contains-fix
Fix Map.Contains for maps with height
This commit is contained in:
@@ -768,7 +768,12 @@ namespace OpenRA
|
||||
if (Grid.MaximumTerrainHeight == 0)
|
||||
return Contains((PPos)uv);
|
||||
|
||||
foreach (var puv in ProjectedCellsCovering(uv))
|
||||
// If the cell has no valid projection, then we're off the map.
|
||||
var projectedCells = ProjectedCellsCovering(uv);
|
||||
if (projectedCells.Length == 0)
|
||||
return false;
|
||||
|
||||
foreach (var puv in projectedCells)
|
||||
if (!Contains(puv))
|
||||
return false;
|
||||
return true;
|
||||
|
||||
@@ -65,17 +65,15 @@ namespace OpenRA.Traits
|
||||
.ToArray();
|
||||
|
||||
if (Footprint.Length == 0)
|
||||
throw new ArgumentException(("This frozen actor has no footprint! Please report a bug!\n" +
|
||||
throw new ArgumentException(("This frozen actor has no footprint.\n" +
|
||||
"Actor Name: {0}\n" +
|
||||
"Actor Location: {1}\n" +
|
||||
"Input footprint: [{2}]\n" +
|
||||
"Input footprint (shroud.Contains): [{3}]\n" +
|
||||
"Input footprint (map.Contains): [{4}]")
|
||||
"Input footprint (after shroud.Contains): [{3}]")
|
||||
.F(actor.Info.Name,
|
||||
actor.Location.ToString(),
|
||||
footprint.Select(p => p.ToString()).JoinWith("|"),
|
||||
footprint.Select(p => shroud.Contains(p).ToString()).JoinWith("|"),
|
||||
footprint.Select(p => actor.World.Map.Contains(p).ToString()).JoinWith("|")));
|
||||
footprint.Select(p => shroud.Contains(p).ToString()).JoinWith("|")));
|
||||
|
||||
CenterPosition = self.CenterPosition;
|
||||
Bounds = self.Bounds;
|
||||
|
||||
Reference in New Issue
Block a user