mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-16 10:51:55 -04:00
Should fix #911, merging networks containing nodes with the same address could lead to errors if these nodes had Visibility.None
.
This commit is contained in:
parent
ec2bca401c
commit
5750ec8ba1
@ -249,10 +249,13 @@ private class Network private(private val data: mutable.Map[String, Network.Vert
|
|||||||
// editing stuff or using mods to clone blocks (e.g. WorldEdit).
|
// editing stuff or using mods to clone blocks (e.g. WorldEdit).
|
||||||
otherNetwork.data.filter(entry => data.contains(entry._1)).toArray.foreach {
|
otherNetwork.data.filter(entry => data.contains(entry._1)).toArray.foreach {
|
||||||
case (address, node: Network.Vertex) =>
|
case (address, node: Network.Vertex) =>
|
||||||
val neighbors = node.data.neighbors.toArray // Copy to be on the safe side.
|
val neighbors = node.edges.map(_.other(node))
|
||||||
node.data.remove()
|
node.data.remove()
|
||||||
node.data.address = java.util.UUID.randomUUID().toString
|
node.data.address = java.util.UUID.randomUUID().toString
|
||||||
neighbors.foreach(_.connect(node.data))
|
if (neighbors.isEmpty)
|
||||||
|
otherNetwork.addNew(node.data)
|
||||||
|
else
|
||||||
|
neighbors.foreach(_.data.connect(node.data))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addedNode.reachability == Visibility.Neighbors)
|
if (addedNode.reachability == Visibility.Neighbors)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user