]> git.lizzy.rs Git - minetest.git/blobdiff - src/client/inputhandler.h
C++11 cleanup on constructors dir client (#6012)
[minetest.git] / src / client / inputhandler.h
index 7c422d189fff354edfaf04cb8890469851e2ecee..19733e3ec28d7bb666f9a59f6ff034c58e921b69 100644 (file)
@@ -141,24 +141,23 @@ class MyEventReceiver : public IEventReceiver
 
        MyEventReceiver()
        {
-               clearInput();
 #ifdef HAVE_TOUCHSCREENGUI
                m_touchscreengui = NULL;
 #endif
        }
 
-       bool leftclicked;
-       bool rightclicked;
-       bool leftreleased;
-       bool rightreleased;
+       bool leftclicked = false;
+       bool rightclicked = false;
+       bool leftreleased = false;
+       bool rightreleased = false;
 
-       bool left_active;
-       bool middle_active;
-       bool right_active;
+       bool left_active = false;
+       bool middle_active = false;
+       bool right_active = false;
 
-       s32 mouse_wheel;
+       s32 mouse_wheel = 0;
 
-       JoystickController *joystick;
+       JoystickController *joystick = nullptr;
 
 #ifdef HAVE_TOUCHSCREENGUI
        TouchScreenGUI *m_touchscreengui;
@@ -221,7 +220,7 @@ class RealInputHandler : public InputHandler
 {
 public:
        RealInputHandler(IrrlichtDevice *device, MyEventReceiver *receiver)
-           : m_device(device), m_receiver(receiver), m_mousepos(0, 0)
+           : m_device(device), m_receiver(receiver)
        {
                m_receiver->joystick = &joystick;
        }
@@ -277,24 +276,15 @@ class RealInputHandler : public InputHandler
        }
 
 private:
-       IrrlichtDevice *m_device;
-       MyEventReceiver *m_receiver;
+       IrrlichtDevice *m_device = nullptr;
+       MyEventReceiver *m_receiver = nullptr;
        v2s32 m_mousepos;
 };
 
 class RandomInputHandler : public InputHandler
 {
 public:
-       RandomInputHandler()
-       {
-               leftdown = false;
-               rightdown = false;
-               leftclicked = false;
-               rightclicked = false;
-               leftreleased = false;
-               rightreleased = false;
-               keydown.clear();
-       }
+       RandomInputHandler() {}
        virtual bool isKeyDown(const KeyPress &keyCode) { return keydown[keyCode]; }
        virtual bool wasKeyDown(const KeyPress &keyCode) { return false; }
        virtual v2s32 getMousePos() { return mousepos; }
@@ -390,12 +380,12 @@ class RandomInputHandler : public InputHandler
        KeyList keydown;
        v2s32 mousepos;
        v2s32 mousespeed;
-       bool leftdown;
-       bool rightdown;
-       bool leftclicked;
-       bool rightclicked;
-       bool leftreleased;
-       bool rightreleased;
+       bool leftdown = false;
+       bool rightdown = false;
+       bool leftclicked = false;
+       bool rightclicked = false;
+       bool leftreleased = false;
+       bool rightreleased = false;
 };
 
 #endif