Codechange: replace error/usererror printf variant with fmt variant and rename
This commit is contained in:
		| @@ -16,6 +16,7 @@ | ||||
|  | ||||
| #include "../stdafx.h" | ||||
| #include "../openttd.h" | ||||
| #include "../error_func.h" | ||||
| #include "../gfx_func.h" | ||||
| #include "../rev.h" | ||||
| #include "../blitter/factory.hpp" | ||||
| @@ -186,7 +187,7 @@ static void GetAvailableVideoMode(uint *w, uint *h) | ||||
| static bool CreateMainSurface(uint w, uint h) | ||||
| { | ||||
| 	int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth(); | ||||
| 	if (bpp == 0) usererror("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"); | ||||
| 	set_color_depth(bpp); | ||||
|  | ||||
| 	GetAvailableVideoMode(&w, &h); | ||||
|   | ||||
| @@ -27,6 +27,7 @@ | ||||
|  | ||||
| #include "../../openttd.h" | ||||
| #include "../../debug.h" | ||||
| #include "../../error_func.h" | ||||
| #include "../../core/geometry_func.hpp" | ||||
| #include "../../core/math_func.hpp" | ||||
| #include "cocoa_v.h" | ||||
| @@ -447,7 +448,7 @@ bool VideoDriver_Cocoa::MakeWindow(int width, int height) | ||||
| 	CGColorSpaceRelease(this->color_space); | ||||
| 	this->color_space = CGColorSpaceCreateWithName(kCGColorSpaceSRGB); | ||||
| 	if (this->color_space == nullptr) this->color_space = CGColorSpaceCreateDeviceRGB(); | ||||
| 	if (this->color_space == nullptr) error("Could not get a valid colour space for drawing."); | ||||
| 	if (this->color_space == nullptr) FatalError("Could not get a valid colour space for drawing."); | ||||
|  | ||||
| 	this->setup = false; | ||||
|  | ||||
| @@ -679,7 +680,7 @@ void VideoDriver_CocoaQuartz::AllocateBackingStore(bool force) | ||||
| 	if (this->buffer_depth == 8) { | ||||
| 		free(this->pixel_buffer); | ||||
| 		this->pixel_buffer = malloc(this->window_width * this->window_height); | ||||
| 		if (this->pixel_buffer == nullptr) usererror("Out of memory allocating pixel buffer"); | ||||
| 		if (this->pixel_buffer == nullptr) UserError("Out of memory allocating pixel buffer"); | ||||
| 	} else { | ||||
| 		free(this->pixel_buffer); | ||||
| 		this->pixel_buffer = nullptr; | ||||
|   | ||||
| @@ -10,6 +10,7 @@ | ||||
| #include "../stdafx.h" | ||||
|  | ||||
| #include "../gfx_func.h" | ||||
| #include "../error_func.h" | ||||
| #include "../network/network.h" | ||||
| #include "../network/network_internal.h" | ||||
| #include "../console_func.h" | ||||
| @@ -103,10 +104,10 @@ static void CreateWindowsConsoleThread() | ||||
| 	/* Create event to signal when console input is ready */ | ||||
| 	_hInputReady = CreateEvent(nullptr, false, false, nullptr); | ||||
| 	_hWaitForInputHandling = CreateEvent(nullptr, false, false, nullptr); | ||||
| 	if (_hInputReady == nullptr || _hWaitForInputHandling == nullptr) usererror("Cannot create console event!"); | ||||
| 	if (_hInputReady == nullptr || _hWaitForInputHandling == nullptr) UserError("Cannot create console event!"); | ||||
|  | ||||
| 	_hThread = CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)CheckForConsoleInput, nullptr, 0, &dwThreadId); | ||||
| 	if (_hThread == nullptr) usererror("Cannot create console thread!"); | ||||
| 	if (_hThread == nullptr) UserError("Cannot create console thread!"); | ||||
|  | ||||
| 	Debug(driver, 2, "Windows console thread started"); | ||||
| } | ||||
|   | ||||
| @@ -9,6 +9,7 @@ | ||||
|  | ||||
| #include "../stdafx.h" | ||||
| #include "../openttd.h" | ||||
| #include "../error_func.h" | ||||
| #include "../gfx_func.h" | ||||
| #include "../rev.h" | ||||
| #include "../blitter/factory.hpp" | ||||
| @@ -59,7 +60,7 @@ void VideoDriver_SDL_Default::MakePalette() | ||||
| { | ||||
| 	if (_sdl_palette == nullptr) { | ||||
| 		_sdl_palette = SDL_AllocPalette(256); | ||||
| 		if (_sdl_palette == nullptr) usererror("SDL2: Couldn't allocate palette: %s", SDL_GetError()); | ||||
| 		if (_sdl_palette == nullptr) UserError("SDL2: Couldn't allocate palette: {}", SDL_GetError()); | ||||
| 	} | ||||
|  | ||||
| 	CopyPalette(this->local_palette, true); | ||||
| @@ -133,7 +134,7 @@ bool VideoDriver_SDL_Default::AllocateBackingStore(int w, int h, bool force) | ||||
| 	int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth(); | ||||
|  | ||||
| 	_sdl_real_surface = SDL_GetWindowSurface(this->sdl_window); | ||||
| 	if (_sdl_real_surface == nullptr) usererror("SDL2: Couldn't get window surface: %s", SDL_GetError()); | ||||
| 	if (_sdl_real_surface == nullptr) UserError("SDL2: Couldn't get window surface: {}", SDL_GetError()); | ||||
|  | ||||
| 	if (!force && w == _sdl_real_surface->w && h == _sdl_real_surface->h) return false; | ||||
|  | ||||
| @@ -145,7 +146,7 @@ bool VideoDriver_SDL_Default::AllocateBackingStore(int w, int h, bool force) | ||||
|  | ||||
| 	if (bpp == 8) { | ||||
| 		_sdl_rgb_surface = SDL_CreateRGBSurface(0, w, h, 8, 0, 0, 0, 0); | ||||
| 		if (_sdl_rgb_surface == nullptr) usererror("SDL2: Couldn't allocate shadow surface: %s", SDL_GetError()); | ||||
| 		if (_sdl_rgb_surface == nullptr) UserError("SDL2: Couldn't allocate shadow surface: {}", SDL_GetError()); | ||||
|  | ||||
| 		_sdl_surface = _sdl_rgb_surface; | ||||
| 	} else { | ||||
|   | ||||
| @@ -11,6 +11,7 @@ | ||||
|  | ||||
| #include "../stdafx.h" | ||||
| #include "../openttd.h" | ||||
| #include "../error_func.h" | ||||
| #include "../gfx_func.h" | ||||
| #include "../rev.h" | ||||
| #include "../blitter/factory.hpp" | ||||
| @@ -176,7 +177,7 @@ static const Dimension _default_resolutions[] = { | ||||
| static void GetVideoModes() | ||||
| { | ||||
| 	SDL_Rect **modes = SDL_ListModes(nullptr, SDL_SWSURFACE | SDL_FULLSCREEN); | ||||
| 	if (modes == nullptr) usererror("sdl: no modes available"); | ||||
| 	if (modes == nullptr) UserError("sdl: no modes available"); | ||||
|  | ||||
| 	_resolutions.clear(); | ||||
|  | ||||
| @@ -195,7 +196,7 @@ static void GetVideoModes() | ||||
| 			if (std::find(_resolutions.begin(), _resolutions.end(), Dimension(w, h)) != _resolutions.end()) continue; | ||||
| 			_resolutions.emplace_back(w, h); | ||||
| 		} | ||||
| 		if (_resolutions.empty()) usererror("No usable screen resolutions found!\n"); | ||||
| 		if (_resolutions.empty()) UserError("No usable screen resolutions found!\n"); | ||||
| 		SortResolutions(); | ||||
| 	} | ||||
| } | ||||
| @@ -233,7 +234,7 @@ bool VideoDriver_SDL::CreateMainSurface(uint w, uint h) | ||||
|  | ||||
| 	Debug(driver, 1, "SDL: using mode {}x{}x{}", w, h, bpp); | ||||
|  | ||||
| 	if (bpp == 0) usererror("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"); | ||||
|  | ||||
| 	std::string icon_path = FioFindFullPath(BASESET_DIR, "openttd.32.bmp"); | ||||
| 	if (!icon_path.empty()) { | ||||
|   | ||||
| @@ -9,6 +9,7 @@ | ||||
|  | ||||
| #include "../stdafx.h" | ||||
| #include "../openttd.h" | ||||
| #include "../error_func.h" | ||||
| #include "../gfx_func.h" | ||||
| #include "../os/windows/win32.h" | ||||
| #include "../rev.h" | ||||
| @@ -219,7 +220,7 @@ bool VideoDriver_Win32Base::MakeWindow(bool full_screen, bool resize) | ||||
| 			seprintf(window_title, lastof(window_title), "OpenTTD %s", _openttd_revision); | ||||
|  | ||||
| 			this->main_wnd = CreateWindow(L"OTTD", OTTD2FS(window_title).c_str(), style, x, y, w, h, 0, 0, GetModuleHandle(nullptr), this); | ||||
| 			if (this->main_wnd == nullptr) usererror("CreateWindow failed"); | ||||
| 			if (this->main_wnd == nullptr) UserError("CreateWindow failed"); | ||||
| 			ShowWindow(this->main_wnd, showstyle); | ||||
| 		} | ||||
| 	} | ||||
| @@ -768,7 +769,7 @@ static void RegisterWndClass() | ||||
| 	}; | ||||
|  | ||||
| 	registered = true; | ||||
| 	if (!RegisterClass(&wnd)) usererror("RegisterClass failed"); | ||||
| 	if (!RegisterClass(&wnd)) UserError("RegisterClass failed"); | ||||
| } | ||||
|  | ||||
| static const Dimension default_resolutions[] = { | ||||
| @@ -1072,7 +1073,7 @@ bool VideoDriver_Win32GDI::AllocateBackingStore(int w, int h, bool force) | ||||
| 	this->dib_sect = CreateDIBSection(dc, bi, DIB_RGB_COLORS, (VOID **)&this->buffer_bits, nullptr, 0); | ||||
| 	if (this->dib_sect == nullptr) { | ||||
| 		delete[] bi; | ||||
| 		usererror("CreateDIBSection failed"); | ||||
| 		UserError("CreateDIBSection failed"); | ||||
| 	} | ||||
| 	ReleaseDC(0, dc); | ||||
|  | ||||
| @@ -1109,7 +1110,7 @@ void VideoDriver_Win32GDI::MakePalette() | ||||
| 	} | ||||
| 	this->gdi_palette = CreatePalette(pal); | ||||
| 	delete[] pal; | ||||
| 	if (this->gdi_palette == nullptr) usererror("CreatePalette failed!\n"); | ||||
| 	if (this->gdi_palette == nullptr) UserError("CreatePalette failed!\n"); | ||||
| } | ||||
|  | ||||
| void VideoDriver_Win32GDI::UpdatePalette(HDC dc, uint start, uint count) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Rubidium
					Rubidium