diff options
-rw-r--r-- | src/inputprocessor.cc | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/inputprocessor.cc b/src/inputprocessor.cc index 1054539..2da5dbc 100644 --- a/src/inputprocessor.cc +++ b/src/inputprocessor.cc @@ -39,6 +39,25 @@ #include "cpp11fix.h" +class VelocityStorer + : public InputFilter +{ +public: + VelocityStorer(float& original_velocity) + : original_velocity(original_velocity) + { + } + + bool filter(event_t& event, std::size_t pos) override + { + original_velocity = event.velocity; + return true; + } + +private: + float& original_velocity; +}; + class Reporter : public InputFilter { @@ -55,7 +74,7 @@ public: return true; } - +private: Settings& settings; float& original_velocity; }; @@ -70,10 +89,11 @@ InputProcessor::InputProcessor(Settings& settings, { // Build filter list filters.emplace_back(std::make_unique<PowermapFilter>(settings)); + filters.emplace_back(std::make_unique<VelocityStorer>(original_velocity)); filters.emplace_back(std::make_unique<StaminaFilter>(settings)); filters.emplace_back(std::make_unique<LatencyFilter>(settings, random)); - filters.emplace_back(std::make_unique<Reporter>(settings, original_velocity)); filters.emplace_back(std::make_unique<VelocityFilter>(settings, random)); + filters.emplace_back(std::make_unique<Reporter>(settings, original_velocity)); } bool InputProcessor::process(std::vector<event_t>& events, |