From 4664c25bee3ad1f80b2822ef7da16df197df2e69 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 28 Dec 2005 20:41:24 +0000 Subject: [PATCH] fix excessive memory usage by m_ButtonState --- stepmania/src/InputFilter.cpp | 88 ++++++++++++++++++++++++++--------- stepmania/src/InputFilter.h | 18 +------ 2 files changed, 67 insertions(+), 39 deletions(-) diff --git a/stepmania/src/InputFilter.cpp b/stepmania/src/InputFilter.cpp index 42446119a2..cda24b465a 100644 --- a/stepmania/src/InputFilter.cpp +++ b/stepmania/src/InputFilter.cpp @@ -8,6 +8,22 @@ #include "Foreach.h" #include +struct ButtonState +{ + ButtonState(); + bool m_BeingHeld; // actual current state + bool m_bLastReportedHeld; // last state reported by Update() + CString m_sComment; + float m_fSecsHeld; + float m_Level, m_LastLevel; + + // Timestamp of m_BeingHeld changing. + RageTimer m_BeingHeldTime; + + // The time that we actually reported the last event (used for debouncing). + RageTimer m_LastReportTime; +}; + namespace { /* Maintain a set of all interesting buttons: buttons which are being held @@ -15,11 +31,11 @@ namespace * optimize InputFilter::Update, so we don't have to process every button * we know about when most of them aren't in use. This set is protected * by queuemutex. */ - typedef pair Button; - set