Fix a bug in Map/CellLayer.Contains.
This commit is contained in:
@@ -127,6 +127,12 @@ namespace OpenRA
|
|||||||
|
|
||||||
public bool Contains(CPos cell)
|
public bool Contains(CPos cell)
|
||||||
{
|
{
|
||||||
|
// .ToMPos() returns the same result if the X and Y coordinates
|
||||||
|
// are switched. X < Y is invalid in the Diamond coordinate system,
|
||||||
|
// so we pre-filter these to avoid returning the wrong result
|
||||||
|
if (Shape == TileShape.Diamond && cell.X < cell.Y)
|
||||||
|
return false;
|
||||||
|
|
||||||
return Contains(cell.ToMPos(Shape));
|
return Contains(cell.ToMPos(Shape));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -630,6 +630,12 @@ namespace OpenRA
|
|||||||
|
|
||||||
public bool Contains(CPos cell)
|
public bool Contains(CPos cell)
|
||||||
{
|
{
|
||||||
|
// .ToMPos() returns the same result if the X and Y coordinates
|
||||||
|
// are switched. X < Y is invalid in the Diamond coordinate system,
|
||||||
|
// so we pre-filter these to avoid returning the wrong result
|
||||||
|
if (TileShape == TileShape.Diamond && cell.X < cell.Y)
|
||||||
|
return false;
|
||||||
|
|
||||||
return Contains(cell.ToMPos(this));
|
return Contains(cell.ToMPos(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user