mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-17 21:25:40 +00:00
(svn r16262) -Fix [NoAI]: Check slopes passed to the API better for validity
This commit is contained in:
parent
d1aa2286ec
commit
2060b0b29a
@ -73,14 +73,14 @@
|
|||||||
|
|
||||||
/* static */ bool AITile::IsSteepSlope(Slope slope)
|
/* static */ bool AITile::IsSteepSlope(Slope slope)
|
||||||
{
|
{
|
||||||
if (slope == SLOPE_INVALID) return false;
|
if ((slope & ~(SLOPE_ELEVATED | SLOPE_STEEP | SLOPE_HALFTILE_MASK)) != 0) return false;
|
||||||
|
|
||||||
return ::IsSteepSlope((::Slope)slope);
|
return ::IsSteepSlope((::Slope)slope);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ bool AITile::IsHalftileSlope(Slope slope)
|
/* static */ bool AITile::IsHalftileSlope(Slope slope)
|
||||||
{
|
{
|
||||||
if (slope == SLOPE_INVALID) return false;
|
if ((slope & ~(SLOPE_ELEVATED | SLOPE_STEEP | SLOPE_HALFTILE_MASK)) != 0) return false;
|
||||||
|
|
||||||
return ::IsHalftileSlope((::Slope)slope);
|
return ::IsHalftileSlope((::Slope)slope);
|
||||||
}
|
}
|
||||||
@ -124,9 +124,7 @@
|
|||||||
|
|
||||||
/* static */ AITile::Slope AITile::GetComplementSlope(Slope slope)
|
/* static */ AITile::Slope AITile::GetComplementSlope(Slope slope)
|
||||||
{
|
{
|
||||||
if (slope == SLOPE_INVALID) return SLOPE_INVALID;
|
if ((slope & ~SLOPE_ELEVATED) != 0) return SLOPE_INVALID;
|
||||||
if (IsSteepSlope(slope)) return SLOPE_INVALID;
|
|
||||||
if (IsHalftileSlope(slope)) return SLOPE_INVALID;
|
|
||||||
|
|
||||||
return (Slope)::ComplementSlope((::Slope)slope);
|
return (Slope)::ComplementSlope((::Slope)slope);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user