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

This commit is contained in:
kreatordxx 2010-03-27 03:24:14 +00:00
parent 94e8a83bb4
commit 8ca12ad562
3 changed files with 11 additions and 2 deletions

View file

@ -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
--------

View file

@ -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;

View file

@ -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