Changeset - r18256:4d7d2550ba08
[Not reviewed]
master
0 7 0
rubidium - 13 years ago 2011-11-04 10:31:46
rubidium@openttd.org
(svn r23102) -Codechange: remove the remaining pointless multiplications by TILE_HEIGHT
7 files changed with 8 insertions and 8 deletions:
0 comments (0 inline, 0 general)
src/clear_cmd.cpp
Show inline comments
 
@@ -222,25 +222,25 @@ static void TileLoopClearDesert(TileInde
 
		/* Transition from clear to desert is not smooth (after clearing desert tile) */
 
		SetClearGroundDensity(tile, CLEAR_DESERT, expected);
 
	}
 

	
 
	MarkTileDirtyByTile(tile);
 
}
 

	
 
static void TileLoop_Clear(TileIndex tile)
 
{
 
	/* If the tile is at any edge flood it to prevent maps without water. */
 
	if (_settings_game.construction.freeform_edges && DistanceFromEdge(tile) == 1) {
 
		uint z;
 
		Slope slope = GetTilePixelSlope(tile, &z);
 
		Slope slope = GetTileSlope(tile, &z);
 
		if (z == 0 && slope == SLOPE_FLAT) {
 
			DoFloodTile(tile);
 
			MarkTileDirtyByTile(tile);
 
			return;
 
		}
 
	}
 
	TileLoopClearHelper(tile);
 

	
 
	switch (_settings_game.game_creation.landscape) {
 
		case LT_TROPIC: TileLoopClearDesert(tile); break;
 
		case LT_ARCTIC: TileLoopClearAlps(tile);   break;
 
	}
src/dock_gui.cpp
Show inline comments
 
@@ -51,44 +51,44 @@ void CcBuildCanal(const CommandCost &res
 
}
 

	
 

	
 
/**
 
 * Gets the other end of the aqueduct, if possible.
 
 * @param tile_from     The begin tile for the aqueduct.
 
 * @param [out] tile_to The tile till where to show a selection for the aqueduct.
 
 * @return The other end of the aqueduct, or otherwise a tile in line with the aqueduct to cause the right error message.
 
 */
 
static TileIndex GetOtherAqueductEnd(TileIndex tile_from, TileIndex *tile_to = NULL)
 
{
 
	uint z;
 
	DiagDirection dir = GetInclinedSlopeDirection(GetTilePixelSlope(tile_from, &z));
 
	DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile_from, &z));
 

	
 
	/* If the direction isn't right, just return the next tile so the command
 
	 * complains about the wrong slope instead of the ends not matching up.
 
	 * Make sure the coordinate is always a valid tile within the map, so we
 
	 * don't go "off" the map. That would cause the wrong error message. */
 
	if (!IsValidDiagDirection(dir)) return TILE_ADDXY(tile_from, TileX(tile_from) > 2 ? -1 : 1, 0);
 

	
 
	/* Direction the aqueduct is built to. */
 
	TileIndexDiff offset = TileOffsByDiagDir(ReverseDiagDir(dir));
 
	/* The maximum length of the aqueduct. */
 
	int max_length = min(_settings_game.construction.max_bridge_length, DistanceFromEdgeDir(tile_from, ReverseDiagDir(dir)) - 1);
 

	
 
	TileIndex endtile = tile_from;
 
	for (int length = 0; IsValidTile(endtile) && TileX(endtile) != 0 && TileY(endtile) != 0; length++) {
 
		endtile = TILE_ADD(endtile, offset);
 

	
 
		if (length > max_length) break;
 

	
 
		if (GetTileMaxPixelZ(endtile) > z) {
 
		if (GetTileMaxZ(endtile) > z) {
 
			if (tile_to != NULL) *tile_to = endtile;
 
			break;
 
		}
 
	}
 

	
 
	return endtile;
 
}
 

	
 
/** Enum referring to the widgets of the build dock toolbar */
 
enum DockToolbarWidgets {
 
	DTW_BUTTONS_BEGIN,             ///< Begin of clickable buttons (except seperating panel)
 
