Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change: Allow overbuilding station and waypoint tiles #10618

Merged
merged 1 commit into from
Apr 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/station_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,6 @@ static void RestoreTrainReservation(Train *v)
static CommandCost CalculateRailStationCost(TileArea tile_area, DoCommandFlag flags, Axis axis, StationID *station, RailType rt, std::vector<Train *> &affected_vehicles, StationClassID spec_class, byte spec_index, byte plat_len, byte numtracks)
{
CommandCost cost(EXPENSES_CONSTRUCTION);
bool success = false;
bool length_price_ready = true;
byte tracknum = 0;
for (TileIndex cur_tile : tile_area) {
Expand All @@ -1288,12 +1287,9 @@ static CommandCost CalculateRailStationCost(TileArea tile_area, DoCommandFlag fl
cost.AddCost(_price[PR_BUILD_STATION_RAIL_LENGTH]);
length_price_ready = false;
}
success = true;
}
}

if (!success) return_cmd_error(STR_ERROR_ALREADY_BUILT);

return cost;
}

Expand Down Expand Up @@ -1877,7 +1873,6 @@ static CommandCost FindJoiningRoadStop(StationID existing_stop, StationID statio
static CommandCost CalculateRoadStopCost(TileArea tile_area, DoCommandFlag flags, bool is_drive_through, bool is_truck_stop, Axis axis, DiagDirection ddir, StationID *est, RoadType rt, Money unit_cost)
{
CommandCost cost(EXPENSES_CONSTRUCTION);
bool success = false;
/* Check every tile in the area. */
for (TileIndex cur_tile : tile_area) {
uint invalid_dirs = 0;
Expand All @@ -1896,16 +1891,9 @@ static CommandCost CalculateRoadStopCost(TileArea tile_area, DoCommandFlag flags
if (!is_preexisting_roadstop) {
cost.AddCost(ret);
cost.AddCost(unit_cost);
success = true;
} else if (is_preexisting_roadstop && !is_drive_through) {
/* Allow rotating non-drive through stops for free */
success = true;
}

}

if (!success) return_cmd_error(STR_ERROR_ALREADY_BUILT);

return cost;
}

Expand Down
9 changes: 1 addition & 8 deletions src/waypoint_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,8 @@ CommandCost CmdBuildRailWaypoint(DoCommandFlag flags, TileIndex start_tile, Axis

/* only AddCost for non-existing waypoints */
CommandCost cost(EXPENSES_CONSTRUCTION);
bool success = false;
for (TileIndex cur_tile : new_location) {
if (!IsRailWaypointTile(cur_tile)) {
cost.AddCost(_price[PR_BUILD_WAYPOINT_RAIL]);
success = true;
}
}
if (!success) {
return_cmd_error(STR_ERROR_ALREADY_BUILT);
if (!IsRailWaypointTile(cur_tile)) cost.AddCost(_price[PR_BUILD_WAYPOINT_RAIL]);
}

/* Make sure the area below consists of clear tiles. (OR tiles belonging to a certain rail station) */
Expand Down