From 1900ebdaf5a6a30dd5383ac0f9125c9651815fe5 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Tue, 25 Oct 2011 13:57:44 +0200 Subject: [PATCH] get rid of some uses of the insane tokenizer --- qcsrc/client/Main.qc | 1 - qcsrc/client/View.qc | 2 +- qcsrc/client/hud_config.qc | 2 +- qcsrc/common/util.qh | 2 +- qcsrc/menu/gamecommand.qc | 39 ------------------------------------- qcsrc/server/g_world.qc | 2 +- qcsrc/server/gamecommand.qc | 2 +- qcsrc/server/sv_main.qc | 2 +- 8 files changed, 6 insertions(+), 46 deletions(-) diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index 9aa81be98..7abf72087 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -354,7 +354,6 @@ float CSQC_ConsoleCommand(string strMessage) { float argc; // Tokenize String - //argc = tokenize(strMessage); argc = tokenize_console(strMessage); // Acquire Command diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index ea10300ed..d2072e101 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -1452,7 +1452,7 @@ void CSQC_common_hud(void) if(acc_color_levels) strunzone(acc_color_levels); acc_color_levels = strzone(autocvar_accuracy_color_levels); - acc_levels = tokenize(acc_color_levels); + acc_levels = tokenize_console(acc_color_levels); if (acc_levels > MAX_ACCURACY_LEVELS) acc_levels = MAX_ACCURACY_LEVELS; diff --git a/qcsrc/client/hud_config.qc b/qcsrc/client/hud_config.qc index f26f65ea5..488debb11 100644 --- a/qcsrc/client/hud_config.qc +++ b/qcsrc/client/hud_config.qc @@ -583,7 +583,7 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary) string con_keys; float keys; con_keys = findkeysforcommand("toggleconsole"); - keys = tokenize(con_keys); + keys = tokenize(con_keys); // findkeysforcommand returns data for this float hit_con_bind, i; for (i = 0; i < keys; ++i) diff --git a/qcsrc/common/util.qh b/qcsrc/common/util.qh index 2eee6d74e..b2e77484e 100644 --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@ -22,7 +22,7 @@ void wordwrap_cb(string s, float l, void(string) callback) float GameCommand_Generic(string cmd); // returns TRUE if handled, FALSE otherwise -// uses tokenize on its argument! +// tokenizes its input! // iterative depth-first search, with fields that go "up", "down left" and "right" in a tree // for each element, funcPre is called first, then funcPre and funcPost for all its children, and funcPost last diff --git a/qcsrc/menu/gamecommand.qc b/qcsrc/menu/gamecommand.qc index 83ef53762..e637bf5aa 100644 --- a/qcsrc/menu/gamecommand.qc +++ b/qcsrc/menu/gamecommand.qc @@ -184,44 +184,5 @@ void GameCommand(string theCommand) return; } -#if 0 - if(argv(0) == "tokentest") - { - string s; - float i, n; - - print("SANE tokenizer:\n"); - s = cvar_string("tokentest"); - n = tokenize_console_force_builtin(s); - for(i = -n; i < n; ++i) - { - print("token ", ftos(i), ": '", argv(i), "' = "); - print(ftos(argv_start_index(i)), " to ", ftos(argv_end_index(i)), "\n"); - } - print(".\n"); - - print("INSANE tokenizer:\n"); - s = cvar_string("tokentest"); - n = tokenize(s); - for(i = -n; i < n; ++i) - { - print("token ", ftos(i), ": '", argv(i), "' = "); - print(ftos(argv_start_index(i)), " to ", ftos(argv_end_index(i)), "\n"); - } - print(".\n"); - - print("EMULATED tokenizer:\n"); - s = cvar_string("tokentest"); - n = tokenize_console_force_emulation(s); - for(i = -n; i < n; ++i) - { - print("token ", ftos(i), ": '", argv(i), "' = "); - print(ftos(argv_start_index(i)), " to ", ftos(argv_end_index(i)), "\n"); - } - print(".\n"); - return; - } -#endif - print(_("Invalid command. For a list of supported commands, try menu_cmd help.\n")); } diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index b134886d4..5b2821258 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -961,7 +961,7 @@ string GetMapname() float Map_Count, Map_Current; string Map_Current_Name; -// NOTE: this now expects the map list to be already tokenize()d and the count in Map_Count +// NOTE: this now expects the map list to be already tokenized and the count in Map_Count float GetMaplistPosition() { float pos, idx; diff --git a/qcsrc/server/gamecommand.qc b/qcsrc/server/gamecommand.qc index f5b662be3..986f2dd84 100644 --- a/qcsrc/server/gamecommand.qc +++ b/qcsrc/server/gamecommand.qc @@ -596,7 +596,7 @@ void EffectIndexDump() fh = fopen("effectinfo.txt", FILE_READ); while((s = fgets(fh))) { - tokenize(s); // tokenize_console would hit the loop counter :( + tokenize_console(s); if(argv(0) == "effect") { if(db_get(d, argv(1)) != "1") diff --git a/qcsrc/server/sv_main.qc b/qcsrc/server/sv_main.qc index ce5828aff..eb386005d 100644 --- a/qcsrc/server/sv_main.qc +++ b/qcsrc/server/sv_main.qc @@ -275,7 +275,7 @@ void SV_OnEntityPreSpawnFunction() s = substring(s, 1, -1); } - n = tokenize(s); + n = tokenize_console(s); for(i = 0; i < n; ++i) { s = argv(i); -- 2.39.2