diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-05-01 19:41:58 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-05-01 19:41:58 +0200 |
commit | ee0936dade3753dc876710b87c6a30297fae60d5 (patch) | |
tree | 14fc473cccd0e1bd3b7284f1e13b1cb2527c2ad5 | |
parent | 52bcc4db2fd8ca3f1da36d3ffb488a0a6b113d10 (diff) |
Store original velocity after the powermap has been applied.
-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, |