diff options
author | Marisa-Chan | 2013-11-15 18:12:51 +0000 |
---|---|---|
committer | Marisa-Chan | 2013-11-15 18:12:51 +0000 |
commit | 677c74d59ffe43e618911f84c2dd4302cd11478f (patch) | |
tree | 889a35ea501e3d09426cef2bf80b2f65a00f6339 /engines | |
parent | 468c44581f4a051d435f8574fa4f689b97188ae2 (diff) | |
download | scummvm-rg350-677c74d59ffe43e618911f84c2dd4302cd11478f.tar.gz scummvm-rg350-677c74d59ffe43e618911f84c2dd4302cd11478f.tar.bz2 scummvm-rg350-677c74d59ffe43e618911f84c2dd4302cd11478f.zip |
ZVISION: Now onMouse functions handle return results and processing control list from end to beginning
Diffstat (limited to 'engines')
-rw-r--r-- | engines/zvision/script_manager.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index 28850857df..c8ef86556a 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -392,28 +392,31 @@ void ScriptManager::killSideFxType(SideFX::SideFXType type) { void ScriptManager::onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { if (!_activeControls) return; - for (ControlList::iterator iter = _activeControls->begin(); iter != _activeControls->end(); ++iter) { - (*iter)->onMouseDown(screenSpacePos, backgroundImageSpacePos); + for (ControlList::iterator iter = _activeControls->reverse_begin(); iter != _activeControls->end(); iter--) { + if ((*iter)->onMouseDown(screenSpacePos, backgroundImageSpacePos)) + return; } } void ScriptManager::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { if (!_activeControls) return; - for (ControlList::iterator iter = _activeControls->begin(); iter != _activeControls->end(); ++iter) { - (*iter)->onMouseUp(screenSpacePos, backgroundImageSpacePos); + for (ControlList::iterator iter = _activeControls->reverse_begin(); iter != _activeControls->end(); iter--) { + if ((*iter)->onMouseUp(screenSpacePos, backgroundImageSpacePos)) + return; } } bool ScriptManager::onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { if (!_activeControls) return false; - bool cursorWasChanged = false; - for (ControlList::iterator iter = _activeControls->begin(); iter != _activeControls->end(); ++iter) { - cursorWasChanged = cursorWasChanged || (*iter)->onMouseMove(screenSpacePos, backgroundImageSpacePos); + + for (ControlList::iterator iter = _activeControls->reverse_begin(); iter != _activeControls->end(); iter--) { + if ((*iter)->onMouseMove(screenSpacePos, backgroundImageSpacePos)) + return true; } - return cursorWasChanged; + return false; } void ScriptManager::onKeyDown(Common::KeyState keyState) { |