void fatal(const char *s, ...) // failure exit { static int errors = 0; errors++; if(errors <= 2) // print up to one extra recursive error { defvformatstring(msg,s,s); logoutf("%s", msg); if(errors <= 1) // avoid recursion { if(SDL_WasInit(SDL_INIT_VIDEO)) { SDL_ShowCursor(1); SDL_WM_GrabInput(SDL_GRAB_OFF); cleargamma(); } #ifdef WIN32 MessageBox(NULL, msg, "Cube 2: Sauerbraten fatal error", MB_OK|MB_SYSTEMMODAL); #endif SDL_Quit(); } } exit(EXIT_FAILURE); }
void fatal(const char *s, ...) // failure exit { if(++errors <= 2) // print up to one extra recursive error { defvformatbigstring(msg, s, s); if(logfile) logoutf("%s", msg); #ifndef WIN32 fprintf(stderr, "%s\n", msg); #endif if(errors <= 1) // avoid recursion { if(SDL_WasInit(SDL_INIT_VIDEO)) { showcursor(true); SDL_WM_GrabInput(SDL_GRAB_OFF); cleargamma(); } #ifdef WIN32 defformatstring(cap, "%s: Error", VERSION_NAME); MessageBox(NULL, msg, cap, MB_OK|MB_SYSTEMMODAL); #endif SDL_Quit(); } } exit(EXIT_FAILURE); }
/// failure crash void fatal(const char *s, ...) { static int errors = 0; errors++; if(errors <= 2) /// print up to one extra recursive error { defvformatstring(msg,s,s); logoutf("%s", msg); if(errors <= 1) /// avoid recursion { if(SDL_WasInit(SDL_INIT_VIDEO)) { /// free SDL context if(screen) SDL_SetWindowGrab(screen, SDL_FALSE); SDL_SetRelativeMouseMode(SDL_FALSE); SDL_ShowCursor(SDL_TRUE); cleargamma(); } #ifdef WIN32 MessageBox(NULL, msg, "Inexor fatal error", MB_OK|MB_SYSTEMMODAL); #endif SDL_Quit(); } } exit(EXIT_FAILURE); }
/// cleans up game memory and SDL at exit void cleanup() { extern void clear_command(); extern void clear_console(); extern void clear_mdls(); extern void clear_sound(); recorder::stop(); cleanupserver(); /// "Use this function to set a window's input grab mode." /// https://wiki.libsdl.org/SDL_SetWindowGrab if(screen) SDL_SetWindowGrab(screen, SDL_FALSE); /// "Use this function to set relative mouse mode." /// https://wiki.libsdl.org/SDL_SetRelativeMouseMode SDL_SetRelativeMouseMode(SDL_FALSE); /// "Use this function to toggle whether or not the cursor is shown." /// https://wiki.libsdl.org/SDL_ShowCursor SDL_ShowCursor(SDL_TRUE); cleargamma(); /// free octree memory freeocta(worldroot); clear_command(); clear_console(); clear_mdls(); clear_sound(); closelogfile(); /// "Use this function to clean up all initialized subsystems. You should call it upon all exit conditions." /// https://wiki.libsdl.org/SDL_Quit SDL_Quit(); }
void cleanup() { recorder::stop(); cleanupserver(); SDL_ShowCursor(1); SDL_WM_GrabInput(SDL_GRAB_OFF); cleargamma(); freeocta(worldroot); extern void clear_command(); clear_command(); extern void clear_console(); clear_console(); extern void clear_mdls(); clear_mdls(); extern void clear_sound(); clear_sound(); closelogfile(); SDL_Quit(); }
void cleanup() { holdscreenlock; recorder::stop(); cleanupserver(); if(screen) SDL_SetWindowGrab(screen, SDL_FALSE); SDL_SetRelativeMouseMode(SDL_FALSE); SDL_ShowCursor(SDL_TRUE); cleargamma(); freeocta(worldroot); extern void clear_command(); clear_command(); extern void clear_console(); clear_console(); extern void clear_mdls(); clear_mdls(); extern void clear_sound(); clear_sound(); closelogfile(); SDL_Quit(); }
void cleanup() { recorder::stop(); cleanupserver(); showcursor(true); //#ifdef FAKESHOWCURSOR // if(scursor) SDL_FreeCursor(scursor); // scursor = ncursor = NULL; //#endif SDL_WM_GrabInput(SDL_GRAB_OFF); cleargamma(); freeocta(worldroot); extern void clear_command(); clear_command(); extern void clear_console(); clear_console(); extern void clear_mdls(); clear_mdls(); stopsound(); closelogfile(); SDL_Quit(); }