From a3055d3f491d77f5581b887179e204e5ce858f70 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Sun, 19 Jun 2016 21:37:07 -0500 Subject: SCI: Add an explanation about LRU removals when fetching resources Several times I have run into this code and had to take a minute to remind myself that the call to remove from the LRU on find is not wrong, so it seemed to deserve a comment. --- engines/sci/resource.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 2a83a57227..3e50fc1082 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -1051,7 +1051,13 @@ Resource *ResourceManager::findResource(ResourceId id, bool lock) { if (retval->_status == kResStatusNoMalloc) loadResource(retval); else if (retval->_status == kResStatusEnqueued) + // The resource is removed from its current position + // in the LRU list because it has been requested + // again. Below, it will either be locked, or it + // will be added back to the LRU list at the 'most + // recent' position. removeFromLRU(retval); + // Unless an error occurred, the resource is now either // locked or allocated, but never queued or freed. -- cgit v1.2.3