From 4530a7b583b7f8243d33d46f0857cb82a6112911 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 21 Nov 2021 10:10:58 +0100 Subject: [PATCH] - minor optimization to last PR to use a FixedBitArray to reduce stack impact of the check array. --- src/common/engine/d_event.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common/engine/d_event.cpp b/src/common/engine/d_event.cpp index 52fedd428..7a51d054a 100644 --- a/src/common/engine/d_event.cpp +++ b/src/common/engine/d_event.cpp @@ -67,9 +67,10 @@ CVAR(Bool, m_filter, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) void D_ProcessEvents (void) { - bool keywasdown[NUM_KEYS] = { false }; + FixedBitArray keywasdown; TArray delayedevents; + keywasdown.Zero(); while (eventtail != eventhead) { event_t *ev = &events[eventtail]; @@ -94,7 +95,7 @@ void D_ProcessEvents (void) continue; // menu ate the event } - keywasdown[ev->data1] = G_Responder(ev) && ev->type == EV_KeyDown; + if (G_Responder(ev) && ev->type == EV_KeyDown) keywasdown.Set(ev->data1); } for (auto& ev: delayedevents)