[Scummvm-cvs-logs] CVS: scummvm/common system.cpp,1.9,1.10 system.h,1.65,1.66

Max Horn fingolfin at users.sourceforge.net
Sun Mar 28 12:43:10 CEST 2004


Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31345/common

Modified Files:
	system.cpp system.h 
Log Message:
Remove explicit OSystem parameter from StackLock constructor; added OSystem::displayMessageOnOSD (not yet used; default implementation provided)

Index: system.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/system.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- system.cpp	15 Mar 2004 01:52:07 -0000	1.9
+++ system.cpp	28 Mar 2004 20:31:18 -0000	1.10
@@ -26,6 +26,8 @@
 
 #include "base/gameDetector.h"
 
+#include "gui/message.h"
+
 #include "common/config-manager.h"
 #include "common/system.h"
 
@@ -84,15 +86,20 @@
 	return false;
 }
 
+void OSystem::displayMessageOnOSD(const char *msg) {
+	// Display the message for 1.5 seconds
+	GUI::TimedMessageDialog dialog(msg, 1500);
+	dialog.runModal();
+}
+
+
 #pragma mark -
 
 
 namespace Common {
 
-StackLock::StackLock(OSystem::MutexRef mutex, OSystem *syst, const char *mutexName)
-	: _mutex(mutex), _syst(syst), _mutexName(mutexName) {
-	if (syst == 0)
-		_syst = g_system;
+StackLock::StackLock(OSystem::MutexRef mutex, const char *mutexName)
+	: _mutex(mutex), _mutexName(mutexName) {
 	lock();
 }
 
@@ -101,19 +108,17 @@
 }
 
 void StackLock::lock() {
-	assert(_syst);
 	if (_mutexName != NULL)
 		debug(6, "Locking mutex %s", _mutexName);
 	
-	_syst->lockMutex(_mutex);
+	g_system->lockMutex(_mutex);
 }
 
 void StackLock::unlock() {
-	assert(_syst);
 	if (_mutexName != NULL)
 		debug(6, "Unlocking mutex %s", _mutexName);
 
-	_syst->unlockMutex(_mutex);
+	g_system->unlockMutex(_mutex);
 }
 
 }	// End of namespace Common

Index: system.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/system.h,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- system.h	28 Mar 2004 16:30:48 -0000	1.65
+++ system.h	28 Mar 2004 20:31:18 -0000	1.66
@@ -602,12 +602,25 @@
 	virtual void quit() = 0;
 
 	/**
-	  * Set a window caption or any other comparable status display to the
-	  * given value.
-	  * @param caption	the window caption to use from now on
+	 * Set a window caption or any other comparable status display to the
+	 * given value.
+	 * @param caption	the window caption to use from now on
 	 */
 	virtual void setWindowCaption(const char *caption) {}
-	
+
+	/**
+	 * Display a message in an 'on screen display'. That is, display it in a
+	 * fashion where it is visible on or near the screen (e.g. in a transparent
+	 * rectangle over the regular screen content; or in a message box beneath
+	 * it; etc.).
+	 *
+	 * @note There is a default implementation which uses a TimedMessageDialog
+	 *       to display the message. Hence implementing this is optional.
+	 *
+	 * @param msg	the message to display on screen
+	 */
+	virtual void displayMessageOnOSD(const char *msg);
+
 	/** Savefile management. */
 	virtual SaveFileManager *get_savefile_manager() {
 		return new SaveFileManager();
@@ -626,13 +639,12 @@
  */
 class StackLock {
 	OSystem::MutexRef _mutex;
-	OSystem *_syst;
 	const char *_mutexName;
 
 	void lock();
 	void unlock();
 public:
-	StackLock(OSystem::MutexRef mutex, OSystem *syst = 0, const char *mutexName = NULL);
+	StackLock(OSystem::MutexRef mutex, const char *mutexName = NULL);
 	~StackLock();
 };
 





More information about the Scummvm-git-logs mailing list