Changeset - r12940:ba419d226b67
[Not reviewed]
master
0 2 0
rubidium - 15 years ago 2009-09-07 08:35:45
rubidium@openttd.org
(svn r17443) -Fix (r17442): clear the depot tile after removing the depot in all cases instead of only for ships; makes removing road/rail depots not crash :)
2 files changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/rail_cmd.cpp
Show inline comments
 
@@ -1433,26 +1433,26 @@ static CommandCost RemoveTrainDepot(Tile
 

	
 
	if (flags & DC_EXEC) {
 
		/* read variables before the depot is removed */
 
		DiagDirection dir = GetRailDepotDirection(tile);
 
		Owner owner = GetTileOwner(tile);
 
		Train *v = NULL;
 

	
 
		if (HasDepotReservation(tile)) {
 
			v = GetTrainForReservation(tile, DiagDirToDiagTrack(dir));
 
			if (v != NULL) FreeTrainTrackReservation(v);
 
		}
 

	
 
		delete Depot::GetByTile(tile);
 
		DoClearSquare(tile);
 
		delete Depot::GetByTile(tile);
 
		AddSideToSignalBuffer(tile, dir, owner);
 
		YapfNotifyTrackLayoutChange(tile, DiagDirToDiagTrack(dir));
 
		if (v != NULL) TryPathReserve(v, true);
 
	}
 

	
 
	return CommandCost(EXPENSES_CONSTRUCTION, _price.remove_train_depot);
 
}
 

	
 
static CommandCost ClearTile_Track(TileIndex tile, DoCommandFlag flags)
 
{
 
	CommandCost cost(EXPENSES_CONSTRUCTION);
 
	CommandCost ret;
src/road_cmd.cpp
Show inline comments
 
@@ -886,26 +886,26 @@ CommandCost CmdBuildRoadDepot(TileIndex 
 
		MarkTileDirtyByTile(tile);
 
	}
 
	return cost.AddCost(_price.build_road_depot);
 
}
 

	
 
static CommandCost RemoveRoadDepot(TileIndex tile, DoCommandFlag flags)
 
{
 
	if (!CheckTileOwnership(tile) && _current_company != OWNER_WATER) return CMD_ERROR;
 

	
 
	if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
 

	
 
	if (flags & DC_EXEC) {
 
		delete Depot::GetByTile(tile);
 
		DoClearSquare(tile);
 
		delete Depot::GetByTile(tile);
 
	}
 

	
 
	return CommandCost(EXPENSES_CONSTRUCTION, _price.remove_road_depot);
 
}
 

	
 
static CommandCost ClearTile_Road(TileIndex tile, DoCommandFlag flags)
 
{
 
	switch (GetRoadTileType(tile)) {
 
		case ROAD_TILE_NORMAL: {
 
			RoadBits b = GetAllRoadBits(tile);
 

	
 
			/* Clear the road if only one piece is on the tile OR we are not using the DC_AUTO flag */
0 comments (0 inline, 0 general)