From: terencehill Date: Wed, 6 Jul 2016 17:51:29 +0000 (+0200) Subject: Compact a few similar code blocks X-Git-Tag: xonotic-v0.8.2~700^2~87^2~5 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=252dda8433f6fa91e2b73e3bfb94b1f718c023bc;p=xonotic%2Fxonotic-data.pk3dir.git Compact a few similar code blocks --- diff --git a/qcsrc/client/hud/hud_config.qc b/qcsrc/client/hud/hud_config.qc index f45a052aa..56a79364d 100644 --- a/qcsrc/client/hud/hud_config.qc +++ b/qcsrc/client/hud/hud_config.qc @@ -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; diff --git a/qcsrc/client/hud/panel/quickmenu.qc b/qcsrc/client/hud/panel/quickmenu.qc index d7d2b163d..4cb5c9fd4 100644 --- a/qcsrc/client/hud/panel/quickmenu.qc +++ b/qcsrc/client/hud/panel/quickmenu.qc @@ -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) diff --git a/qcsrc/client/hud/panel/radar.qc b/qcsrc/client/hud/panel/radar.qc index 1642e4189..85e682d08 100644 --- a/qcsrc/client/hud/panel/radar.qc +++ b/qcsrc/client/hud/panel/radar.qc @@ -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))) diff --git a/qcsrc/common/minigames/cl_minigames_hud.qc b/qcsrc/common/minigames/cl_minigames_hud.qc index f64ed44c8..c26109bfd 100644 --- a/qcsrc/common/minigames/cl_minigames_hud.qc +++ b/qcsrc/common/minigames/cl_minigames_hud.qc @@ -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;