From 3ed608ba823591f983dc8068fbdfdc70b6daef20 Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Tue, 13 Apr 2021 16:31:41 +0000 Subject: [PATCH] host: Move Host_GetConsoleCommands and rename it for consistency. Add comment git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13122 d7cf8633-e32d-0410-b094-e92efae38249 --- cmd.c | 28 ++++++++++++++++++++++++++++ host.c | 28 +--------------------------- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/cmd.c b/cmd.c index 490a987e..0df09105 100644 --- a/cmd.c +++ b/cmd.c @@ -491,8 +491,34 @@ void Cbuf_Execute (cmd_buf_t *cbuf) } } +/* +=================== +Cbuf_Frame_Input + +Add them exactly as if they had been typed at the console +=================== +*/ +static void Cbuf_Frame_Input(void) +{ + char *line; + + while ((line = Sys_ConsoleInput())) + { + if (cls.state == ca_dedicated) + Cbuf_AddText(cmd_server, line); + else + Cbuf_AddText(cmd_client, line); + } +} + void Cbuf_Frame(cmd_buf_t *cbuf) { + // check for commands typed to the host + Cbuf_Frame_Input(); + +// R_TimeReport("preconsole"); + + // execute commands queued with the defer command Cbuf_Execute_Deferred(cbuf); if (cbuf->size) { @@ -500,6 +526,8 @@ void Cbuf_Frame(cmd_buf_t *cbuf) Cbuf_Execute(cbuf); SV_UnlockThreadMutex(); } + +// R_TimeReport("console"); } /* diff --git a/host.c b/host.c index eee13952..5c50ba79 100644 --- a/host.c +++ b/host.c @@ -301,26 +301,6 @@ void Host_LoadConfig_f(cmd_state_t *cmd) //============================================================================ -/* -=================== -Host_GetConsoleCommands - -Add them exactly as if they had been typed at the console -=================== -*/ -static void Host_GetConsoleCommands (void) -{ - char *line; - - while ((line = Sys_ConsoleInput())) - { - if (cls.state == ca_dedicated) - Cbuf_AddText(cmd_server, line); - else - Cbuf_AddText(cmd_client, line); - } -} - /* ================== Host_TimeReport @@ -355,18 +335,12 @@ double Host_Frame(double time) Log_DestBuffer_Flush(); + // Run any downloads Curl_Frame(); - // check for commands typed to the host - Host_GetConsoleCommands(); - -// R_TimeReport("preconsole"); - // process console commands Cbuf_Frame(host.cbuf); -// R_TimeReport("console"); - R_TimeReport("---"); sv_wait = SV_Frame(time); -- 2.39.2