Merge branch 'master-MC1.8.9' of github.com:MightyPirates/OpenComputers into master-MC1.9.4

This commit is contained in:
Florian Nücke 2016-07-30 09:41:16 +02:00
commit c5989952fc
2 changed files with 16 additions and 7 deletions

View File

@ -857,7 +857,9 @@ sandbox = {
min = math.min,
modf = math.modf,
pi = math.pi,
pow = math.pow,
pow = math.pow or function(a, b) -- Deprecated in Lua 5.3
return a^b
end,
rad = math.rad,
random = function(...)
return spcall(math.random, ...)

View File

@ -262,16 +262,23 @@ private class Network private(private val data: mutable.Map[String, Network.Vert
val node = vertex.data
val neighbors = vertex.edges.map(_.other(vertex).data).toArray
var newAddress = ""
do {
newAddress = java.util.UUID.randomUUID().toString
} while (data.contains(newAddress) || otherNetwork.data.contains(newAddress))
// This may lead to splits, which is the whole reason we have to
// check the network of the other nodes after the readdressing.
node.remove()
do {
node.address = java.util.UUID.randomUUID().toString
} while (data.contains(node.address) || otherNetwork.data.contains(node.address))
node.address = newAddress
Network.joinNewNetwork(node)
neighbors.filter(_.network != null).foreach(_.connect(node))
if (node.address == newAddress) {
neighbors.filter(_.network != null).foreach(_.connect(node))
} else {
OpenComputers.log.error("I can't see this happening any other way than someone directly setting node addresses, which they shouldn't. So yeah. Shit'll be borked. Deal with it.")
node.remove() // well screw you then
}
})
duplicates.head.data.network.asInstanceOf[Network.Wrapper].network