Fixed logic for handling nodes with duplicate addresses when merging networks. Closes #824.

This commit is contained in:
Florian Nücke 2015-01-17 00:44:35 +01:00
parent 45fc2b8b6c
commit 3157eb4f36
2 changed files with 7 additions and 7 deletions

View File

@ -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)

View File

@ -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