]> git.lizzy.rs Git - minetest.git/blobdiff - src/guiFormSpecMenu.h
Remove superfluous pointer null checks
[minetest.git] / src / guiFormSpecMenu.h
index d70c3a5827be6ca1cd9f537da2d07a00cdc7cc27..d08bb4ab59cdbdebed78c896365a7ea2423c3810 100644 (file)
@@ -57,7 +57,7 @@ struct TextDest
 {
        virtual ~TextDest() {}
        // This is deprecated I guess? -celeron55
-       virtual void gotText(std::wstring text){}
+       virtual void gotText(const std::wstring &text) {}
        virtual void gotText(const StringMap &fields) = 0;
 
        std::string m_formname;
@@ -69,7 +69,7 @@ class IFormSource
        virtual ~IFormSource(){}
        virtual std::string getForm() = 0;
        // Fill in variables in field text
-       virtual std::string resolveText(std::string str){ return str; }
+       virtual std::string resolveText(const std::string &str) { return str; }
 };
 
 class GUIFormSpecMenu : public GUIModalMenu
@@ -310,18 +310,14 @@ class GUIFormSpecMenu : public GUIModalMenu
        // form_src is deleted by this GUIFormSpecMenu
        void setFormSource(IFormSource *form_src)
        {
-               if (m_form_src != NULL) {
-                       delete m_form_src;
-               }
+               delete m_form_src;
                m_form_src = form_src;
        }
 
        // text_dst is deleted by this GUIFormSpecMenu
        void setTextDest(TextDest *text_dst)
        {
-               if (m_text_dst != NULL) {
-                       delete m_text_dst;
-               }
+               delete m_text_dst;
                m_text_dst = text_dst;
        }
 
@@ -397,7 +393,7 @@ class GUIFormSpecMenu : public GUIModalMenu
        std::vector<ImageDrawSpec> m_images;
        std::vector<ImageDrawSpec> m_itemimages;
        std::vector<BoxDrawSpec> m_boxes;
-       UNORDERED_MAP<std::string, bool> field_close_on_enter;
+       std::unordered_map<std::string, bool> field_close_on_enter;
        std::vector<FieldSpec> m_fields;
        std::vector<StaticTextSpec> m_static_texts;
        std::vector<std::pair<FieldSpec,GUITable*> > m_tables;
@@ -420,8 +416,8 @@ class GUIFormSpecMenu : public GUIModalMenu
        v2s32 m_old_pointer;  // Mouse position after previous mouse event
        gui::IGUIStaticText *m_tooltip_element;
 
-       u32 m_tooltip_show_delay;
-       s32 m_hovered_time;
+       u64 m_tooltip_show_delay;
+       u64 m_hovered_time;
        s32 m_old_tooltip_id;
        std::wstring m_old_tooltip;
 
@@ -460,7 +456,7 @@ class GUIFormSpecMenu : public GUIModalMenu
                GUITable::TableOptions table_options;
                GUITable::TableColumns table_columns;
                // used to restore table selection/scroll/treeview state
-               UNORDERED_MAP<std::string, GUITable::DynamicData> table_dyndata;
+               std::unordered_map<std::string, GUITable::DynamicData> table_dyndata;
        } parserData;
 
        typedef struct {
@@ -517,6 +513,9 @@ class GUIFormSpecMenu : public GUIModalMenu
 
        void tryClose();
 
+       void showTooltip(const std::wstring &text, const irr::video::SColor &color,
+               const irr::video::SColor &bgcolor);
+
        /**
         * check if event is part of a double click
         * @param event event to evaluate
@@ -527,7 +526,7 @@ class GUIFormSpecMenu : public GUIModalMenu
        struct clickpos
        {
                v2s32 pos;
-               s32 time;
+               s64 time;
        };
        clickpos m_doubleclickdetect[2];