If there's a messagebox to show on exit, and we *were* in fullscreen, don't try to toggle fullscreen and crash

This commit is contained in:
Chris Taylor 2013-01-12 19:07:57 +08:00
parent fc1108e7b6
commit 1eb70135fe
4 changed files with 10 additions and 5 deletions

View file

@ -4,6 +4,7 @@ D1X-Rebirth Changelog
--------
arch/carbon/conf.h: Used new D1XMAJORi / D1XMINORi / D1XMICROi version constants for Mac
main/inferno.h, main/mission.c, main/mission.h: Increased the maximum number of levels and secret levels per mission to 127 each, using MALLOC'd arrays; defined 'd_fname' type (mainly for my pointers to arrays of 13 character filenames, but could be convenient elsewhere)
arch/carbon/messagebox.c, arch/win32/messagebox.c: If there's a messagebox to show on exit, and we *were* in fullscreen, don't try to toggle fullscreen and crash
20130108
--------

View file

@ -29,7 +29,7 @@ void display_mac_alert(char *message, int error)
if ((wind = window_get_front()))
WINDOW_SEND_EVENT(wind, EVENT_WINDOW_DEACTIVATED);
if ((fullscreen = gr_check_fullscreen()))
if (grd_curscreen && (fullscreen = gr_check_fullscreen()))
gr_toggle_fullscreen();
osX = ( Gestalt(gestaltSystemVersion, (long *) &response) == noErr)
@ -76,7 +76,7 @@ void display_mac_alert(char *message, int error)
if ((wind = window_get_front()))
WINDOW_SEND_EVENT(wind, EVENT_WINDOW_ACTIVATED);
if (!error && fullscreen)
if (grd_curscreen && !error && fullscreen)
gr_toggle_fullscreen();
}

View file

@ -15,18 +15,22 @@ void display_win32_alert(char *message, int error)
{
d_event event;
window *wind;
int fullscreen;
// Handle Descent's windows properly
if ((wind = window_get_front()))
WINDOW_SEND_EVENT(wind, EVENT_WINDOW_DEACTIVATED);
if (gr_check_fullscreen())
if (grd_curscreen && (fullscreen = gr_check_fullscreen()))
gr_toggle_fullscreen();
MessageBox(NULL, message, error?"Sorry, a critical error has occurred.":"Attention!", error?MB_OK|MB_ICONERROR:MB_OK|MB_ICONWARNING);
if ((wind = window_get_front()))
WINDOW_SEND_EVENT(wind, EVENT_WINDOW_ACTIVATED);
if (grd_curscreen && !error && fullscreen)
gr_toggle_fullscreen();
}
void msgbox_warning(char *message)

View file

@ -25,8 +25,8 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "inferno.h"
#define MAX_MISSIONS 5000 // ZICO - changed from 300 to get more levels in list
#define MAX_LEVELS_PER_MISSION 127 // KREATOR - increased from 30 (e.g. Total Domain has 57)
#define MAX_SECRET_LEVELS_PER_MISSION 127 // KREATOR - increased from 6
#define MAX_LEVELS_PER_MISSION 127 // KREATOR - increased from 30 (limited by Demo and Multiplayer code)
#define MAX_SECRET_LEVELS_PER_MISSION 127 // KREATOR - increased from 6 (limited by Demo and Multiplayer code)
#define MISSION_NAME_LEN 25
#define D1_MISSION_FILENAME ""