Changeset - r18253:c1951a6eb525
[Not reviewed]
master
0 2 0
rubidium - 13 years ago 2011-11-04 10:29:26
rubidium@openttd.org
(svn r23099) -Codechange: remove pointless multiplications by TILE_HEIGHT for the water/river code
2 files changed with 9 insertions and 9 deletions:
0 comments (0 inline, 0 general)
src/landscape.cpp
Show inline comments
 
@@ -927,7 +927,7 @@ static void CreateDesertOrRainForest()
 
static bool FindSpring(TileIndex tile, void *user_data)
 
{
 
	uint referenceHeight;
 
	Slope s = GetTilePixelSlope(tile, &referenceHeight);
 
	Slope s = GetTileSlope(tile, &referenceHeight);
 
	if (s != SLOPE_FLAT || IsWaterTile(tile)) return false;
 

	
 
	/* In the tropics rivers start in the rainforest. */
 
@@ -938,7 +938,7 @@ static bool FindSpring(TileIndex tile, v
 
	for (int dx = -1; dx <= 1; dx++) {
 
		for (int dy = -1; dy <= 1; dy++) {
 
			TileIndex t = TileAddWrap(tile, dx, dy);
 
			if (t != INVALID_TILE && GetTileMaxPixelZ(t) > referenceHeight) num++;
 
			if (t != INVALID_TILE && GetTileMaxZ(t) > referenceHeight) num++;
 
		}
 
	}
 

	
 
@@ -948,7 +948,7 @@ static bool FindSpring(TileIndex tile, v
 
	for (int dx = -16; dx <= 16; dx++) {
 
		for (int dy = -16; dy <= 16; dy++) {
 
			TileIndex t = TileAddWrap(tile, dx, dy);
 
			if (t != INVALID_TILE && GetTileMaxPixelZ(t) > referenceHeight + 2 * TILE_HEIGHT) return false;
 
			if (t != INVALID_TILE && GetTileMaxZ(t) > referenceHeight + 2) return false;
 
		}
 
	}
 

	
 
@@ -990,8 +990,8 @@ static bool FlowsDown(TileIndex begin, T
 

	
 
	uint heightBegin;
 
	uint heightEnd;
 
	Slope slopeBegin = GetTilePixelSlope(begin, &heightBegin);
 
	Slope slopeEnd   = GetTilePixelSlope(end, &heightEnd);
 
	Slope slopeBegin = GetTileSlope(begin, &heightBegin);
 
	Slope slopeEnd   = GetTileSlope(end, &heightEnd);
 

	
 
	return heightEnd <= heightBegin &&
 
			/* Slope either is inclined or flat; rivers don't support other slopes. */
src/water_cmd.cpp
Show inline comments
 
@@ -150,7 +150,7 @@ void MakeWaterKeepingClass(TileIndex til
 

	
 
	/* Autoslope might turn an originally canal or river tile into land */
 
	uint z;
 
	if (GetTilePixelSlope(tile, &z) != SLOPE_FLAT) wc = WATER_CLASS_INVALID;
 
	if (GetTileSlope(tile, &z) != SLOPE_FLAT) wc = WATER_CLASS_INVALID;
 

	
 
	if (wc == WATER_CLASS_SEA && z > 0) wc = WATER_CLASS_CANAL;
 

	
 
@@ -860,7 +860,7 @@ static Vehicle *FloodVehicleProc(Vehicle
 
		default: break;
 

	
 
		case VEH_AIRCRAFT: {
 
			if (!IsAirportTile(v->tile) || GetTileMaxPixelZ(v->tile) != 0) break;
 
			if (!IsAirportTile(v->tile) || GetTileMaxZ(v->tile) != 0) break;
 
			if (v->subtype == AIR_SHADOW) break;
 

	
 
			/* We compare v->z_pos against delta_z + 1 because the shadow
 
@@ -1080,7 +1080,7 @@ void TileLoop_Water(TileIndex tile)
 
				if (IsTileType(dest, MP_WATER)) continue;
 

	
 
				uint z_dest;
 
				Slope slope_dest = GetFoundationPixelSlope(dest, &z_dest) & ~SLOPE_HALFTILE_MASK & ~SLOPE_STEEP;
 
				Slope slope_dest = GetFoundationSlope(dest, &z_dest) & ~SLOPE_HALFTILE_MASK & ~SLOPE_STEEP;
 
				if (z_dest > 0) continue;
 

	
 
				if (!HasBit(_flood_from_dirs[slope_dest], ReverseDir(dir))) continue;
 
@@ -1112,7 +1112,7 @@ void ConvertGroundTilesIntoWaterTiles()
 
	uint z;
 

	
 
	for (TileIndex tile = 0; tile < MapSize(); ++tile) {
 
		Slope slope = GetTilePixelSlope(tile, &z);
 
		Slope slope = GetTileSlope(tile, &z);
 
		if (IsTileType(tile, MP_CLEAR) && z == 0) {
 
			/* Make both water for tiles at level 0
 
			 * and make shore, as that looks much better
0 comments (0 inline, 0 general)