rename some variables and begin compiled sim c code
This commit is contained in:
@@ -6,12 +6,12 @@ function Simulation.new(sim)
|
||||
definitions = {},
|
||||
wires = {},
|
||||
gates = {},
|
||||
|
||||
|
||||
nwires = 0,
|
||||
ngates = 0,
|
||||
ninports = 0,
|
||||
noutports = 0,
|
||||
|
||||
|
||||
groupqueue = {},
|
||||
groupfxqueue = {},
|
||||
gatequeue = {},
|
||||
@@ -20,10 +20,10 @@ function Simulation.new(sim)
|
||||
tickqueue = {},
|
||||
inputqueue_nonempty = false,
|
||||
initqueue_nonempty = false,
|
||||
|
||||
|
||||
callbacks = nil,
|
||||
|
||||
currenttick = 0
|
||||
|
||||
current_tick = 0,
|
||||
}
|
||||
setmetatable(o, sim)
|
||||
sim.__index = sim
|
||||
@@ -34,15 +34,15 @@ function Simulation.addtoworld(sim, obj, x, y, z)
|
||||
if sim[x] == nil then
|
||||
sim[x] = {}
|
||||
end
|
||||
|
||||
|
||||
if sim[x][y] == nil then
|
||||
sim[x][y] = {}
|
||||
end
|
||||
|
||||
|
||||
if sim[x][y][z] == nil then
|
||||
sim[x][y][z] = {}
|
||||
end
|
||||
|
||||
|
||||
sim[x][y][z][obj] = obj
|
||||
end
|
||||
|
||||
@@ -245,7 +245,7 @@ function Simulation.queuegate(sim, gate)
|
||||
end
|
||||
|
||||
function Simulation.queuegatelater(sim, gate, delay)
|
||||
local tick = sim.currenttick + delay
|
||||
local tick = sim.current_tick + delay
|
||||
if sim.tickqueue[tick] == nil then
|
||||
sim.tickqueue[tick] = {}
|
||||
end
|
||||
@@ -322,11 +322,11 @@ function Simulation.tick(sim)
|
||||
sim.inputqueue_nonempty = false
|
||||
end
|
||||
|
||||
if sim.tickqueue[sim.currenttick] ~= nil then
|
||||
for i, gate in pairs(sim.tickqueue[sim.currenttick]) do
|
||||
if sim.tickqueue[sim.current_tick] ~= nil then
|
||||
for i, gate in pairs(sim.tickqueue[sim.current_tick]) do
|
||||
Simulation.queuegate(sim, gate)
|
||||
end
|
||||
sim.tickqueue[sim.currenttick] = nil
|
||||
sim.tickqueue[sim.current_tick] = nil
|
||||
end
|
||||
|
||||
for k, gate in ipairs(sim.gatequeue) do
|
||||
@@ -335,7 +335,7 @@ function Simulation.tick(sim)
|
||||
end
|
||||
sim.gatequeue = {}
|
||||
|
||||
sim.currenttick = sim.currenttick + 1
|
||||
sim.current_tick = sim.current_tick + 1
|
||||
end
|
||||
|
||||
function Simulation.sendfxupdate(sim)
|
||||
|
||||
Reference in New Issue
Block a user