diff options
author | Colin Snover | 2016-06-19 21:37:07 -0500 |
---|---|---|
committer | Colin Snover | 2016-06-21 08:17:28 -0500 |
commit | a3055d3f491d77f5581b887179e204e5ce858f70 (patch) | |
tree | 3e221c0f333168f39eaf19ae20e54736d97c5b7f /engines/sci | |
parent | 820e6b8bd3783f78605f477a6f3f1548ffd8db98 (diff) | |
download | scummvm-rg350-a3055d3f491d77f5581b887179e204e5ce858f70.tar.gz scummvm-rg350-a3055d3f491d77f5581b887179e204e5ce858f70.tar.bz2 scummvm-rg350-a3055d3f491d77f5581b887179e204e5ce858f70.zip |
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.
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/resource.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
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. |