Modernize client code (#6250)
[oweals/minetest.git] / src / guiKeyChangeMenu.h
index 2b498676b2691d16d35e48f5bde4375d9bedf48b..84d3fffcd927850c079d26ec28f86a70a3070255 100644 (file)
 #include <string>
 #include <vector>
 
-typedef struct {
+struct key_setting
+{
        int id;
-       wchar_t *button_name;
+       const wchar_t *button_name;
        KeyPress key;
        std::string setting_name;
        gui::IGUIButton *button;
-} key_setting;
-
+};
 
-class GUIKeyChangeMenu: public GUIModalMenu
+class GUIKeyChangeMenu : public GUIModalMenu
 {
 public:
-       GUIKeyChangeMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent,
-                       s32 id, IMenuManager *menumgr);
+       GUIKeyChangeMenu(gui::IGUIEnvironment *env, gui::IGUIElement *parent, s32 id,
+                       IMenuManager *menumgr);
        ~GUIKeyChangeMenu();
 
        void removeChildren();
@@ -56,24 +56,23 @@ public:
 
        bool acceptInput();
 
-       bool OnEvent(const SEventevent);
+       bool OnEvent(const SEvent &event);
 
-private:
+       bool pausesGame() { return true; }
 
+private:
        void init_keys();
 
        bool resetMenu();
 
-       void add_key(int id, std::string setting_name, std::string button_name);
+       void add_key(int id, const wchar_t *button_name, const std::string &setting_name);
+
+       bool shift_down = false;
+       s32 activeKey = -1;
 
-       bool shift_down;
-       
-       s32 activeKey;
-       
        std::vector<KeyPress> key_used;
-       gui::IGUIStaticText *key_used_text;
+       gui::IGUIStaticText *key_used_text = nullptr;
        std::vector<key_setting *> key_settings;
 };
 
 #endif
-