diff --git a/source/src/menus.cpp b/source/src/menus.cpp index fcd776cd..2b2cd959 100644 --- a/source/src/menus.cpp +++ b/source/src/menus.cpp @@ -939,6 +939,7 @@ void menuinitselection(int *line) { if(!lastmenu) return; if(lastmenu->items.inrange(*line)) lastmenu->menusel = *line; + else lastmenu->menuselinit = *line; } COMMAND(menuinitselection, "i"); @@ -1316,6 +1317,7 @@ void gmenu::open() execute(initaction); lastmenu = oldlastmenu; } + if(items.inrange(menuselinit)) { menusel = menuselinit; menuselinit = -1; } if(items.inrange(menusel)) items[menusel]->focus(true); init(); resetcontext(); diff --git a/source/src/protos.h b/source/src/protos.h index 1cb7d9f2..098b94a1 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -224,7 +224,7 @@ struct gmenu const char *name, *title, *header, *footer; vector items; int mwidth; - int menusel; + int menusel, menuselinit; bool allowinput, inited, hotkeys, forwardkeys; void (__cdecl *refreshfunc)(void *, bool); bool (__cdecl *keyfunc)(void *, int, bool, int); @@ -239,7 +239,7 @@ struct gmenu char *previewtexture, *previewtexturetitle; mdirlist *dirlist; - gmenu() : name(0), title(0), header(0), footer(0), initaction(0), usefont(0), allowblink(false), persistentselection(false), mdl(0), footlen(0), xoffs(0), yoffs(0), previewtexture(NULL), previewtexturetitle(NULL), dirlist(0) {} + gmenu() : name(0), title(0), header(0), footer(0), menuselinit(-1), initaction(0), usefont(0), allowblink(false), persistentselection(false), mdl(0), footlen(0), xoffs(0), yoffs(0), previewtexture(NULL), previewtexturetitle(NULL), dirlist(0) {} virtual ~gmenu() { DELETEA(name);