[Scummvm-cvs-logs] SF.net SVN: scummvm: [30024] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Fri Dec 28 01:20:56 CET 2007


Revision: 30024
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30024&view=rev
Author:   lordhoto
Date:     2007-12-27 16:20:56 -0800 (Thu, 27 Dec 2007)

Log Message:
-----------
Fixes compiling on msvc7.1, it seems like it has problems to decide when to use operator bool.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/screen.cpp
    scummvm/trunk/engines/kyra/script.cpp
    scummvm/trunk/engines/kyra/timer.cpp
    scummvm/trunk/engines/kyra/util.h

Modified: scummvm/trunk/engines/kyra/screen.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen.cpp	2007-12-28 00:18:06 UTC (rev 30023)
+++ scummvm/trunk/engines/kyra/screen.cpp	2007-12-28 00:20:56 UTC (rev 30024)
@@ -448,7 +448,7 @@
 			break;
 
 		setScreenPalette(fadePal);
-		if (upFunc && *upFunc)
+		if (upFunc && upFunc->isValid())
 			(*upFunc)();
 		else
 			_system->updateScreen();
@@ -459,7 +459,7 @@
 
 	if (_vm->quit()) {
 		setScreenPalette(palData);
-		if (upFunc && *upFunc)
+		if (upFunc && upFunc->isValid())
 			(*upFunc)();
 		else
 			_system->updateScreen();

Modified: scummvm/trunk/engines/kyra/script.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script.cpp	2007-12-28 00:18:06 UTC (rev 30023)
+++ scummvm/trunk/engines/kyra/script.cpp	2007-12-28 00:20:56 UTC (rev 30024)
@@ -381,7 +381,7 @@
 	assert(script->dataPtr->opcodes);
 	assert(opcode < script->dataPtr->opcodes->size());
 
-	if ((*script->dataPtr->opcodes)[opcode] && (bool) *(*script->dataPtr->opcodes)[opcode]) {
+	if ((*script->dataPtr->opcodes)[opcode] && ((*script->dataPtr->opcodes)[opcode])->isValid()) {
 		script->retValue = (*(*script->dataPtr->opcodes)[opcode])(script);
 	} else {
 		script->retValue = 0;

Modified: scummvm/trunk/engines/kyra/timer.cpp
===================================================================
--- scummvm/trunk/engines/kyra/timer.cpp	2007-12-28 00:18:06 UTC (rev 30023)
+++ scummvm/trunk/engines/kyra/timer.cpp	2007-12-28 00:20:56 UTC (rev 30024)
@@ -100,7 +100,7 @@
 
 	for (Iterator pos = _timers.begin(); pos != _timers.end(); ++pos) {
 		if (pos->enabled && pos->countdown >= 0 && pos->nextRun <= _system->getMillis()) {
-			if (pos->func && *pos->func)
+			if (pos->func && pos->func->isValid())
 				(*pos->func)(pos->id);
 
 			uint32 curTime = _system->getMillis();

Modified: scummvm/trunk/engines/kyra/util.h
===================================================================
--- scummvm/trunk/engines/kyra/util.h	2007-12-28 00:18:06 UTC (rev 30023)
+++ scummvm/trunk/engines/kyra/util.h	2007-12-28 00:20:56 UTC (rev 30024)
@@ -34,7 +34,7 @@
 struct Functor0 {
 	virtual ~Functor0() {}
 
-	virtual operator bool() const = 0;
+	virtual bool isValid() const = 0;
 	virtual Res operator()() const = 0;
 };
 
@@ -45,7 +45,7 @@
 	
 	Functor0Mem(T *t, const FuncType &func) : _t(t), _func(func) {}
 	
-	operator bool() const { return _func != 0; }
+	bool isValid() const { return _func != 0; }
 	Res operator()() const {
 		return (_t->*_func)();
 	}
@@ -58,7 +58,7 @@
 struct Functor1 : public Common::UnaryFunction<Arg, Res> {
 	virtual ~Functor1() {}
 
-	virtual operator bool() const = 0;
+	virtual bool isValid() const = 0;
 	virtual Res operator()(Arg) const = 0;
 };
 
@@ -69,7 +69,7 @@
 	
 	Functor1Mem(T *t, const FuncType &func) : _t(t), _func(func) {}
 	
-	operator bool() const { return _func != 0; }
+	bool isValid() const { return _func != 0; }
 	Res operator()(Arg v1) const {
 		return (_t->*_func)(v1);
 	}


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