more optimizations: move port states into gates, inline net queue checks

This commit is contained in:
Redo0
2021-06-05 18:41:50 -05:00
parent 14c61e35d1
commit 19d2e36fd6
6 changed files with 38 additions and 44 deletions

View File

@@ -81,9 +81,15 @@ function GateDefinition.constructgate(def, objref, position, rotation)
pos[1] = -pos[2]
pos[2] = x
end
Gate.addport(gate, Port.new(type, dir, {position[1]+pos[1], position[2]+pos[2], position[3]+pos[3]}, portd.causeupdate, i))
local port = Port.new(type, dir, {position[1]+pos[1], position[2]+pos[2], position[3]+pos[3]}, portd.causeupdate, i, gate)
gate.ports[port.idx] = port
--gate[port.idx*2] = nil
--gate[port.idx*2+1] = 0
gate.port_nets[port.idx] = nil
gate.port_states[port.idx] = 0
end
return gate
end