]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Compact a few similar code blocks
authorterencehill <piuntn@gmail.com>
Wed, 6 Jul 2016 17:51:29 +0000 (19:51 +0200)
committerterencehill <piuntn@gmail.com>
Wed, 6 Jul 2016 17:51:29 +0000 (19:51 +0200)
qcsrc/client/hud/hud_config.qc
qcsrc/client/hud/panel/quickmenu.qc
qcsrc/client/hud/panel/radar.qc
qcsrc/common/minigames/cl_minigames_hud.qc

index f45a052aa1859d94ca8e9d5c2658f4f9d5178865..56a79364d49bbef3142efd7021ce3ea634885463 100644 (file)
@@ -671,10 +671,8 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
        }
 
        // allow console bind to work
-       string con_keys;
-       float keys;
-       con_keys = findkeysforcommand("toggleconsole", 0);
-       keys = tokenize(con_keys); // findkeysforcommand returns data for this
+       string con_keys = findkeysforcommand("toggleconsole", 0);
+       int keys = tokenize(con_keys); // findkeysforcommand returns data for this
 
        bool hit_con_bind = false;
        int i;
index d7d2b163d34a5a2f180a8a6a404e6611ec54e824..4cb5c9fd4e752fbabea639ce94c0658c854cc061 100644 (file)
@@ -431,11 +431,8 @@ bool QuickMenu_InputEvent(int bInputType, float nPrimary, float nSecondary)
        }
 
        // allow console bind to work
-       string con_keys;
-       float keys;
-       con_keys = findkeysforcommand("toggleconsole", 0);
-       keys = tokenize(con_keys); // findkeysforcommand returns data for this
-
+       string con_keys = findkeysforcommand("toggleconsole", 0);
+       int keys = tokenize(con_keys); // findkeysforcommand returns data for this
        bool hit_con_bind = false;
        int i;
        for (i = 0; i < keys; ++i)
index 1642e41891a8d75eed766cbe826bad92636feaa7..85e682d08edbfb9621b4b5bc738d90a70ec7c0a4 100644 (file)
@@ -78,11 +78,9 @@ float HUD_Radar_InputEvent(int bInputType, float nPrimary, float nSecondary)
        else
        {
                // allow console/use binds to work without hiding the map
-               string con_keys;
-               float keys;
-               float i;
-               con_keys = strcat(findkeysforcommand("toggleconsole", 0)," ",findkeysforcommand("+use", 0)) ;
-               keys = tokenize(con_keys); // findkeysforcommand returns data for this
+               string con_keys = strcat(findkeysforcommand("toggleconsole", 0), " ", findkeysforcommand("+use", 0)) ;
+               int keys = tokenize(con_keys); // findkeysforcommand returns data for this
+               int i;
                for (i = 0; i < keys; ++i)
                {
                        if(nPrimary == stof(argv(i)))
index f64ed44c84e800b919c901c501c134dbb3df4f8a..c26109bfd39e488179eddba303a3d5f5b974aac2 100644 (file)
@@ -598,10 +598,10 @@ float HUD_Minigame_InputEvent(float bInputType, float nPrimary, float nSecondary
                }
 
                // allow some binds
-               string con_keys;
-               con_keys = findkeysforcommand("toggleconsole", 0);
+               string con_keys = findkeysforcommand("toggleconsole", 0);
                int keys = tokenize(con_keys); // findkeysforcommand returns data for this
-               for (int i = 0; i < keys; ++i)
+               int i;
+               for (i = 0; i < keys; ++i)
                {
                        if(nPrimary == stof(argv(i)))
                                return false;