From 2a80bd0678c29787dd9959cf66842f2e0483327e Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Sun, 13 Jul 2008 03:39:42 +0000 Subject: Cleanup and improved debugging output for CommandExec::run() svn-id: r33022 --- engines/parallaction/exec_ns.cpp | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp index 4ee0aca6c1..d1cfb14557 100644 --- a/engines/parallaction/exec_ns.cpp +++ b/engines/parallaction/exec_ns.cpp @@ -418,28 +418,38 @@ label1: void CommandExec::run(CommandList& list, ZonePtr z) { - if (list.size() == 0) + if (list.size() == 0) { + debugC(3, kDebugExec, "runCommands: nothing to do"); return; + } + + debugC(3, kDebugExec, "runCommands starting"); - debugC(3, kDebugExec, "runCommands"); + uint32 useFlags = 0; + bool useLocalFlags; CommandList::iterator it = list.begin(); for ( ; it != list.end(); it++) { - - CommandPtr cmd = *it; - uint32 v8 = _vm->getLocationFlags(); - if (_engineFlags & kEngineQuit) break; + CommandPtr cmd = *it; + if (cmd->_flagsOn & kFlagsGlobal) { - v8 = _commandFlags | kFlagsGlobal; + useFlags = _commandFlags | kFlagsGlobal; + useLocalFlags = false; + } else { + useFlags = _vm->getLocationFlags(); + useLocalFlags = true; } - debugC(3, kDebugExec, "runCommands[%i] (on: %x, off: %x)", cmd->_id, cmd->_flagsOn, cmd->_flagsOff); + bool onMatch = (cmd->_flagsOn & useFlags) == cmd->_flagsOn; + bool offMatch = (cmd->_flagsOff & ~useFlags) == cmd->_flagsOff; + + debugC(3, kDebugExec, "runCommands[%i] (on: %x, off: %x), (%s = %x)", cmd->_id, cmd->_flagsOn, cmd->_flagsOff, + useLocalFlags ? "LOCALFLAGS" : "GLOBALFLAGS", useFlags); - if ((cmd->_flagsOn & v8) != cmd->_flagsOn) continue; - if ((cmd->_flagsOff & ~v8) != cmd->_flagsOff) continue; + if (!onMatch || !offMatch) continue; _ctxt.z = z; _ctxt.cmd = cmd; -- cgit v1.2.3