Skip to content

Commit

Permalink
Fixed controller queue dead lock
Browse files Browse the repository at this point in the history
  • Loading branch information
deepnight committed Nov 6, 2023
1 parent 50b65d6 commit 2933a56
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/dn/heaps/input/ControllerQueue.hx
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ class ControllerQueue<T:Int> {
public function consumePress(action:T, ignoreChronologicalOrder=false) {
var nextT = events.get(action).getNextPress();
if( !ignoreChronologicalOrder ) {
for(ev in events)
for(ev in events) {
ev.gc(ev.presses, curTimeS);
if( ev.action!=action && ev.getNextPress()<nextT )
return false;
}
}
var pressed = events.get(action).popPress(curTimeS);
if( ignoreChronologicalOrder && pressed )
Expand Down Expand Up @@ -99,9 +101,11 @@ class ControllerQueue<T:Int> {
public function peekPress(action:T, ignoreChronologicalOrder=false) {
var nextT = events.get(action).getNextPress();
if( !ignoreChronologicalOrder ) {
for(ev in events)
for(ev in events) {
ev.gc(ev.presses, curTimeS);
if( ev.action!=action && ev.getNextPress()<nextT )
return false;
}
}
return events.get(action).peekPress(curTimeS);
}
Expand Down

0 comments on commit 2933a56

Please sign in to comment.