diff options
author | Johannes Schickel | 2007-12-28 00:20:56 +0000 |
---|---|---|
committer | Johannes Schickel | 2007-12-28 00:20:56 +0000 |
commit | 244987b7185fe3f2143670efe4ebf628a5832b21 (patch) | |
tree | eb4256a7a90a8ed7b0db43874bdf5e9448554aa8 | |
parent | 8f540e9b672b5fea582eaa08c4d1159993d0873d (diff) | |
download | scummvm-rg350-244987b7185fe3f2143670efe4ebf628a5832b21.tar.gz scummvm-rg350-244987b7185fe3f2143670efe4ebf628a5832b21.tar.bz2 scummvm-rg350-244987b7185fe3f2143670efe4ebf628a5832b21.zip |
Fixes compiling on msvc7.1, it seems like it has problems to decide when to use operator bool.
svn-id: r30024
-rw-r--r-- | engines/kyra/screen.cpp | 4 | ||||
-rw-r--r-- | engines/kyra/script.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/timer.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/util.h | 8 |
4 files changed, 8 insertions, 8 deletions
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 19e95ebe62..70107e92ef 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -448,7 +448,7 @@ void Screen::fadePalette(const uint8 *palData, int delay, const UpdateFunctor *u break; setScreenPalette(fadePal); - if (upFunc && *upFunc) + if (upFunc && upFunc->isValid()) (*upFunc)(); else _system->updateScreen(); @@ -459,7 +459,7 @@ void Screen::fadePalette(const uint8 *palData, int delay, const UpdateFunctor *u if (_vm->quit()) { setScreenPalette(palData); - if (upFunc && *upFunc) + if (upFunc && upFunc->isValid()) (*upFunc)(); else _system->updateScreen(); diff --git a/engines/kyra/script.cpp b/engines/kyra/script.cpp index 25f1d2331d..47c6391231 100644 --- a/engines/kyra/script.cpp +++ b/engines/kyra/script.cpp @@ -381,7 +381,7 @@ void ScriptHelper::cmd_execOpcode(ScriptState* script) { 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; diff --git a/engines/kyra/timer.cpp b/engines/kyra/timer.cpp index 458b6fc8b0..7c16d27d22 100644 --- a/engines/kyra/timer.cpp +++ b/engines/kyra/timer.cpp @@ -100,7 +100,7 @@ void TimerManager::update() { 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(); diff --git a/engines/kyra/util.h b/engines/kyra/util.h index eaa2ce2412..072f4996f1 100644 --- a/engines/kyra/util.h +++ b/engines/kyra/util.h @@ -34,7 +34,7 @@ template<class Res> struct Functor0 { virtual ~Functor0() {} - virtual operator bool() const = 0; + virtual bool isValid() const = 0; virtual Res operator()() const = 0; }; @@ -45,7 +45,7 @@ public: 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 @@ template<class Arg, class Res> 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 @@ public: 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); } |