diff --git a/CHANGELOG.txt b/CHANGELOG.txt index aeacd679d..26d87f578 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,7 @@ D2X-Rebirth Changelog 20100327 -------- main/kmatrix.c, main/net_udp.c: Initialise 'playing' to 0 for UDP kmatrix, making sure player progresses to next level; always return 1 when starting to join a UDP game so it doesn't immediately return to the main menu +main/gameseq.c, main/menu.c: Hide mission dialog before the level intro screens are shown, make sure it doesn't try to show it again after it was closed - fixing bad memory access 20100326 -------- diff --git a/main/gameseq.c b/main/gameseq.c index e4d1345f3..cf65d36e1 100644 --- a/main/gameseq.c +++ b/main/gameseq.c @@ -1832,6 +1832,8 @@ void maybe_set_first_secret_visit(int level_num) // secret_flag if came from a secret level void StartNewLevel(int level_num, int secret_flag) { + hide_menus(); + GameTime = FrameTime; ThisLevelTime=0; diff --git a/main/menu.c b/main/menu.c index e1091cefd..128f1910c 100644 --- a/main/menu.c +++ b/main/menu.c @@ -116,7 +116,7 @@ enum MENUS #define ADD_ITEM(t,value,key) do { m[num_options].type=NM_TYPE_MENU; m[num_options].text=t; menu_choice[num_options]=value;num_options++; } while (0) -static window *menus[16]; +static window *menus[16] = { NULL }; // Function Prototypes added after LINTING void do_option(int select); @@ -133,6 +133,9 @@ void hide_menus(void) window *wind; int i; + if (menus[i]) + return; // there are already hidden menus + for (i = 0; (i < 15) && (wind = window_get_front()); i++) { menus[i] = wind; @@ -150,7 +153,10 @@ void show_menus(void) int i; for (i = 0; (i < 16) && menus[i]; i++) - window_set_visible(menus[i], 1); + if (window_exists(menus[i])) + window_set_visible(menus[i], 1); + + menus[0] = NULL; } //pairs of chars describing ranges