src/video/win32_v.cpp
branchnoai
changeset 9723 eee46cb39750
parent 9722 ebf0ece7d8f6
child 9724 b39bc69bb2f2
--- a/src/video/win32_v.cpp	Fri Nov 23 16:59:30 2007 +0000
+++ b/src/video/win32_v.cpp	Wed Jan 09 18:11:12 2008 +0000
@@ -2,14 +2,11 @@
 
 #include "../stdafx.h"
 #include "../openttd.h"
-#include "../functions.h"
-#include "../gfx.h"
-#include "../macros.h"
-#include "../network/network.h"
+#include "../gfx_func.h"
 #include "../variables.h"
 #include "../win32.h"
-#include "../window.h"
 #include "../blitter/factory.hpp"
+#include "../network/network.h"
 #include "win32_v.h"
 #include <windows.h>
 #include <tchar.h>
@@ -213,7 +210,7 @@
 	}
 }
 
-static void MakeWindow(bool full_screen)
+static bool MakeWindow(bool full_screen)
 {
 	_fullscreen = full_screen;
 
@@ -245,8 +242,8 @@
 		settings.dmDisplayFrequency = _display_hz;
 
 		if (ChangeDisplaySettings(&settings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) {
-			MakeWindow(false);
-			return;
+			MakeWindow(false);  // don't care about the result
+			return false;  // the request failed
 		}
 	} else if (_wnd.fullscreen) {
 		// restore display?
@@ -294,6 +291,7 @@
 		}
 	}
 	GameSizeChanged(); // invalidate all windows, force redraw
+	return true; // the request succedded
 }
 
 static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -737,8 +735,8 @@
 	 * Doesn't really matter since we don't pass a string anyways, but still
 	 * a letdown */
 	for (i = 0; EnumDisplaySettingsA(NULL, i, &dm) != 0; i++) {
-		if (dm.dmBitsPerPel == BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() && IS_INT_INSIDE(dm.dmPelsWidth, 640, MAX_SCREEN_WIDTH + 1) &&
-				IS_INT_INSIDE(dm.dmPelsHeight, 480, MAX_SCREEN_HEIGHT + 1)) {
+		if (dm.dmBitsPerPel == BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() && IsInsideMM(dm.dmPelsWidth, 640, MAX_SCREEN_WIDTH + 1) &&
+				IsInsideMM(dm.dmPelsHeight, 480, MAX_SCREEN_HEIGHT + 1)) {
 			uint j;
 
 			for (j = 0; j < n; j++) {
@@ -898,12 +896,10 @@
 	_wnd.width = _wnd.width_org = w;
 	_wnd.height = _wnd.height_org = h;
 
-	MakeWindow(_fullscreen); // _wnd.fullscreen screws up ingame resolution switching
-
-	return true;
+	return MakeWindow(_fullscreen); // _wnd.fullscreen screws up ingame resolution switching
 }
 
-void VideoDriver_Win32::ToggleFullscreen(bool full_screen)
+bool VideoDriver_Win32::ToggleFullscreen(bool full_screen)
 {
-	MakeWindow(full_screen);
+	return MakeWindow(full_screen);
 }