aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/m4/mads_views.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/engines/m4/mads_views.cpp b/engines/m4/mads_views.cpp
index 8b17a935f2..32328f8a13 100644
--- a/engines/m4/mads_views.cpp
+++ b/engines/m4/mads_views.cpp
@@ -132,9 +132,12 @@ int ScreenObjects::scan(int xp, int yp, int layer) {
}
int ScreenObjects::scanBackwards(int xp, int yp, int layer) {
- for (uint i = _entries.size() - 1; i >= 0; --i) {
+ for (uint i = _entries.size() - 1; ; --i) {
if (_entries[i].active && _entries[i].bounds.contains(xp, yp) && (_entries[i].layer == layer))
return i + 1;
+
+ if (i == 0)
+ break;
}
// Entry not found