Index: trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java	(revision 425)
+++ trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java	(revision 426)
@@ -76,5 +76,5 @@
 		Collection<OsmPrimitive> selection = Main.ds.getSelected();
 		LinkedList<Way> selectedWays = new LinkedList<Way>();
-		
+
 		for (OsmPrimitive osm : selection)
 			if (osm instanceof Way)
@@ -85,13 +85,13 @@
 			return;
 		}
-		
-		// Check whether all ways have identical relationship membership. More 
+
+		// Check whether all ways have identical relationship membership. More
 		// specifically: If one of the selected ways is a member of relation X
 		// in role Y, then all selected ways must be members of X in role Y.
-		
-		// FIXME: In a later revision, we should display some sort of conflict 
+
+		// FIXME: In a later revision, we should display some sort of conflict
 		// dialog like we do for tags, to let the user choose which relations
 		// should be kept.
-		
+
 		// Step 1, iterate over all relations and figure out which of our
 		// selected ways are members of a relation.
@@ -122,11 +122,18 @@
 			}
 		}
-		
-		// Step 2, all values of the backlinks HashMap must now equal the size
-		// of the selection.
+
+		// Complain to the user if the ways don't have equal memberships.
 		for (HashSet<Way> waylinks : backlinks.values()) {
-			if (!selectedWays.equals(waylinks)) {
-				JOptionPane.showMessageDialog(Main.parent, tr("The selected ways cannot be combined as they have differing relation memberships."));
-				return;
+			if (!waylinks.containsAll(selectedWays)) {
+				int option = JOptionPane.showConfirmDialog(Main.parent,
+					tr("The selected ways have differing relation memberships.  "
+						+ "Do you still want to combine them?"),
+					tr("Combine ways with different memberships?"),
+					JOptionPane.YES_NO_OPTION);
+				if (option == JOptionPane.YES_OPTION) {
+					break;
+				} else {
+					return;
+				}
 			}
 		}
@@ -166,5 +173,5 @@
 		newWay.nodes.clear();
 		newWay.nodes.addAll(nodeList);
-		
+
 		// display conflict dialog
 		Map<String, JComboBox> components = new HashMap<String, JComboBox>();
@@ -181,5 +188,5 @@
 				newWay.put(e.getKey(), e.getValue().iterator().next());
 		}
-		
+
 		if (!components.isEmpty()) {
 			int answer = JOptionPane.showConfirmDialog(Main.parent, p, tr("Enter values for all conflicts."), JOptionPane.OK_CANCEL_OPTION);
@@ -193,15 +200,21 @@
 		cmds.add(new DeleteCommand(selectedWays.subList(1, selectedWays.size())));
 		cmds.add(new ChangeCommand(selectedWays.peek(), newWay));
-		
+
 		// modify all relations containing the now-deleted ways
 		for (Relation r : relationsUsingWays) {
 			Relation newRel = new Relation(r);
 			newRel.members.clear();
+			HashSet<String> rolesToReAdd = new HashSet<String>();
 			for (RelationMember rm : r.members) {
-				// only copy member if it is either the first of all the selected
-				// ways (indexOf==0) or not one if the selected ways (indexOf==-1)
-				if (selectedWays.indexOf(rm.member) < 1) {
-					newRel.members.add(new RelationMember(rm));
-				}
+				// Don't copy the member if it to one of our ways, just keep a
+				// note to re-add it later on.
+				if (selectedWays.contains(rm.member)) {
+					rolesToReAdd.add(rm.role);
+				} else {
+					newRel.members.add(rm);
+				}
+			}
+			for (String role : rolesToReAdd) {
+				newRel.members.add(new RelationMember(role, selectedWays.peek()));
 			}
 			cmds.add(new ChangeCommand(r, newRel));
@@ -224,5 +237,5 @@
 		//     complain to the user.
 		//  4. Profit!
-		
+
 		HashSet<NodePair> chunkSet = new HashSet<NodePair>();
 		for (Way w : ways) {
@@ -278,6 +291,6 @@
 			return tr("Could not combine ways "
 				+ "(They could not be merged into a single string of nodes)");
-		} 
-		
+		}
+
 		return nodeList;
 	}
Index: trunk/src/org/openstreetmap/josm/data/osm/RelationMember.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/RelationMember.java	(revision 425)
+++ trunk/src/org/openstreetmap/josm/data/osm/RelationMember.java	(revision 426)
@@ -17,4 +17,9 @@
 	 */
 	public RelationMember() { };
+
+	public RelationMember(String role, OsmPrimitive member) {
+		this.role = role;
+		this.member = member;
+	}
 	
 	/**
