(svn r16262) -Fix [NoAI]: Check slopes passed to the API better for validity

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
yexo 15 years ago
parent f8944cc9b3
commit 8d22e4bec3

@ -73,14 +73,14 @@
/* 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);
}
/* 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);
}
@ -124,9 +124,7 @@
/* static */ AITile::Slope AITile::GetComplementSlope(Slope slope)
{
if (slope == SLOPE_INVALID) return SLOPE_INVALID;
if (IsSteepSlope(slope)) return SLOPE_INVALID;
if (IsHalftileSlope(slope)) return SLOPE_INVALID;
if ((slope & ~SLOPE_ELEVATED) != 0) return SLOPE_INVALID;
return (Slope)::ComplementSlope((::Slope)slope);
}

Loading…
Cancel
Save