Changeset - r18249:4312edc888fe
[Not reviewed]
master
0 2 0
rubidium - 13 years ago 2011-11-04 10:25:33
rubidium@openttd.org
(svn r23095) -Codechange: remove useless divisions/multiplications by TILE_HEIGHT for the AI API code
2 files changed with 6 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/ai/api/ai_tile.cpp
Show inline comments
 
@@ -156,14 +156,14 @@
 
{
 
	if (!::IsValidTile(tile)) return -1;
 

	
 
	return ::GetTilePixelZ(tile) / ::TILE_HEIGHT;
 
	return ::GetTileZ(tile);
 
}
 

	
 
/* static */ int32 AITile::GetMaxHeight(TileIndex tile)
 
{
 
	if (!::IsValidTile(tile)) return -1;
 

	
 
	return ::GetTileMaxPixelZ(tile) / ::TILE_HEIGHT;
 
	return ::GetTileMaxZ(tile);
 
}
 

	
 
/* static */ int32 AITile::GetCornerHeight(TileIndex tile, Corner corner)
 
@@ -171,8 +171,8 @@
 
	if (!::IsValidTile(tile) || !::IsValidCorner((::Corner)corner)) return -1;
 

	
 
	uint z;
 
	::Slope slope = ::GetTilePixelSlope(tile, &z);
 
	return (z + ::GetSlopePixelZInCorner(slope, (::Corner)corner)) / ::TILE_HEIGHT;
 
	::Slope slope = ::GetTileSlope(tile, &z);
 
	return (z + ::GetSlopeZInCorner(slope, (::Corner)corner));
 
}
 

	
 
/* static */ AICompany::CompanyID AITile::GetOwner(TileIndex tile)
src/ai/api/ai_tunnel.cpp
Show inline comments
 
@@ -30,7 +30,7 @@
 
	if (IsTunnelTile(tile)) return ::GetOtherTunnelEnd(tile);
 

	
 
	uint start_z;
 
	Slope start_tileh = ::GetTilePixelSlope(tile, &start_z);
 
	Slope start_tileh = ::GetTileSlope(tile, &start_z);
 
	DiagDirection direction = ::GetInclinedSlopeDirection(start_tileh);
 
	if (direction == INVALID_DIAGDIR) return INVALID_TILE;
 

	
 
@@ -40,7 +40,7 @@
 
		tile += delta;
 
		if (!::IsValidTile(tile)) return INVALID_TILE;
 

	
 
		::GetTilePixelSlope(tile, &end_z);
 
		::GetTileSlope(tile, &end_z);
 
	} while (start_z != end_z);
 

	
 
	return tile;
0 comments (0 inline, 0 general)