make gates use cdata for critical logic
This commit is contained in:
@@ -244,11 +244,11 @@ end
|
||||
function Simulation.queuegate(sim, gate)
|
||||
sim.gatequeue[sim.num_gatequeue+1] = gate
|
||||
sim.num_gatequeue = sim.num_gatequeue + 1
|
||||
gate.in_queue = 1
|
||||
gate.c.in_queue = 1
|
||||
end
|
||||
|
||||
function Simulation.queuegate_safe(sim, gate)
|
||||
if gate.in_queue==0 then
|
||||
if gate.c.in_queue==0 then
|
||||
Simulation.queuegate(sim, gate)
|
||||
end
|
||||
end
|
||||
@@ -296,10 +296,10 @@ function Simulation.dequeuegroup(sim, group)
|
||||
end
|
||||
|
||||
function Simulation.dequeuegate(sim, gate)
|
||||
if gate.in_queue~=0 then
|
||||
if gate.c.in_queue~=0 then
|
||||
array_remove(sim.gatequeue, gate, true)
|
||||
sim.num_gatequeue = sim.num_gatequeue - 1
|
||||
gate.in_queue = 0
|
||||
gate.c.in_queue = 0
|
||||
end
|
||||
if sim.inputqueue~=nil then sim.inputqueue[gate] = nil end
|
||||
if sim.initqueue ~=nil then sim.initqueue [gate] = nil end
|
||||
@@ -330,7 +330,7 @@ function Simulation.ticklogic(sim)
|
||||
|
||||
if sim.tickqueue[sim.current_tick] ~= nil then
|
||||
for i, gate in pairs(sim.tickqueue[sim.current_tick]) do
|
||||
if gate.in_queue==0 then
|
||||
if gate.c.in_queue==0 then
|
||||
Simulation.queuegate(sim, gate)
|
||||
end
|
||||
end
|
||||
@@ -340,7 +340,7 @@ function Simulation.ticklogic(sim)
|
||||
for i = 1, sim.num_gatequeue do
|
||||
local gate = sim.gatequeue[i]
|
||||
gate.logic(gate)
|
||||
gate.in_queue = 0
|
||||
gate.c.in_queue = 0
|
||||
sim.gatequeue[i] = nil
|
||||
end
|
||||
--sim.gatequeue = {}
|
||||
|
||||
Reference in New Issue
Block a user