mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-16 18:55:03 -04:00
Fixed logic for handling nodes with duplicate addresses when merging networks. Closes #824.
This commit is contained in:
parent
45fc2b8b6c
commit
3157eb4f36
@ -252,11 +252,11 @@ private class Network private(private val data: mutable.Map[String, Network.Vert
|
|||||||
// never happen in normal operation anyway. It *can* happen when NBT
|
// never happen in normal operation anyway. It *can* happen when NBT
|
||||||
// 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: MutableNode) =>
|
case (address, node: Network.Vertex) =>
|
||||||
val neighbors = node.neighbors.toArray // Copy to be on the safe side.
|
val neighbors = node.data.neighbors.toArray // Copy to be on the safe side.
|
||||||
node.remove()
|
node.data.remove()
|
||||||
node.address = java.util.UUID.randomUUID().toString
|
node.data.address = java.util.UUID.randomUUID().toString
|
||||||
neighbors.foreach(_.connect(node))
|
neighbors.foreach(_.connect(node.data))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addedNode.reachability == Visibility.Neighbors)
|
if (addedNode.reachability == Visibility.Neighbors)
|
||||||
|
@ -11,8 +11,8 @@ import scala.collection.convert.WrapAsJava._
|
|||||||
import scala.collection.convert.WrapAsScala._
|
import scala.collection.convert.WrapAsScala._
|
||||||
|
|
||||||
trait Node extends ImmutableNode {
|
trait Node extends ImmutableNode {
|
||||||
val host: Environment
|
def host: Environment
|
||||||
val reachability: Visibility
|
def reachability: Visibility
|
||||||
|
|
||||||
final var address: String = null
|
final var address: String = null
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user