mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-16 10:51:55 -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
|
||||
// editing stuff or using mods to clone blocks (e.g. WorldEdit).
|
||||
otherNetwork.data.filter(entry => data.contains(entry._1)).toArray.foreach {
|
||||
case (address, node: MutableNode) =>
|
||||
val neighbors = node.neighbors.toArray // Copy to be on the safe side.
|
||||
node.remove()
|
||||
node.address = java.util.UUID.randomUUID().toString
|
||||
neighbors.foreach(_.connect(node))
|
||||
case (address, node: Network.Vertex) =>
|
||||
val neighbors = node.data.neighbors.toArray // Copy to be on the safe side.
|
||||
node.data.remove()
|
||||
node.data.address = java.util.UUID.randomUUID().toString
|
||||
neighbors.foreach(_.connect(node.data))
|
||||
}
|
||||
|
||||
if (addedNode.reachability == Visibility.Neighbors)
|
||||
|
@ -11,8 +11,8 @@ import scala.collection.convert.WrapAsJava._
|
||||
import scala.collection.convert.WrapAsScala._
|
||||
|
||||
trait Node extends ImmutableNode {
|
||||
val host: Environment
|
||||
val reachability: Visibility
|
||||
def host: Environment
|
||||
def reachability: Visibility
|
||||
|
||||
final var address: String = null
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user