- when 'putway'; orn=renumberednodes.dup
- r=putway(renumberednodes,*args)
- r[4]=renumberednodes.dup
- r[4].delete_if { |k,v| orn.has_key?(k) }
- if r[2] != r[3] then renumberedways[r[2]] = r[3] end
- results[index]=AMF.putdata(index,r)
- when 'putrelation'; results[index]=AMF.putdata(index,putrelation(renumberednodes, renumberedways, *args))
- when 'deleteway'; results[index]=AMF.putdata(index,deleteway(*args))
- when 'putpoi'; r=putpoi(*args)
- if r[2] != r[3] then renumberednodes[r[2]] = r[3] end
- results[index]=AMF.putdata(index,r)
- when 'startchangeset'; results[index]=AMF.putdata(index,startchangeset(*args))
- end
- if results[index][0]==-3 then err=true end # If a conflict is detected, don't execute any more writes
+ when 'putway'; orn = renumberednodes.dup
+ result = putway(renumberednodes, *args)
+ result[4] = renumberednodes.reject { |k,v| orn.has_key?(k) }
+ if result[0] == 0 and result[2] != result[3] then renumberedways[result[2]] = result[3] end
+ when 'putrelation'; result = putrelation(renumberednodes, renumberedways, *args)
+ when 'deleteway'; result = deleteway(*args)
+ when 'putpoi'; result = putpoi(*args)
+ if result[0] == 0 and result[2] != result[3] then renumberednodes[result[2]] = result[3] end
+ when 'startchangeset'; result = startchangeset(*args)
+ end
+
+ err = true if result[0] == -3 # If a conflict is detected, don't execute any more writes