From 2680526e6ba1240363297c9ec34dbde807229d72 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 28 Aug 2020 20:58:29 -0400 Subject: [PATCH] sdl_impl: Mark FromEvent() as a const member function This doesn't modify internal member state, so it can be marked as const. --- src/input_common/sdl/sdl_impl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/input_common/sdl/sdl_impl.cpp b/src/input_common/sdl/sdl_impl.cpp index c8d9eb2bca..43fac76500 100644 --- a/src/input_common/sdl/sdl_impl.cpp +++ b/src/input_common/sdl/sdl_impl.cpp @@ -784,7 +784,7 @@ public: } return {}; } - std::optional FromEvent(const SDL_Event& event) { + [[nodiscard]] std::optional FromEvent(const SDL_Event& event) const { switch (event.type) { case SDL_JOYAXISMOTION: if (std::abs(event.jaxis.value / 32767.0) < 0.5) { @@ -795,7 +795,7 @@ public: case SDL_JOYHATMOTION: return {SDLEventToButtonParamPackage(state, event)}; } - return {}; + return std::nullopt; } };