Changeset - r27096:2a3951b7545f
[Not reviewed]
master
0 2 0
Tyler Trahan - 20 months ago 2023-04-16 07:05:04
tyler@tylertrahan.com
Change: Allow overbuilding station and waypoint tiles (#10618)
2 files changed with 1 insertions and 20 deletions:
0 comments (0 inline, 0 general)
src/station_cmd.cpp
Show inline comments
 
@@ -1263,7 +1263,6 @@ static void RestoreTrainReservation(Trai
 
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) {
 
@@ -1290,12 +1289,9 @@ static CommandCost CalculateRailStationC
 
				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;
 
}
 

	
 
@@ -1879,7 +1875,6 @@ static CommandCost FindJoiningRoadStop(S
 
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;
 
@@ -1898,16 +1893,9 @@ static CommandCost CalculateRoadStopCost
 
		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;
 
}
 

	
src/waypoint_cmd.cpp
Show inline comments
 
@@ -195,15 +195,8 @@ CommandCost CmdBuildRailWaypoint(DoComma
 

	
 
	/* 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) */
0 comments (0 inline, 0 general)