	DTW_CANAL = DTW_BUTTONS_BEGIN, ///< Build canal button
src/elrail.cpp
Show inline comments
 
@@ -367,25 +367,25 @@ static void DrawCatenaryRailway(const Ti
 

	
 
		Foundation foundation = FOUNDATION_NONE;
 

	
 
		/* Station and road crossings are always "flat", so adjust the tileh accordingly */
 
		if (IsTileType(neighbour, MP_STATION) || IsTileType(neighbour, MP_ROAD)) tileh[TS_NEIGHBOUR] = SLOPE_FLAT;
 

	
 
		/* Read the foundataions if they are present, and adjust the tileh */
 
		if (trackconfig[TS_NEIGHBOUR] != TRACK_BIT_NONE && IsTileType(neighbour, MP_RAILWAY) && HasCatenary(GetRailType(neighbour))) foundation = GetRailFoundation(tileh[TS_NEIGHBOUR], trackconfig[TS_NEIGHBOUR]);
 
		if (IsBridgeTile(neighbour)) {
 
			foundation = GetBridgeFoundation(tileh[TS_NEIGHBOUR], DiagDirToAxis(GetTunnelBridgeDirection(neighbour)));
 
		}
 

	
 
		ApplyPixelFoundationToSlope(foundation, &tileh[TS_NEIGHBOUR]);
 
		ApplyFoundationToSlope(foundation, &tileh[TS_NEIGHBOUR]);
 

	
 
		/* Half tile slopes coincide only with horizontal/vertical track.
 
		 * Faking a flat slope results in the correct sprites on positions. */
 
		if (IsHalftileSlope(tileh[TS_NEIGHBOUR])) tileh[TS_NEIGHBOUR] = SLOPE_FLAT;
 

	
 
		AdjustTileh(neighbour, &tileh[TS_NEIGHBOUR]);
 

	
 
		/* If we have a straight (and level) track, we want a pylon only every 2 tiles
 
		 * Delete the PCP if this is the case.
 
		 * Level means that the slope is the same, or the track is flat */
 
		if (tileh[TS_HOME] == tileh[TS_NEIGHBOUR] || (isflat[TS_HOME] && isflat[TS_NEIGHBOUR])) {
 
			for (uint k = 0; k < NUM_IGNORE_GROUPS; k++) {
src/industry_cmd.cpp
Show inline comments
 
@@ -1253,25 +1253,25 @@ static CommandCost CheckNewIndustry_Lumb
 
		return_cmd_error(STR_ERROR_CAN_ONLY_BE_BUILT_IN_RAINFOREST);
 
	}
 
	return CommandCost();
 
}
 

	
 
/**
 
 * Check the conditions of #CHECK_BUBBLEGEN (Industry should be in low land).
 
 * @param tile %Tile to perform the checking.
 
 * @return Succeeded or failed command.
 
 */
 
static CommandCost CheckNewIndustry_BubbleGen(TileIndex tile)
 
{
 
	if (GetTilePixelZ(tile) > TILE_HEIGHT * 4) {
 
	if (GetTileZ(tile) > 4) {
 
		return_cmd_error(STR_ERROR_CAN_ONLY_BE_BUILT_IN_LOW_AREAS);
 
	}
 
	return CommandCost();
 
}
 

	
 
/**
 
 * Industrytype check function signature.
 
 * @param tile %Tile to check.
 
 * @return Succeeded or failed command.
 
 */
 
typedef CommandCost CheckNewIndustryProc(TileIndex tile);
 

	
src/misc_gui.cpp
Show inline comments
 
@@ -212,25 +212,25 @@ public:
 
				}
 
				SetDParam(0, cost);
 
			}
 
		}
 
		GetString(this->landinfo_data[line_nr], str, lastof(this->landinfo_data[line_nr]));
 
		line_nr++;
 

	
 
		/* Location */
 
		char tmp[16];
 
		snprintf(tmp, lengthof(tmp), "0x%.4X", tile);
 
		SetDParam(0, TileX(tile));
 
		SetDParam(1, TileY(tile));
 
		SetDParam(2, GetTilePixelZ(tile) / TILE_HEIGHT);
 
		SetDParam(2, GetTileZ(tile));
 
		SetDParamStr(3, tmp);
 
		GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_LANDINFO_COORDS, lastof(this->landinfo_data[line_nr]));
 
		line_nr++;
 

	
 
		/* Local authority */
 
		SetDParam(0, STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY_NONE);
 
		if (t != NULL) {
 
			SetDParam(0, STR_TOWN_NAME);
 
			SetDParam(1, t->index);
 
		}
 
		GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_LOCAL_AUTHORITY, lastof(this->landinfo_data[line_nr]));
 
		line_nr++;
src/newgrf_canal.cpp
Show inline comments
 
@@ -39,25 +39,25 @@ static void CanalSetTriggers(const Resol
 
{
 
	return;
 
}
 

	
 

	
 
static uint32 CanalGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available)
 
{
 
	TileIndex tile = object->u.canal.tile;
 

	
 
	switch (variable) {
 
		/* Height of tile */
 
		case 0x80: {
 
			uint z = GetTilePixelZ(tile) / TILE_HEIGHT;
 
			uint z = GetTileZ(tile);
 
			/* Return consistent height within locks */
 
			if (IsTileType(tile, MP_WATER) && IsLock(tile) && GetLockPart(tile) == LOCK_PART_UPPER) z--;
 
			return z;
 
		}
 

	
 
		/* Terrain type */
 
		case 0x81: return GetTerrainType(tile);
 

	
 
		/* Random data for river or canal tiles, otherwise zero */
 
		case 0x83: return IsTileType(tile, MP_WATER) ? GetWaterTileRandomBits(tile) : 0;
 
	}
 

	
src/rail_cmd.cpp
Show inline comments
 
@@ -667,25 +667,25 @@ bool FloodHalftile(TileIndex t)
 
				MarkTileDirtyByTile(t);
 
				return flooded;
 
			}
 
		}
 

	
 
		if (IsNonContinuousFoundation(GetRailFoundation(tileh, rail_bits))) {
 
			flooded = true;
 
			SetRailGroundType(t, RAIL_GROUND_WATER);
 
			MarkTileDirtyByTile(t);
 
		}
 
	} else {
 
		/* Make shore on steep slopes and 'three-corners-raised'-slopes. */
 
		if (ApplyPixelFoundationToSlope(GetRailFoundation(tileh, rail_bits), &tileh) == 0) {
 
		if (ApplyFoundationToSlope(GetRailFoundation(tileh, rail_bits), &tileh) == 0) {
 
			if (IsSteepSlope(tileh) || IsSlopeWithThreeCornersRaised(tileh)) {
 
				flooded = true;
 
				SetRailGroundType(t, RAIL_GROUND_WATER);
 
				MarkTileDirtyByTile(t);
 
			}
 
		}
 
	}
 
	return flooded;
 
}
 

	
 
static const TileIndexDiffC _trackdelta[] = {
 
	{ -1,  0 }, {  0,  1 }, { -1,  0 }, {  0,  1 }, {  1,  0 }, {  0,  1 },
0 comments (0 inline, 0 general)