From ed91b16f45d55a19de053244b1a8496679150409 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 23 Jan 2002 21:07:38 +0000 Subject: [PATCH] add Menu_GetIndex --- libs/console/menu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libs/console/menu.c b/libs/console/menu.c index e0fded04b..777a0ca7c 100644 --- a/libs/console/menu.c +++ b/libs/console/menu.c @@ -279,6 +279,16 @@ bi_Menu_Quit (progs_t *pr) Sys_Quit (); } +static void +bi_Menu_GetIndex (progs_t *pr) +{ + if (menu) { + G_INT (pr, OFS_RETURN) = menu->cur_item; + } else { + G_INT (pr, OFS_RETURN) = -1; + } +} + static void togglemenu_f (void) { @@ -318,6 +328,7 @@ Menu_Init (void) PR_AddBuiltin (&menu_pr_state, "Menu_SelectMenu", bi_Menu_SelectMenu, -1); PR_AddBuiltin (&menu_pr_state, "Menu_SetQuit", bi_Menu_SetQuit, -1); PR_AddBuiltin (&menu_pr_state, "Menu_Quit", bi_Menu_Quit, -1); + PR_AddBuiltin (&menu_pr_state, "Menu_GetIndex", bi_Menu_GetIndex, -1); Cbuf_Progs_Init (&menu_pr_state); File_Progs_Init (&menu_pr_state);