diff options
| author | 2019-06-03 16:15:30 -0400 | |
|---|---|---|
| committer | 2019-06-03 16:56:46 -0400 | |
| commit | 2c679cda51c2cde11e83391a578499f2118a1347 (patch) | |
| tree | 5a9bffcbb4115f6294cd540ead9b6832d68cbad7 /src/input_common/sdl/sdl_impl.cpp | |
| parent | input_common/sdl/sdl_impl: Simplify SDL_Joystick deleter handling (diff) | |
| download | yuzu-2c679cda51c2cde11e83391a578499f2118a1347.tar.gz yuzu-2c679cda51c2cde11e83391a578499f2118a1347.tar.xz yuzu-2c679cda51c2cde11e83391a578499f2118a1347.zip | |
input_common/sdl/sdl_impl: Use insert_or_assign() where applicable
Same behavior, but without a potential need to unnecessarily default
construct a value.
Diffstat (limited to 'src/input_common/sdl/sdl_impl.cpp')
| -rw-r--r-- | src/input_common/sdl/sdl_impl.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/input_common/sdl/sdl_impl.cpp b/src/input_common/sdl/sdl_impl.cpp index f19a353c3..edd4affe2 100644 --- a/src/input_common/sdl/sdl_impl.cpp +++ b/src/input_common/sdl/sdl_impl.cpp | |||
| @@ -51,7 +51,7 @@ public: | |||
| 51 | 51 | ||
| 52 | void SetButton(int button, bool value) { | 52 | void SetButton(int button, bool value) { |
| 53 | std::lock_guard lock{mutex}; | 53 | std::lock_guard lock{mutex}; |
| 54 | state.buttons[button] = value; | 54 | state.buttons.insert_or_assign(button, value); |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | bool GetButton(int button) const { | 57 | bool GetButton(int button) const { |
| @@ -61,7 +61,7 @@ public: | |||
| 61 | 61 | ||
| 62 | void SetAxis(int axis, Sint16 value) { | 62 | void SetAxis(int axis, Sint16 value) { |
| 63 | std::lock_guard lock{mutex}; | 63 | std::lock_guard lock{mutex}; |
| 64 | state.axes[axis] = value; | 64 | state.axes.insert_or_assign(axis, value); |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | float GetAxis(int axis) const { | 67 | float GetAxis(int axis) const { |
| @@ -88,7 +88,7 @@ public: | |||
| 88 | 88 | ||
| 89 | void SetHat(int hat, Uint8 direction) { | 89 | void SetHat(int hat, Uint8 direction) { |
| 90 | std::lock_guard lock{mutex}; | 90 | std::lock_guard lock{mutex}; |
| 91 | state.hats[hat] = direction; | 91 | state.hats.insert_or_assign(hat, direction); |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | bool GetHatDirection(int hat, Uint8 direction) const { | 94 | bool GetHatDirection(int hat, Uint8 direction) const { |