diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -370,7 +370,7 @@ static CommandCost RemoveRoad(TileIndex /* If it's the last roadtype, just clear the whole tile */ if (GetRoadType(tile, OtherRoadTramType(rtt)) == INVALID_ROADTYPE) return Command::Do(flags, tile); - CommandCost cost(EXPENSES_CONSTRUCTION); + CommandCost cost(EXPENSES_T_ROAD_CON); if (IsTileType(tile, MP_TUNNELBRIDGE)) { /* Removing any roadbit in the bridge axis removes the roadtype (that's the behaviour remove-long-roads needs) */ if ((AxisToRoadBits(DiagDirToAxis(GetTunnelBridgeDirection(tile))) & pieces) == ROAD_NONE) return_cmd_error((rtt == RTT_TRAM) ? STR_ERROR_THERE_IS_NO_TRAMWAY : STR_ERROR_THERE_IS_NO_ROAD); @@ -489,7 +489,7 @@ static CommandCost RemoveRoad(TileIndex } } - CommandCost cost(EXPENSES_CONSTRUCTION, CountBits(pieces) * RoadClearCost(existing_rt)); + CommandCost cost(EXPENSES_T_ROAD_CON, CountBits(pieces) * RoadClearCost(existing_rt)); /* If we build a foundation we have to pay for it. */ if (f == FOUNDATION_NONE && GetRoadFoundation(tileh, present) != FOUNDATION_NONE) cost.AddCost(_price[PR_BUILD_FOUNDATION]); @@ -525,7 +525,7 @@ static CommandCost RemoveRoad(TileIndex MarkTileDirtyByTile(tile); YapfNotifyTrackLayoutChange(tile, railtrack); } - return CommandCost(EXPENSES_CONSTRUCTION, RoadClearCost(existing_rt) * 2); + return CommandCost(EXPENSES_T_ROAD_CON, RoadClearCost(existing_rt) * 2); } default: @@ -569,7 +569,7 @@ static CommandCost CheckRoadSlope(Slope if (_settings_game.construction.build_on_slopes && (_invalid_tileh_slopes_road[0][tileh] & (other | type_bits)) == ROAD_NONE) { /* If we add leveling we've got to pay for it */ - if ((other | existing) == ROAD_NONE) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]); + if ((other | existing) == ROAD_NONE) return CommandCost(EXPENSES_T_ROAD_CON, _price[PR_BUILD_FOUNDATION]); return CommandCost(); } @@ -589,12 +589,12 @@ static CommandCost CheckRoadSlope(Slope if (_settings_game.construction.build_on_slopes) { /* If we add foundation we've got to pay for it */ - if ((other | existing) == ROAD_NONE) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]); + if ((other | existing) == ROAD_NONE) return CommandCost(EXPENSES_T_ROAD_CON, _price[PR_BUILD_FOUNDATION]); return CommandCost(); } } else { - if (HasExactlyOneBit(existing) && GetRoadFoundation(tileh, existing) == FOUNDATION_NONE) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]); + if (HasExactlyOneBit(existing) && GetRoadFoundation(tileh, existing) == FOUNDATION_NONE) return CommandCost(EXPENSES_T_ROAD_CON, _price[PR_BUILD_FOUNDATION]); return CommandCost(); } } @@ -614,7 +614,7 @@ static CommandCost CheckRoadSlope(Slope CommandCost CmdBuildRoad(DoCommandFlag flags, TileIndex tile, RoadBits pieces, RoadType rt, DisallowedRoadDirections toggle_drd, TownID town_id) { CompanyID company = _current_company; - CommandCost cost(EXPENSES_CONSTRUCTION); + CommandCost cost(EXPENSES_T_ROAD_CON); RoadBits existing = ROAD_NONE; RoadBits other_bits = ROAD_NONE; @@ -782,7 +782,7 @@ CommandCost CmdBuildRoad(DoCommandFlag f UpdateLevelCrossing(tile, false); MarkTileDirtyByTile(tile); } - return CommandCost(EXPENSES_CONSTRUCTION, 2 * RoadBuildCost(rt)); + return CommandCost(EXPENSES_T_ROAD_CON, 2 * RoadBuildCost(rt)); } case MP_STATION: { @@ -999,7 +999,7 @@ CommandCost CmdBuildLongRoad(DoCommandFl * when you just 'click' on one tile to build them. */ if ((drd == DRD_NORTHBOUND || drd == DRD_SOUTHBOUND) && (axis == AXIS_Y) == (start_tile == end_tile && start_half == end_half)) drd ^= DRD_BOTH; - CommandCost cost(EXPENSES_CONSTRUCTION); + CommandCost cost(EXPENSES_T_ROAD_CON); CommandCost last_error = CMD_ERROR; TileIndex tile = start_tile; bool had_bridge = false; @@ -1072,7 +1072,7 @@ CommandCost CmdBuildLongRoad(DoCommandFl */ std::tuple CmdRemoveLongRoad(DoCommandFlag flags, TileIndex start_tile, TileIndex end_tile, RoadType rt, Axis axis, bool start_half, bool end_half) { - CommandCost cost(EXPENSES_CONSTRUCTION); + CommandCost cost(EXPENSES_T_ROAD_CON); if (end_tile >= MapSize()) return { CMD_ERROR, 0 }; if (!ValParamRoadType(rt) || !IsValidAxis(axis)) return { CMD_ERROR, 0 }; @@ -1204,7 +1204,7 @@ static CommandCost RemoveRoadDepot(TileI DoClearSquare(tile); } - return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_DEPOT_ROAD]); + return CommandCost(EXPENSES_T_ROAD_CON, _price[PR_CLEAR_DEPOT_ROAD]); } static CommandCost ClearTile_Road(TileIndex tile, DoCommandFlag flags) @@ -1215,7 +1215,7 @@ static CommandCost ClearTile_Road(TileIn /* Clear the road if only one piece is on the tile OR we are not using the DC_AUTO flag */ if ((HasExactlyOneBit(b) && GetRoadBits(tile, RTT_TRAM) == ROAD_NONE) || !(flags & DC_AUTO)) { - CommandCost ret(EXPENSES_CONSTRUCTION); + CommandCost ret(EXPENSES_T_DEMOLITION); for (RoadTramType rtt : _roadtramtypes) { if (!MayHaveRoad(tile) || GetRoadType(tile, rtt) == INVALID_ROADTYPE) continue; @@ -1229,7 +1229,7 @@ static CommandCost ClearTile_Road(TileIn } case ROAD_TILE_CROSSING: { - CommandCost ret(EXPENSES_CONSTRUCTION); + CommandCost ret(EXPENSES_T_DEMOLITION); if (flags & DC_AUTO) return_cmd_error(STR_ERROR_MUST_REMOVE_ROAD_FIRST); @@ -1650,7 +1650,6 @@ static void DrawTile_Road(TileInfo *ti) if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED); Axis axis = GetCrossingRailAxis(ti->tile); - const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile)); RoadType road_rt = GetRoadTypeRoad(ti->tile); @@ -2226,11 +2225,11 @@ static CommandCost TerraformTile_Road(Ti 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) && (GetTileMaxZ(tile) == z_new + GetSlopeMaxZ(tileh_new)) && HasBit(VALID_LEVEL_CROSSING_SLOPES, tileh_new)) return CommandCost(EXPENSES_T_ROAD_CON, _price[PR_BUILD_FOUNDATION]); break; case ROAD_TILE_DEPOT: - if (AutoslopeCheckForEntranceEdge(tile, z_new, tileh_new, GetRoadDepotDirection(tile))) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]); + if (AutoslopeCheckForEntranceEdge(tile, z_new, tileh_new, GetRoadDepotDirection(tile))) return CommandCost(EXPENSES_T_ROAD_CON, _price[PR_BUILD_FOUNDATION]); break; case ROAD_TILE_NORMAL: { @@ -2248,7 +2247,7 @@ static CommandCost TerraformTile_Road(Ti z_new += ApplyFoundationToSlope(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]); + if ((z_old == z_new) && (tileh_old == tileh_new)) return CommandCost(EXPENSES_T_ROAD_CON, _price[PR_BUILD_FOUNDATION]); } } break;