mirror of
https://github.com/minetest-mods/technic.git
synced 2025-01-11 18:50:19 +01:00
Reduce queue size
This commit is contained in:
parent
054494abb6
commit
2cd2093b33
@ -190,9 +190,13 @@ local get_network = function(sw_pos, pos1, tier)
|
|||||||
local all_nodes = {}
|
local all_nodes = {}
|
||||||
local queue = {}
|
local queue = {}
|
||||||
add_cable_node(all_nodes, pos1, network_id, queue)
|
add_cable_node(all_nodes, pos1, network_id, queue)
|
||||||
for _, pos in ipairs(queue) do
|
while next(queue) do
|
||||||
traverse_network(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes,
|
local to_visit = {}
|
||||||
pos, technic.machines[tier], tier, sw_pos, network_id, queue)
|
for _, pos in ipairs(queue) do
|
||||||
|
traverse_network(PR_nodes, RE_nodes, BA_nodes, SP_nodes, all_nodes,
|
||||||
|
pos, technic.machines[tier], tier, sw_pos, network_id, to_visit)
|
||||||
|
end
|
||||||
|
queue = to_visit
|
||||||
end
|
end
|
||||||
PR_nodes = flatten(PR_nodes)
|
PR_nodes = flatten(PR_nodes)
|
||||||
BA_nodes = flatten(BA_nodes)
|
BA_nodes = flatten(BA_nodes)
|
||||||
|
Loading…
Reference in New Issue
Block a user