diff options
author | glx <glx@openttd.org> | 2008-06-05 20:54:52 +0000 |
---|---|---|
committer | glx <glx@openttd.org> | 2008-06-05 20:54:52 +0000 |
commit | ee256e770afb5f04a6a10f3b2045dd426d3167ff (patch) | |
tree | 62bef57de81c1ddcc691d5de5e8db395615bdacc /src/video | |
parent | 5176319dd5145138604dd48c44b056693d900b10 (diff) | |
download | openttd-ee256e770afb5f04a6a10f3b2045dd426d3167ff.tar.xz |
(svn r13390) -Codechange: introduce usererror() for fatal but not openttd related errors. Now all error() will 'crash' openttd after showing the message in win32 releases (MSVC), creating a crash.log and crash.dmp (like the '!' hack used before). On the other hand, usererror() will just close the game. So use error() only when it can be helpful to debugging, else use usererror().
Diffstat (limited to 'src/video')
-rw-r--r-- | src/video/dedicated_v.cpp | 4 | ||||
-rw-r--r-- | src/video/sdl_v.cpp | 4 | ||||
-rw-r--r-- | src/video/win32_v.cpp | 10 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/video/dedicated_v.cpp b/src/video/dedicated_v.cpp index 8af223e8e..1921205bb 100644 --- a/src/video/dedicated_v.cpp +++ b/src/video/dedicated_v.cpp @@ -107,10 +107,10 @@ static void CreateWindowsConsoleThread() /* Create event to signal when console input is ready */ _hInputReady = CreateEvent(NULL, false, false, NULL); _hWaitForInputHandling = CreateEvent(NULL, false, false, NULL); - if (_hInputReady == NULL || _hWaitForInputHandling == NULL) error("Cannot create console event!"); + if (_hInputReady == NULL || _hWaitForInputHandling == NULL) usererror("Cannot create console event!"); _hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)CheckForConsoleInput, NULL, 0, &dwThreadId); - if (_hThread == NULL) error("Cannot create console thread!"); + if (_hThread == NULL) usererror("Cannot create console thread!"); DEBUG(driver, 2, "Windows console thread started"); } diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp index 9872c14cf..869a53ce1 100644 --- a/src/video/sdl_v.cpp +++ b/src/video/sdl_v.cpp @@ -118,7 +118,7 @@ static void GetVideoModes() modes = SDL_CALL SDL_ListModes(NULL, SDL_SWSURFACE + (_fullscreen ? SDL_FULLSCREEN : 0)); if (modes == NULL) - error("sdl: no modes available"); + usererror("sdl: no modes available"); _all_modes = (modes == (void*)-1); @@ -198,7 +198,7 @@ static bool CreateMainSurface(int w, int h) DEBUG(driver, 1, "SDL: using mode %dx%dx%d", w, h, bpp); - if (bpp == 0) error("Can't use a blitter that blits 0 bpp for normal visuals"); + if (bpp == 0) usererror("Can't use a blitter that blits 0 bpp for normal visuals"); /* Give the application an icon */ icon = SDL_CALL SDL_LoadBMP(ICON_DIR PATHSEP "openttd.32.bmp"); diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp index f553b9916..19311bb36 100644 --- a/src/video/win32_v.cpp +++ b/src/video/win32_v.cpp @@ -59,7 +59,7 @@ static void MakePalette() } _wnd.gdi_palette = CreatePalette(pal); - if (_wnd.gdi_palette == NULL) error("CreatePalette failed!\n"); + if (_wnd.gdi_palette == NULL) usererror("CreatePalette failed!\n"); } static void UpdatePalette(HDC dc, uint start, uint count) @@ -292,7 +292,7 @@ static bool MakeWindow(bool full_screen) _sntprintf(Windowtitle, sizeof(Windowtitle), _T("OpenTTD %s"), MB_TO_WIDE(_openttd_revision)); _wnd.main_wnd = CreateWindow(_T("OTTD"), Windowtitle, style, x, y, w, h, 0, 0, GetModuleHandle(NULL), 0); - if (_wnd.main_wnd == NULL) error("CreateWindow failed"); + if (_wnd.main_wnd == NULL) usererror("CreateWindow failed"); ShowWindow(_wnd.main_wnd, showstyle); } } @@ -671,7 +671,7 @@ static void RegisterWndClass() }; registered = true; - if (!RegisterClass(&wnd)) error("RegisterClass failed"); + if (!RegisterClass(&wnd)) usererror("RegisterClass failed"); } } @@ -684,7 +684,7 @@ static bool AllocateDibSection(int w, int h) w = max(w, 64); h = max(h, 64); - if (bpp == 0) error("Can't use a blitter that blits 0 bpp for normal visuals"); + if (bpp == 0) usererror("Can't use a blitter that blits 0 bpp for normal visuals"); if (w == _screen.width && h == _screen.height) return false; @@ -707,7 +707,7 @@ static bool AllocateDibSection(int w, int h) dc = GetDC(0); _wnd.dib_sect = CreateDIBSection(dc, bi, DIB_RGB_COLORS, (VOID**)&_wnd.buffer_bits, NULL, 0); - if (_wnd.dib_sect == NULL) error("CreateDIBSection failed"); + if (_wnd.dib_sect == NULL) usererror("CreateDIBSection failed"); ReleaseDC(0, dc); return true; |