make states numbers instead of booleans
This commit is contained in:
@@ -23,13 +23,15 @@ function Gate.getportstate(gate, index)
|
||||
end
|
||||
|
||||
function Gate.setportstate(gate, index, state)
|
||||
if type(state)~="number" then error("invalid state type - must be number (gate "..gate.objref..")") end
|
||||
|
||||
local port = gate.ports[index]
|
||||
if state ~= port.state then
|
||||
local group = port.group
|
||||
group.state_num = group.state_num - (port.state and 1 or 0) + (state and 1 or 0)
|
||||
group.state_num = group.state_num - port.state + state
|
||||
port.state = state
|
||||
|
||||
if (group.state_num>0) ~= group.state then
|
||||
if (group.state_num>0) ~= (group.state==1) then
|
||||
Simulation.queuegroup(GSim, group)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user