Remove unused parameter of GUIVolumeChange
authorRui <rui.minetest@gmail.com>
Sun, 9 Oct 2016 08:27:14 +0000 (17:27 +0900)
committerNer'zhul <nerzhul@users.noreply.github.com>
Sun, 9 Oct 2016 08:35:51 +0000 (10:35 +0200)
src/game.cpp
src/guiVolumeChange.cpp
src/guiVolumeChange.h

index 5bb08e27a253fe152c45b67cb1caffa46c91e727..4f89aa680816dba2b440a5c92af5641e6ad4c5f5 100644 (file)
@@ -2571,7 +2571,7 @@ inline bool Game::handleCallbacks()
 
        if (g_gamecallback->changevolume_requested) {
                (new GUIVolumeChange(guienv, guiroot, -1,
-                                    &g_menumgr, client))->drop();
+                                    &g_menumgr))->drop();
                g_gamecallback->changevolume_requested = false;
        }
 
index c8e257f7f1c1a104d56dfb6ba33430fc99f0ec42..8425bc04f18fbc69ceabc9b9ad7ae1825359cedc 100644 (file)
@@ -37,8 +37,7 @@ const int ID_soundSlider = 266;
 
 GUIVolumeChange::GUIVolumeChange(gui::IGUIEnvironment* env,
                gui::IGUIElement* parent, s32 id,
-               IMenuManager *menumgr,
-               Client* client
+               IMenuManager *menumgr
 ):
        GUIModalMenu(env, parent, id, menumgr)
 {
@@ -51,26 +50,17 @@ GUIVolumeChange::~GUIVolumeChange()
 
 void GUIVolumeChange::removeChildren()
 {
-       {
-               gui::IGUIElement *e = getElementFromId(ID_soundText1);
-               if(e != NULL)
-                       e->remove();
-       }
-       {
-               gui::IGUIElement *e = getElementFromId(ID_soundText2);
-               if(e != NULL)
-                       e->remove();
-       }
-       {
-               gui::IGUIElement *e = getElementFromId(ID_soundExitButton);
-               if(e != NULL)
-                       e->remove();
-       }
-       {
-               gui::IGUIElement *e = getElementFromId(ID_soundSlider);
-               if(e != NULL)
-                       e->remove();
-       }
+       if (gui::IGUIElement *e = getElementFromId(ID_soundText1))
+               e->remove();
+
+       if (gui::IGUIElement *e = getElementFromId(ID_soundText2))
+               e->remove();
+
+       if (gui::IGUIElement *e = getElementFromId(ID_soundExitButton))
+               e->remove();
+
+       if (gui::IGUIElement *e = getElementFromId(ID_soundSlider))
+               e->remove();
 }
 
 void GUIVolumeChange::regenerateGui(v2u32 screensize)
@@ -95,7 +85,7 @@ void GUIVolumeChange::regenerateGui(v2u32 screensize)
 
        v2s32 size = rect.getSize();
        v2s32 topleft_client(40, 0);
-       int volume=(int)(g_settings->getFloat("sound_volume")*100);
+       int volume = (int)(g_settings->getFloat("sound_volume")*100);
        /*
                Add stuff
        */
@@ -137,45 +127,43 @@ void GUIVolumeChange::drawMenu()
        if (!skin)
                return;
        video::IVideoDriver* driver = Environment->getVideoDriver();
-       video::SColor bgcolor(140,0,0,0);
+       video::SColor bgcolor(140, 0, 0, 0);
        driver->draw2DRectangle(bgcolor, AbsoluteRect, &AbsoluteClippingRect);
        gui::IGUIElement::draw();
 }
 
 bool GUIVolumeChange::OnEvent(const SEvent& event)
 {
-       if(event.EventType==EET_KEY_INPUT_EVENT)
-       {
-               if(event.KeyInput.Key==KEY_ESCAPE && event.KeyInput.PressedDown)
-               {
+       if (event.EventType == EET_KEY_INPUT_EVENT) {
+               if (event.KeyInput.Key == KEY_ESCAPE && event.KeyInput.PressedDown) {
                        quitMenu();
                        return true;
                }
-               if(event.KeyInput.Key==KEY_RETURN && event.KeyInput.PressedDown)
-               {
+
+               if (event.KeyInput.Key == KEY_RETURN && event.KeyInput.PressedDown) {
                        quitMenu();
                        return true;
                }
        }
-       if(event.GUIEvent.EventType==gui::EGET_BUTTON_CLICKED)
-               {
-                       if (event.GUIEvent.Caller->getID() == ID_soundExitButton)
-                               {
-                                       quitMenu();
-                                       return true;
-                               }
+
+       if (event.GUIEvent.EventType == gui::EGET_BUTTON_CLICKED) {
+               if (event.GUIEvent.Caller->getID() == ID_soundExitButton) {
+                       quitMenu();
+                       return true;
                }
-       if(event.GUIEvent.EventType==gui::EGET_SCROLL_BAR_CHANGED)
-               {
-               if (event.GUIEvent.Caller->getID() == ID_soundSlider)
-                       {
-                               s32 pos = ((gui::IGUIScrollBar*)event.GUIEvent.Caller)->getPos();
-                               g_settings->setFloat("sound_volume",(float)pos/100);
-                               gui::IGUIElement *e = getElementFromId(ID_soundText2);
-                               e->setText( core::stringw(pos).c_str() );
-                               return true;
-                       }
+       }
+
+       if (event.GUIEvent.EventType == gui::EGET_SCROLL_BAR_CHANGED) {
+               if (event.GUIEvent.Caller->getID() == ID_soundSlider) {
+                       s32 pos = ((gui::IGUIScrollBar*)event.GUIEvent.Caller)->getPos();
+                       g_settings->setFloat("sound_volume", (float)pos/100);
+
+                       gui::IGUIElement *e = getElementFromId(ID_soundText2);
+                       e->setText(core::stringw(pos).c_str());
+                       return true;
                }
+       }
+
        return Parent ? Parent->OnEvent(event) : false;
 }
 
index 9f8199fa8bdfd36dcb9fa9308b7c0f4ae6334e6b..98731c6737273d68b17ec6459c6171be33d08857 100644 (file)
@@ -30,8 +30,7 @@ class GUIVolumeChange : public GUIModalMenu
 public:
        GUIVolumeChange(gui::IGUIEnvironment* env,
                        gui::IGUIElement* parent, s32 id,
-                       IMenuManager *menumgr,
-                       Client* client);
+                       IMenuManager *menumgr);
        ~GUIVolumeChange();
        
        void removeChildren();