changeset 652:da9c4cfe8f8e

* The engine now checks to make sure the selected driver is supported by the users OS.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Fri, 15 Oct 2010 15:13:10 +0000
parents 2851e232a113
children 01acc9fc35ea
files engine/core/controller/engine.cpp
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/engine/core/controller/engine.cpp	Thu Oct 14 15:52:43 2010 +0000
+++ b/engine/core/controller/engine.cpp	Fri Oct 15 15:13:10 2010 +0000
@@ -21,6 +21,7 @@
 
 // Standard C++ library includes
 #include <iostream>
+#include <algorithm>
 
 // 3rd party library includes
 #include <SDL.h>
@@ -200,7 +201,18 @@
 		}
 		FL_LOG(_log, "Initializing render backend");
 		m_renderbackend->setColorKeyEnabled(m_settings.isColorKeyEnabled());
-		m_renderbackend->init(m_settings.getVideoDriver());
+
+		std::string driver = m_settings.getVideoDriver();
+		std::vector<std::string> drivers = m_devcaps.getAvailableDrivers();
+
+		if (driver != ""){
+			if (std::find (drivers.begin(), drivers.end(), driver) == drivers.end()) {
+				FL_WARN(_log, "Selected driver is not supported for your Operating System!  Reverting to default driver.");
+				driver = "";
+			}
+		}
+
+		m_renderbackend->init(driver);
 
 		FL_LOG(_log, "Querying device capabilities");
 		m_devcaps.fillDeviceCaps();