From 5b4c948e43fb02fd62d70685c361f9c6a3c9af0c Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Wed, 26 Apr 2017 20:12:46 +0200 Subject: [PATCH] onepad: clean the gamepad/joystick interface Remove return of empty function Use final/override qualifier Remove useless virtual Thanks turtleli for the advices --- plugins/onepad/GamePad.h | 5 ++--- plugins/onepad/SDL/joystick.h | 14 +++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/plugins/onepad/GamePad.h b/plugins/onepad/GamePad.h index 39adf81a05..6a03eb6162 100644 --- a/plugins/onepad/GamePad.h +++ b/plugins/onepad/GamePad.h @@ -17,7 +17,6 @@ public: virtual ~GamePad() { - return; } GamePad(const GamePad &); // copy constructor @@ -37,7 +36,7 @@ public: * Causes devices to rumble * Rumble will differ according to type which is either 0(small motor) or 1(big motor) */ - virtual void Rumble(unsigned type, unsigned pad) { return; } + virtual void Rumble(unsigned type, unsigned pad) {} /* * Safely dispatch to the Rumble method above */ @@ -52,7 +51,7 @@ public: virtual int GetInput(gamePadValues input) = 0; - virtual int GetDeadzone() + int GetDeadzone() { return m_deadzone; } diff --git a/plugins/onepad/SDL/joystick.h b/plugins/onepad/SDL/joystick.h index bface1b00e..f868c3523a 100644 --- a/plugins/onepad/SDL/joystick.h +++ b/plugins/onepad/SDL/joystick.h @@ -29,7 +29,7 @@ #include "controller.h" #define NB_EFFECT 2 // Don't use more than two, ps2 only has one for big motor and one for small(like most systems) // holds all joystick info -class JoystickInfo : GamePad +class JoystickInfo : public GamePad { public: JoystickInfo(int id); @@ -42,17 +42,17 @@ public: // opens handles to all possible joysticks static void EnumerateJoysticks(std::vector> &vjoysticks); - void Rumble(unsigned type, unsigned pad); + void Rumble(unsigned type, unsigned pad) override; - bool TestForce(float); + bool TestForce(float) override; - virtual const char *GetName(); + const char *GetName() final; - virtual int GetInput(gamePadValues input); + int GetInput(gamePadValues input) final; - virtual void UpdateGamePadState(); + void UpdateGamePadState() final; - virtual size_t GetUniqueIdentifier(); + size_t GetUniqueIdentifier() final; private: SDL_GameController *m_controller;