Skip to content

Commit

Permalink
Consolidate client GTV commands into single command.
Browse files Browse the repository at this point in the history
  • Loading branch information
skullernet authored and res2k committed Jan 23, 2024
1 parent 38ffde5 commit 6cb353a
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions src/client/gtv.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,11 +569,37 @@ static void CL_GTV_Status_f(void)
NET_AdrToString(&cls.gtv.stream.address), cls.gtv.state);
}

static void CL_GTV_Cmd_g(genctx_t *ctx, int argnum)
{
if (argnum == 1) {
Prompt_AddMatch(ctx, "start");
Prompt_AddMatch(ctx, "stop");
Prompt_AddMatch(ctx, "status");
}
}

static void CL_GTV_Cmd_f(void)
{
const char *cmd = Cmd_Argv(1);

if (!strcmp(cmd, "start"))
CL_GTV_Start_f();
else if (!strcmp(cmd, "stop"))
CL_GTV_Stop_f();
else if (!strcmp(cmd, "status"))
CL_GTV_Status_f();
else
Com_Printf("Usage: %s <start|stop|status>\n", Cmd_Argv(0));
}

static const cmdreg_t c_gtv[] = {
{ "gtv", CL_GTV_Cmd_f, CL_GTV_Cmd_g },
{ NULL }
};

void CL_GTV_Init(void)
{
Cmd_AddCommand("client_gtv_start", CL_GTV_Start_f);
Cmd_AddCommand("client_gtv_stop", CL_GTV_Stop_f);
Cmd_AddCommand("client_gtv_status", CL_GTV_Status_f);
Cmd_Register(c_gtv);
}

void CL_GTV_Shutdown(void)
Expand Down

0 comments on commit 6cb353a

Please sign in to comment.