[Scummvm-cvs-logs] SF.net SVN: scummvm: [29745] scummvm/trunk/engines/lure

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Fri Dec 7 11:17:58 CET 2007


Revision: 29745
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29745&view=rev
Author:   dreammaster
Date:     2007-12-07 02:17:58 -0800 (Fri, 07 Dec 2007)

Log Message:
-----------
Changed startup error messages to use a modal GUI dialog

Modified Paths:
--------------
    scummvm/trunk/engines/lure/lure.cpp
    scummvm/trunk/engines/lure/lure.h

Modified: scummvm/trunk/engines/lure/lure.cpp
===================================================================
--- scummvm/trunk/engines/lure/lure.cpp	2007-12-07 09:53:17 UTC (rev 29744)
+++ scummvm/trunk/engines/lure/lure.cpp	2007-12-07 10:17:58 UTC (rev 29745)
@@ -62,24 +62,24 @@
 	int_engine = this;
 
 	_system->beginGFXTransaction();
-		initCommonGFX(false);
-		_system->initSize(FULL_SCREEN_WIDTH, FULL_SCREEN_HEIGHT);
+	initCommonGFX(false);
+	_system->initSize(FULL_SCREEN_WIDTH, FULL_SCREEN_HEIGHT);
 	_system->endGFXTransaction();
 
 	// Check the version of the lure.dat file
 	Common::File f;
-		VersionStructure version;
-	if (!f.open(SUPPORT_FILENAME)) 
-		error("Error opening %s for validation", SUPPORT_FILENAME);
+	VersionStructure version;
+	if (!f.open(SUPPORT_FILENAME))  
+		GUIError("Could not locate Lure support file");
 	
 	f.seek(0xbf * 8);
 	f.read(&version, sizeof(VersionStructure));
 	f.close();
 
 	if (READ_LE_UINT16(&version.id) != 0xffff)
-		error("Error validating %s - file is invalid or out of date", SUPPORT_FILENAME);
+		GUIError("Error validating %s - file is invalid or out of date", SUPPORT_FILENAME);
 	else if ((version.vMajor != LURE_DAT_MAJOR) || (version.vMinor != LURE_DAT_MINOR))
-		error("Incorrect version of %s file - expected %d.%d but got %d.%d",
+		GUIError("Incorrect version of %s file - expected %d.%d but got %d.%d",
 			SUPPORT_FILENAME, LURE_DAT_MAJOR, LURE_DAT_MINOR, 
 			version.vMajor, version.vMinor);
 
@@ -229,6 +229,19 @@
 	return true;
 }
 
+void LureEngine::GUIError(const char *msg, ...) {
+	char buffer[STRINGBUFLEN];
+	va_list va;
+
+	// Generate the full error message
+	va_start(va, msg);
+	vsnprintf(buffer, STRINGBUFLEN, msg, va);
+	va_end(va);	
+
+	Engine::GUIErrorMessage(buffer);
+	exit(1);
+}
+
 Common::String *LureEngine::detectSave(int slotNumber) {
 	Common::ReadStream *f = this->_saveFileMan->openForLoading(
 		generateSaveName(slotNumber));

Modified: scummvm/trunk/engines/lure/lure.h
===================================================================
--- scummvm/trunk/engines/lure/lure.h	2007-12-07 09:53:17 UTC (rev 29744)
+++ scummvm/trunk/engines/lure/lure.h	2007-12-07 10:17:58 UTC (rev 29745)
@@ -76,6 +76,7 @@
 	bool saveGame(uint8 slotNumber, Common::String &caption);
 	Common::String *detectSave(int slotNumber);
 	uint8 saveVersion() { return _saveVersion; }
+	void GUIError(const char *msg, ...);
 
 	uint32 getFeatures() const;
 	Common::Language getLanguage() const;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list