Changeset - r11863:a66d7566b05d
[Not reviewed]
master
0 1 0
yexo - 15 years ago 2009-05-09 19:45:02
yexo@openttd.org
(svn r16262) -Fix [NoAI]: Check slopes passed to the API better for validity
1 file changed with 3 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/ai/api/ai_tile.cpp
Show inline comments
 
@@ -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);
 
}
0 comments (0 inline, 0 general)