From 7757a2ed406996be35c7179185f2e4e7cba37e12 Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 4 Nov 2011 10:18:13 +0000 Subject: (svn r23091) -Codechange: rename some Get*Z functions to Get*PixelZ functions if they return the Z in pixels (like TilePixelHeight) --- src/road_cmd.cpp | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'src/road_cmd.cpp') diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index e2df5d950..3cc2bb874 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -254,7 +254,7 @@ static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits piec switch (GetRoadTileType(tile)) { case ROAD_TILE_NORMAL: { - Slope tileh = GetTileSlope(tile, NULL); + Slope tileh = GetTilePixelSlope(tile, NULL); /* Steep slopes behave the same as slopes with one corner raised. */ if (IsSteepSlope(tileh)) { @@ -467,7 +467,7 @@ CommandCost CmdBuildRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 DisallowedRoadDirections toggle_drd = Extract(p1); - Slope tileh = GetTileSlope(tile, NULL); + Slope tileh = GetTilePixelSlope(tile, NULL); bool need_to_clear = false; switch (GetTileType(tile)) { @@ -636,7 +636,7 @@ do_clear:; /* Check if new road bits will have the same foundation as other existing road types */ if (IsNormalRoad(tile)) { - Slope slope = GetTileSlope(tile, NULL); + Slope slope = GetTilePixelSlope(tile, NULL); Foundation found_new = GetRoadFoundation(slope, pieces | existing); /* Test if all other roadtypes can be built at that foundation */ @@ -909,7 +909,7 @@ CommandCost CmdBuildRoadDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, ui if (!IsValidRoadType(rt) || !ValParamRoadType(rt)) return CMD_ERROR; - Slope tileh = GetTileSlope(tile, NULL); + Slope tileh = GetTilePixelSlope(tile, NULL); if (tileh != SLOPE_FLAT && ( !_settings_game.construction.build_on_slopes || !CanBuildDepotByTileh(dir, tileh) @@ -1080,9 +1080,9 @@ void DrawTramCatenary(const TileInfo *ti, RoadBits tram) /* Don't draw the catenary under a low bridge */ if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && !IsTransparencySet(TO_CATENARY)) { - uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile)); + uint height = GetBridgePixelHeight(GetNorthernBridgeEnd(ti->tile)); - if (height <= GetTileMaxZ(ti->tile) + TILE_HEIGHT) return; + if (height <= GetTileMaxPixelZ(ti->tile) + TILE_HEIGHT) return; } SpriteID front; @@ -1113,7 +1113,7 @@ static void DrawRoadDetail(SpriteID img, const TileInfo *ti, int dx, int dy, int int x = ti->x | dx; int y = ti->y | dy; byte z = ti->z; - if (ti->tileh != SLOPE_FLAT) z = GetSlopeZ(x, y); + if (ti->tileh != SLOPE_FLAT) z = GetSlopePixelZ(x, y); AddSortableSpriteToDraw(img, PAL_NONE, x, y, 2, 2, h, z); } @@ -1170,7 +1170,7 @@ static void DrawRoadBits(TileInfo *ti) if (road != ROAD_NONE) { DisallowedRoadDirections drd = GetDisallowedRoadDirections(ti->tile); if (drd != DRD_NONE) { - DrawGroundSpriteAt(SPR_ONEWAY_BASE + drd - 1 + ((road == ROAD_X) ? 0 : 3), PAL_NONE, 8, 8, GetPartialZ(8, 8, ti->tileh)); + DrawGroundSpriteAt(SPR_ONEWAY_BASE + drd - 1 + ((road == ROAD_X) ? 0 : 3), PAL_NONE, 8, 8, GetPartialPixelZ(8, 8, ti->tileh)); } } @@ -1187,8 +1187,8 @@ static void DrawRoadBits(TileInfo *ti) /* Do not draw details (street lights, trees) under low bridge */ if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && (roadside == ROADSIDE_TREES || roadside == ROADSIDE_STREET_LIGHTS)) { - uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile)); - uint minz = GetTileMaxZ(ti->tile) + 2 * TILE_HEIGHT; + uint height = GetBridgePixelHeight(GetNorthernBridgeEnd(ti->tile)); + uint minz = GetTileMaxPixelZ(ti->tile) + 2 * TILE_HEIGHT; if (roadside == ROADSIDE_TREES) minz += TILE_HEIGHT; @@ -1337,19 +1337,19 @@ void UpdateNearestTownForRoadTiles(bool invalidate) } } -static uint GetSlopeZ_Road(TileIndex tile, uint x, uint y) +static uint GetSlopePixelZ_Road(TileIndex tile, uint x, uint y) { if (IsNormalRoad(tile)) { uint z; - Slope tileh = GetTileSlope(tile, &z); + Slope tileh = GetTilePixelSlope(tile, &z); if (tileh == SLOPE_FLAT) return z; Foundation f = GetRoadFoundation(tileh, GetAllRoadBits(tile)); - z += ApplyFoundationToSlope(f, &tileh); - return z + GetPartialZ(x & 0xF, y & 0xF, tileh); + z += ApplyPixelFoundationToSlope(f, &tileh); + return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh); } else { - return GetTileMaxZ(tile); + return GetTileMaxPixelZ(tile); } } @@ -1383,7 +1383,7 @@ static void TileLoop_Road(TileIndex tile) { switch (_settings_game.game_creation.landscape) { case LT_ARCTIC: - if (IsOnSnow(tile) != (GetTileZ(tile) > GetSnowLine())) { + if (IsOnSnow(tile) != (GetTilePixelZ(tile) > GetSnowLine())) { ToggleSnow(tile); MarkTileDirtyByTile(tile); } @@ -1410,7 +1410,7 @@ static void TileLoop_Road(TileIndex tile) if (t->road_build_months != 0 && (DistanceManhattan(t->xy, tile) < 8 || grp != HZB_TOWN_EDGE) && IsNormalRoad(tile) && !HasAtMostOneBit(GetAllRoadBits(tile))) { - if (GetFoundationSlope(tile, NULL) == SLOPE_FLAT && EnsureNoVehicleOnGround(tile).Succeeded() && Chance16(1, 40)) { + if (GetFoundationPixelSlope(tile, NULL) == SLOPE_FLAT && EnsureNoVehicleOnGround(tile).Succeeded() && Chance16(1, 40)) { StartRoadWorks(tile); SndPlayTileFx(SND_21_JACKHAMMER, tile); @@ -1682,7 +1682,7 @@ static CommandCost TerraformTile_Road(TileIndex tile, DoCommandFlag flags, uint if (_settings_game.construction.build_on_slopes && AutoslopeEnabled()) { switch (GetRoadTileType(tile)) { case ROAD_TILE_CROSSING: - if (!IsSteepSlope(tileh_new) && (GetTileMaxZ(tile) == z_new + GetSlopeMaxZ(tileh_new)) && HasBit(VALID_LEVEL_CROSSING_SLOPES, tileh_new)) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]); + if (!IsSteepSlope(tileh_new) && (GetTileMaxPixelZ(tile) == z_new + GetSlopeMaxPixelZ(tileh_new)) && HasBit(VALID_LEVEL_CROSSING_SLOPES, tileh_new)) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]); break; case ROAD_TILE_DEPOT: @@ -1697,11 +1697,11 @@ static CommandCost TerraformTile_Road(TileIndex tile, DoCommandFlag flags, uint /* CheckRoadSlope() sometimes changes the road_bits, if it does not agree with them. */ if (bits == bits_copy) { uint z_old; - Slope tileh_old = GetTileSlope(tile, &z_old); + Slope tileh_old = GetTilePixelSlope(tile, &z_old); /* Get the slope on top of the foundation */ - z_old += ApplyFoundationToSlope(GetRoadFoundation(tileh_old, bits), &tileh_old); - z_new += ApplyFoundationToSlope(GetRoadFoundation(tileh_new, bits), &tileh_new); + z_old += ApplyPixelFoundationToSlope(GetRoadFoundation(tileh_old, bits), &tileh_old); + z_new += ApplyPixelFoundationToSlope(GetRoadFoundation(tileh_new, bits), &tileh_new); /* The surface slope must not be changed */ if ((z_old == z_new) && (tileh_old == tileh_new)) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]); @@ -1720,7 +1720,7 @@ static CommandCost TerraformTile_Road(TileIndex tile, DoCommandFlag flags, uint /** Tile callback functions for road tiles */ extern const TileTypeProcs _tile_type_road_procs = { DrawTile_Road, // draw_tile_proc - GetSlopeZ_Road, // get_slope_z_proc + GetSlopePixelZ_Road, // get_slope_z_proc ClearTile_Road, // clear_tile_proc NULL, // add_accepted_cargo_proc GetTileDesc_Road, // get_tile_desc_proc -- cgit v1.2.3-54-g00ecf