File diff r7535:b69be69d3c06 → r7536:851d38e350c3
src/road_cmd.cpp
Show inline comments
 
@@ -189,28 +189,30 @@ CommandCost CmdRemoveRoad(TileIndex tile
 

	
 
			/* limit the bits to delete to the existing bits. */
 
			c &= present;
 
			if (c == ROAD_NONE) return CMD_ERROR;
 

	
 
			if (flags & DC_EXEC) {
 
				ChangeTownRating(t, -road_remove_cost[(byte)edge_road], RATING_ROAD_MINIMUM);
 

	
 
				present ^= c;
 
				if (present == ROAD_NONE) {
 
					RoadTypes rts = GetRoadTypes(tile) & ComplementRoadTypes(RoadTypeToRoadTypes(rt));
 
					if (rts == ROADTYPES_NONE) {
 
						/* Includes MarkTileDirtyByTile() */
 
						DoClearSquare(tile);
 
					} else {
 
						SetRoadBits(tile, ROAD_NONE, rt);
 
						SetRoadTypes(tile, rts);
 
						MarkTileDirtyByTile(tile);
 
					}
 
				} else {
 
					/* When bits are removed, you *always* end up with something that
 
					 * is not a complete straight road tile. However, trams do not have
 
					 * onewayness, so they cannot remove it either. */
 
					if (rt != ROADTYPE_TRAM) SetDisallowedRoadDirections(tile, DRD_NONE);
 
					SetRoadBits(tile, present, rt);
 
					MarkTileDirtyByTile(tile);
 
				}
 
			}
 
			return CommandCost(COUNTBITS(c) * _price.remove_road);
 
		}